PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Private Types | Private Member Functions
PLearn::PConditionalDistribution Class Reference

#include <PConditionalDistribution.h>

Inheritance diagram for PLearn::PConditionalDistribution:
Inheritance graph
[legend]
Collaboration diagram for PLearn::PConditionalDistribution:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PConditionalDistribution ()
 Default constructor.
virtual void build ()
 Simply calls inherited::build() then build_()
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.
virtual void setInput (const Vec &input) const
 Set the input part before using the inherited methods.
virtual void computeOutput (const Vec &input, Vec &output) const
 Produce outputs according to what is specified in outputs_def.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual PConditionalDistributiondeepCopy (CopiesMap &copies) const

Static Public Member Functions

static string _classname_ ()
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Public Attributes

int input_part_size

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares this class' options.

Private Types

typedef PDistribution inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 44 of file PConditionalDistribution.h.


Member Typedef Documentation

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 49 of file PConditionalDistribution.h.


Constructor & Destructor Documentation

PLearn::PConditionalDistribution::PConditionalDistribution ( )

Default constructor.

Definition at line 40 of file PConditionalDistribution.cc.


Member Function Documentation

string PLearn::PConditionalDistribution::_classname_ ( ) [static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

OptionList & PLearn::PConditionalDistribution::_getOptionList_ ( ) [static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

RemoteMethodMap & PLearn::PConditionalDistribution::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

bool PLearn::PConditionalDistribution::_isa_ ( const Object o) [static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

Object * PLearn::PConditionalDistribution::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

StaticInitializer PConditionalDistribution::_static_initializer_ & PLearn::PConditionalDistribution::_static_initialize_ ( ) [static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

void PLearn::PConditionalDistribution::build ( ) [virtual]

Simply calls inherited::build() then build_()

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 82 of file PConditionalDistribution.cc.

References PLearn::PDistribution::build(), and build_().

Referenced by PLearn::GaussianProcessRegressor::build().

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::PConditionalDistribution::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 72 of file PConditionalDistribution.cc.

References input_part_size, PLearn::PDistribution::outputs_def, and PLearn::PLearner::train_set.

Referenced by build().

{
    if (train_set)
    {
        if (outputs_def=="L" || outputs_def=="D" || outputs_def=="C" || outputs_def=="S" || outputs_def=="e" || outputs_def=="v")
            input_part_size = train_set->inputsize();
    }
}

Here is the caller graph for this function:

string PLearn::PConditionalDistribution::classname ( ) const [virtual]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

void PLearn::PConditionalDistribution::computeOutput ( const Vec input,
Vec output 
) const [virtual]

Produce outputs according to what is specified in outputs_def.

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 97 of file PConditionalDistribution.cc.

References PLearn::PDistribution::cdf(), d, PLearn::PDistribution::density(), PLearn::PDistribution::expectation(), i, input_part_size, PLearn::TVec< T >::length(), PLearn::PDistribution::log_density(), PLearn::PDistribution::lower_bound, PLearn::PDistribution::n_curve_points, PLearn::PDistribution::outputs_def, PLERROR, setInput(), PLearn::TVec< T >::subVec(), PLearn::PDistribution::survival_fn(), PLearn::TVec< T >::toMat(), PLearn::PDistribution::upper_bound, PLearn::PDistribution::variance(), and x.

{
    Vec x = input.subVec(0,input_part_size);
    int d=input.length()-input_part_size;
    Vec y = input.subVec(input_part_size,d);
    setInput(x);
    if (outputs_def=="l")
        output[0]=log_density(y);
    else if (outputs_def=="d")
        output[0]=density(y);
    else if (outputs_def=="c")
        output[0]=cdf(y);
    else if (outputs_def=="s")
        output[0]=survival_fn(y);
    else if (outputs_def=="e")
        expectation(output);
    else if (outputs_def=="v")
    {
        Mat covmat = output.toMat(d,d);
        variance(covmat);
    }
    else if (outputs_def=="L")
    {
        real lower = lower_bound;
        real upper = upper_bound;
        real delta = (upper - lower)/n_curve_points;
        Vec y(1); y[0]=lower;
        for (int i=0;i<n_curve_points;i++)
        {
            output[i] = log_density(y);
            y[0]+=delta;
        }
    }
    else if (outputs_def=="D")
    {
        real lower = lower_bound;
        real upper = upper_bound;
        real delta = (upper - lower)/n_curve_points;
        Vec y(1); y[0]=lower;
        for (int i=0;i<n_curve_points;i++)
        {
            output[i] = density(y);
            y[0]+=delta;
        }
    }
    else if (outputs_def=="C")
    {
        real lower = lower_bound;
        real upper = upper_bound;
        real delta = (upper - lower)/n_curve_points;
        Vec y(1); y[0]=lower;
        for (int i=0;i<n_curve_points;i++)
        {
            output[i] = cdf(y);
            y[0]+=delta;
        }
    }
    else if (outputs_def=="S")
    {
        real lower = lower_bound;
        real upper = upper_bound;
        real delta = (upper - lower)/n_curve_points;
        Vec y(1); y[0]=lower;
        for (int i=0;i<n_curve_points;i++)
        {
            output[i] = survival_fn(y);
            y[0]+=delta;
        }
    }
    else PLERROR("PConditionalDistribution: unknown setting of outputs_def = %s",outputs_def.c_str());
}

Here is the call graph for this function:

void PLearn::PConditionalDistribution::declareOptions ( OptionList ol) [static, protected]

Declares this class' options.

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 61 of file PConditionalDistribution.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::PDistribution::declareOptions(), and input_part_size.

Referenced by PLearn::GaussianProcessRegressor::declareOptions().

{
    declareOption(ol, "input_part_size", &PConditionalDistribution::input_part_size, OptionBase::buildoption,
                  "This option should be used only if outputs_def is 'l','d','c' or 's' (or upper case),\n"
                  "which is when computeOutput takes as input both the X and Y parts to compute P(Y|X).\n"
                  "This option gives the size of X, that is the length of the part of the data input which\n"
                  "contains the conditioning part of the distribution. The rest of the data input vector should\n"
                  "contain the Y value. If outputs_def is 'e' or 'v' or upper case then this option is ignored.\n");
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const PPath& PLearn::PConditionalDistribution::declaringFile ( ) [inline, static]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 98 of file PConditionalDistribution.h.

PConditionalDistribution * PLearn::PConditionalDistribution::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

OptionList & PLearn::PConditionalDistribution::getOptionList ( ) const [virtual]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

OptionMap & PLearn::PConditionalDistribution::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

RemoteMethodMap & PLearn::PConditionalDistribution::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 59 of file PConditionalDistribution.cc.

void PLearn::PConditionalDistribution::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor, and PLearn::GaussianProcessRegressor.

Definition at line 88 of file PConditionalDistribution.cc.

References PLearn::PDistribution::makeDeepCopyFromShallowCopy().

Referenced by PLearn::GaussianProcessRegressor::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:

Here is the caller graph for this function:

void PLearn::PConditionalDistribution::setInput ( const Vec input) const [virtual]

Set the input part before using the inherited methods.

Reimplemented in PLearn::GaussianProcessRegressor.

Definition at line 93 of file PConditionalDistribution.cc.

References PLERROR.

Referenced by computeOutput().

{ PLERROR("setInput must be implemented for this PConditionalDistribution"); }

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from PLearn::PDistribution.

Reimplemented in PLearn::GaussianProcessRegressor.

Definition at line 98 of file PConditionalDistribution.h.

Definition at line 64 of file PConditionalDistribution.h.

Referenced by build_(), computeOutput(), and declareOptions().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines