Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::MatrixSumOfVariable Class Reference

#include <MatrixSumOfVariable.h>

Inheritance diagram for PLearn::MatrixSumOfVariable:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MatrixSumOfVariable ()
 protected default constructor for persistence

 MatrixSumOfVariable (VMat the_distr, Func the_f, int the_nsamples=-1, int the_input_size=-1)
 Sum_{inputs distr} f(inputs).

 PLEARN_DECLARE_OBJECT (MatrixSumOfVariable)
virtual void build ()
 Should call simply inherited::build(), then this class's build_().

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 makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
virtual void fprop ()
 compute output given input

virtual void bprop ()
virtual void fbprop ()
 do both fprop and bprop

virtual void symbolicBprop ()
 compute a piece of new Var graph that represents the symbolic derivative of this Var

virtual void rfprop ()
void printInfo (bool print_gradient)

Static Public Member Functions

void declareOptions (OptionList &ol)
 redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)


Public Attributes

VMat distr
Func f
int nsamples
int input_size
int curpos
 current pos in VMat

Vec input_value
Vec input_gradient
Vec output_value

Protected Member Functions

void build_ ()

Private Types

typedef NaryVariable inherited

Member Typedef Documentation

typedef NaryVariable PLearn::MatrixSumOfVariable::inherited [private]
 

Reimplemented from PLearn::NaryVariable.

Definition at line 54 of file MatrixSumOfVariable.h.

Referenced by MatrixSumOfVariable().


Constructor & Destructor Documentation

PLearn::MatrixSumOfVariable::MatrixSumOfVariable  )  [inline]
 

protected default constructor for persistence

Definition at line 70 of file MatrixSumOfVariable.h.

References curpos, distr, f, input_size, and nsamples.

PLearn::MatrixSumOfVariable::MatrixSumOfVariable VMat  the_distr,
Func  the_f,
int  the_nsamples = -1,
int  the_input_size = -1
 

Sum_{inputs distr} f(inputs).

Definition at line 55 of file MatrixSumOfVariable.cc.

References build_(), inherited, and PLearn::nonInputParentsOfPath().


Member Function Documentation

void PLearn::MatrixSumOfVariable::bprop  )  [virtual]
 

Implements PLearn::Variable.

Definition at line 137 of file MatrixSumOfVariable.cc.

References fbprop().

void PLearn::MatrixSumOfVariable::build  )  [virtual]
 

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::Variable.

Definition at line 64 of file MatrixSumOfVariable.cc.

References build_().

void PLearn::MatrixSumOfVariable::build_  )  [protected]
 

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 it's parent's build_ has already been called.

Reimplemented from PLearn::Variable.

Definition at line 71 of file MatrixSumOfVariable.cc.

References curpos, distr, f, input_gradient, input_value, PLearn::VMat::length(), nsamples, output_value, PLERROR, PLearn::TVec< T >::resize(), and PLearn::VMat::width().

Referenced by build(), and MatrixSumOfVariable().

void PLearn::MatrixSumOfVariable::declareOptions OptionList ol  )  [static]
 

redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down)

ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); }

Reimplemented from PLearn::NaryVariable.

Definition at line 89 of file MatrixSumOfVariable.cc.

References PLearn::declareOption(), and PLearn::OptionList.

void PLearn::MatrixSumOfVariable::fbprop  )  [virtual]
 

do both fprop and bprop

Reimplemented from PLearn::Variable.

Definition at line 141 of file MatrixSumOfVariable.cc.

References curpos, distr, f, input_gradient, input_size, input_value, PLearn::VMat::length(), nsamples, and PLearn::VMat::width().

Referenced by bprop().

void PLearn::MatrixSumOfVariable::fprop  )  [virtual]
 

compute output given input

Implements PLearn::Variable.

Definition at line 116 of file MatrixSumOfVariable.cc.

References curpos, distr, f, input_size, input_value, PLearn::VMat::length(), nsamples, and PLearn::VMat::width().

void PLearn::MatrixSumOfVariable::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Reimplemented from PLearn::NaryVariable.

Definition at line 108 of file MatrixSumOfVariable.cc.

References PLearn::deepCopyField(), distr, and f.

PLearn::MatrixSumOfVariable::PLEARN_DECLARE_OBJECT MatrixSumOfVariable   ) 
 

void PLearn::MatrixSumOfVariable::printInfo bool  print_gradient  )  [virtual]
 

Reimplemented from PLearn::NaryVariable.

Definition at line 174 of file MatrixSumOfVariable.cc.

References PLearn::TVec< T >::clear(), curpos, distr, PLearn::endl(), f, PLearn::Variable::getName(), PLearn::Object::info(), input_gradient, input_value, PLearn::VMat::length(), PLearn::Variable::nelems(), nsamples, output_value, PLERROR, and PLearn::VMat::width().

void PLearn::MatrixSumOfVariable::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 98 of file MatrixSumOfVariable.cc.

References f.

void PLearn::MatrixSumOfVariable::rfprop  )  [virtual]
 

Reimplemented from PLearn::Variable.

Definition at line 168 of file MatrixSumOfVariable.cc.

References PLERROR.

void PLearn::MatrixSumOfVariable::symbolicBprop  )  [virtual]
 

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

Reimplemented from PLearn::Variable.

Definition at line 162 of file MatrixSumOfVariable.cc.

References PLERROR.


Member Data Documentation

int PLearn::MatrixSumOfVariable::curpos
 

current pos in VMat

Definition at line 62 of file MatrixSumOfVariable.h.

Referenced by build_(), fbprop(), fprop(), MatrixSumOfVariable(), and printInfo().

VMat PLearn::MatrixSumOfVariable::distr
 

Definition at line 58 of file MatrixSumOfVariable.h.

Referenced by build_(), fbprop(), fprop(), makeDeepCopyFromShallowCopy(), MatrixSumOfVariable(), and printInfo().

Func PLearn::MatrixSumOfVariable::f
 

Definition at line 59 of file MatrixSumOfVariable.h.

Referenced by build_(), fbprop(), fprop(), makeDeepCopyFromShallowCopy(), MatrixSumOfVariable(), printInfo(), and recomputeSize().

Vec PLearn::MatrixSumOfVariable::input_gradient
 

Definition at line 65 of file MatrixSumOfVariable.h.

Referenced by build_(), fbprop(), and printInfo().

int PLearn::MatrixSumOfVariable::input_size
 

Definition at line 61 of file MatrixSumOfVariable.h.

Referenced by fbprop(), fprop(), and MatrixSumOfVariable().

Vec PLearn::MatrixSumOfVariable::input_value
 

Definition at line 64 of file MatrixSumOfVariable.h.

Referenced by build_(), fbprop(), fprop(), and printInfo().

int PLearn::MatrixSumOfVariable::nsamples
 

Definition at line 60 of file MatrixSumOfVariable.h.

Referenced by build_(), fbprop(), fprop(), MatrixSumOfVariable(), and printInfo().

Vec PLearn::MatrixSumOfVariable::output_value
 

Definition at line 66 of file MatrixSumOfVariable.h.

Referenced by build_(), and printInfo().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:25:13 2004 for PLearn by doxygen 1.3.7