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

#include <PDistributionVariable.h>

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

List of all members.

Public Types

typedef UnaryVariable inherited

Public Member Functions

 PDistributionVariable ()
 Default constructor for persistence.
 PDistributionVariable (Variable *no_noise_var, PP< PDistribution > this_dist)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual PDistributionVariabledeepCopy (CopiesMap &copies) const
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.
virtual void recomputeSize (int &l, int &w) const
 Recomputes the length l and width w that this variable should have, according to its parent variables.
virtual void fprop ()
 Nothing to do by default.
virtual void bprop ()
 Nothing to do by default.
virtual void bbprop ()
 compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...
virtual void symbolicBprop ()
 compute a piece of new Var graph that represents the symbolic derivative of this Var
virtual void rfprop ()

Static Public Member Functions

static string _classname_ ()
 PDistributionVariable.
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

PP< PDistributiondist

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Private Member Functions

void build_ ()
 Object-specific post-constructor.

Detailed Description

Definition at line 53 of file PDistributionVariable.h.


Member Typedef Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 56 of file PDistributionVariable.h.


Constructor & Destructor Documentation

PLearn::PDistributionVariable::PDistributionVariable ( ) [inline]

Default constructor for persistence.

Definition at line 67 of file PDistributionVariable.h.

{}
PLearn::PDistributionVariable::PDistributionVariable ( Variable no_noise_var,
PP< PDistribution this_dist 
)

Definition at line 56 of file PDistributionVariable.cc.

    : inherited(no_noise_var,no_noise_var->length(), no_noise_var->width()), dist(this_dist)
{}

Member Function Documentation

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

PDistributionVariable.

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

void PLearn::PDistributionVariable::bbprop ( ) [virtual]

compute an approximation to diag(d^2/dinput^2) given diag(d^2/doutput^2), with diag(d^2/dinput^2) ~=~ (doutput/dinput)' diag(d^2/doutput^2) (doutput/dinput) In particular: if 'C' depends on 'y' and 'y' depends on x ...

d^2C/dx^2 = d^2C/dy^2 * (dy/dx)^2 + dC/dy * d^2y/dx^2 (diaghessian) (gradient)

Reimplemented from PLearn::Variable.

Definition at line 108 of file PDistributionVariable.cc.

{} // No input: nothing to bbprop
void PLearn::PDistributionVariable::bprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 106 of file PDistributionVariable.cc.

{} // No input: nothing to bprop
void PLearn::PDistributionVariable::build ( ) [virtual]

Post-constructor.

The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::UnaryVariable.

Definition at line 83 of file PDistributionVariable.cc.

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

Here is the call graph for this function:

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

Object-specific post-constructor.

This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build() method, and possibly the public virtual read method (which calls its parent's read). build_() can assume that its parent's build_() has already been called.

Reimplemented from PLearn::UnaryVariable.

Definition at line 89 of file PDistributionVariable.cc.

References dist.

Referenced by build().

{
    dist->train();
}

Here is the caller graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Declare options (data fields) for the class.

Redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options). Please call the inherited method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).

  static void MyDerivedClass::declareOptions(OptionList& ol)
  {
      declareOption(ol, "inputsize", &MyObject::inputsize_,
                    OptionBase::buildoption,
                    "The size of the input; it must be provided");
      declareOption(ol, "weights", &MyObject::weights,
                    OptionBase::learntoption,
                    "The learned model weights");
      inherited::declareOptions(ol);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::UnaryVariable.

Definition at line 72 of file PDistributionVariable.cc.

References PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::UnaryVariable::declareOptions(), and dist.

{
    declareOption(ol, "dist", &PDistributionVariable::dist, OptionBase::buildoption, 
                  "PDistribution source of the variable.\n");

    inherited::declareOptions(ol);
}

Here is the call graph for this function:

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 70 of file PDistributionVariable.h.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

void PLearn::PDistributionVariable::fprop ( ) [virtual]

Nothing to do by default.

Reimplemented from PLearn::UnaryVariable.

Definition at line 101 of file PDistributionVariable.cc.

References dist, and PLearn::Variable::value.

{
    dist->generate(value);
}
OptionList & PLearn::PDistributionVariable::getOptionList ( ) const [virtual]

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Reimplemented from PLearn::UnaryVariable.

Definition at line 54 of file PDistributionVariable.cc.

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

Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.

This needs to be overridden by every class that adds "complex" data members to the class, such as Vec, Mat, PP<Something>, etc. Typical implementation:

  void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies)
  {
      inherited::makeDeepCopyFromShallowCopy(copies);
      deepCopyField(complex_data_member1, copies);
      deepCopyField(complex_data_member2, copies);
      ...
  }
Parameters:
copiesA map used by the deep-copy mechanism to keep track of already-copied objects.

Reimplemented from PLearn::UnaryVariable.

Definition at line 94 of file PDistributionVariable.cc.

References PLearn::deepCopyField(), dist, and PLearn::UnaryVariable::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:

void PLearn::PDistributionVariable::recomputeSize ( int l,
int w 
) const [virtual]

Recomputes the length l and width w that this variable should have, according to its parent variables.

This is used for ex. by sizeprop() The default version stupidly returns the current dimensions, so make sure to overload it in subclasses if this is not appropriate.

Reimplemented from PLearn::Variable.

Definition at line 60 of file PDistributionVariable.cc.

References PLearn::UnaryVariable::input, PLearn::Var::length(), and PLearn::Var::width().

{
    if (input) {
        l = input->length();
        w = input->width();
    } else
        l = w = 0;
}

Here is the call graph for this function:

void PLearn::PDistributionVariable::rfprop ( ) [virtual]

Reimplemented from PLearn::Variable.

Definition at line 109 of file PDistributionVariable.cc.

References PLERROR.

{ PLERROR("In PDistributionVariable::rfbprop() : Not implemented");} 
void PLearn::PDistributionVariable::symbolicBprop ( ) [virtual]

compute a piece of new Var graph that represents the symbolic derivative of this Var

Reimplemented from PLearn::Variable.

Definition at line 110 of file PDistributionVariable.cc.

{} // No input: nothing to bprop

Member Data Documentation

Reimplemented from PLearn::UnaryVariable.

Definition at line 70 of file PDistributionVariable.h.

Definition at line 57 of file PDistributionVariable.h.

Referenced by build_(), declareOptions(), fprop(), and makeDeepCopyFromShallowCopy().


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