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

PLearn::ExtendedVariable Class Reference

#include <ExtendedVariable.h>

Inheritance diagram for PLearn::ExtendedVariable:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ExtendedVariable ()
 Default constructor for persistence.

 ExtendedVariable (Variable *input, int the_top_extent, int the_bottom_extent, int the_left_extent, int the_right_extent, real the_fill_value)
 PLEARN_DECLARE_OBJECT (ExtendedVariable)
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 fprop ()
 compute output given input

virtual void bprop ()
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

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

int top_extent
int bottom_extent
int left_extent
int right_extent
real fill_value

Protected Member Functions

void build_ ()

Private Types

typedef UnaryVariable inherited

Detailed Description

Variable that extends the input variable by appending rows at its top and bottom and columns at its left and right. The appended rows/columns are filled with the given fill_value This can be used for instance to easily implement the usual trick to include the bias in the weights vectors, by appending a 1 to the inputs. It is also used in the symbolic bprop of SubMatVariable.

Definition at line 61 of file ExtendedVariable.h.


Member Typedef Documentation

typedef UnaryVariable PLearn::ExtendedVariable::inherited [private]
 

Reimplemented from PLearn::UnaryVariable.

Definition at line 63 of file ExtendedVariable.h.

Referenced by ExtendedVariable().


Constructor & Destructor Documentation

PLearn::ExtendedVariable::ExtendedVariable  )  [inline]
 

Default constructor for persistence.

Definition at line 74 of file ExtendedVariable.h.

References bottom_extent, fill_value, left_extent, right_extent, and top_extent.

PLearn::ExtendedVariable::ExtendedVariable Variable input,
int  the_top_extent,
int  the_bottom_extent,
int  the_left_extent,
int  the_right_extent,
real  the_fill_value
 

Definition at line 58 of file ExtendedVariable.cc.

References build_(), and inherited.


Member Function Documentation

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

Implements PLearn::Variable.

Definition at line 126 of file ExtendedVariable.cc.

References k, left_extent, PLearn::Var::length(), top_extent, PLearn::Var::width(), and PLearn::Variable::width().

void PLearn::ExtendedVariable::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 69 of file ExtendedVariable.cc.

References build_().

void PLearn::ExtendedVariable::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 76 of file ExtendedVariable.cc.

References bottom_extent, fill_value, k, left_extent, PLearn::Variable::nelems(), PLERROR, right_extent, and top_extent.

Referenced by build(), and ExtendedVariable().

void PLearn::ExtendedVariable::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::UnaryVariable.

Definition at line 85 of file ExtendedVariable.cc.

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

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

compute output given input

Implements PLearn::Variable.

Definition at line 104 of file ExtendedVariable.cc.

References k, left_extent, PLearn::Var::length(), top_extent, PLearn::Var::width(), and PLearn::Variable::width().

PLearn::ExtendedVariable::PLEARN_DECLARE_OBJECT ExtendedVariable   ) 
 

void PLearn::ExtendedVariable::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 95 of file ExtendedVariable.cc.

References bottom_extent, left_extent, PLearn::Var::length(), right_extent, top_extent, and PLearn::Var::width().

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

Reimplemented from PLearn::Variable.

Definition at line 154 of file ExtendedVariable.cc.

References k, left_extent, PLearn::Var::length(), PLearn::TVec< T >::length(), PLearn::UnaryVariable::resizeRValue(), top_extent, PLearn::Var::width(), and PLearn::Variable::width().

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

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

Reimplemented from PLearn::Variable.

Definition at line 148 of file ExtendedVariable.cc.

References left_extent, PLearn::Var::length(), top_extent, and PLearn::Var::width().


Member Data Documentation

int PLearn::ExtendedVariable::bottom_extent
 

Definition at line 67 of file ExtendedVariable.h.

Referenced by build_(), ExtendedVariable(), and recomputeSize().

real PLearn::ExtendedVariable::fill_value
 

Definition at line 70 of file ExtendedVariable.h.

Referenced by build_(), and ExtendedVariable().

int PLearn::ExtendedVariable::left_extent
 

Definition at line 68 of file ExtendedVariable.h.

Referenced by bprop(), build_(), ExtendedVariable(), fprop(), recomputeSize(), rfprop(), and symbolicBprop().

int PLearn::ExtendedVariable::right_extent
 

Definition at line 69 of file ExtendedVariable.h.

Referenced by build_(), ExtendedVariable(), and recomputeSize().

int PLearn::ExtendedVariable::top_extent
 

Definition at line 66 of file ExtendedVariable.h.

Referenced by bprop(), build_(), ExtendedVariable(), fprop(), recomputeSize(), rfprop(), and symbolicBprop().


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