PLearn 0.1
|
Virtual class used for converting a sequence of n-dimensional gradients g_t into corrected update directions v_t. More...
#include <GradientCorrector.h>
Public Member Functions | |
GradientCorrector () | |
Default constructor. | |
virtual void | init ()=0 |
initialize the object to start collecting covariance statistics from fresh | |
virtual void | operator() (int t, const Vec &g, Vec v)=0 |
main method of this class: reads from the gradient "g" field and writes into the "v" field an estimator of inv(cov) g. | |
virtual GradientCorrector * | deepCopy (CopiesMap &copies) const |
virtual void | build () |
Post-constructor. | |
virtual void | makeDeepCopyFromShallowCopy (CopiesMap &copies) |
Transforms a shallow copy into a deep copy. | |
Static Public Member Functions | |
static string | _classname_ () |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Public Attributes | |
int | n_dim |
### declare public option fields (such as build options) here | |
int | verbosity |
verbosity level, track improvement, spectrum, etgc. | |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Static Protected Member Functions | |
static void | declareOptions (OptionList &ol) |
Declares the class options. | |
Private Types | |
typedef Object | inherited |
Private Member Functions | |
void | build_ () |
This does the actual building. |
Virtual class used for converting a sequence of n-dimensional gradients g_t into corrected update directions v_t.
There is a main method, the operator(), which takes a g_t and fills v_t. The process can be initialized by init().
Definition at line 55 of file GradientCorrector.h.
typedef Object PLearn::GradientCorrector::inherited [private] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.h.
PLearn::GradientCorrector::GradientCorrector | ( | ) |
Default constructor.
Definition at line 59 of file GradientCorrector.cc.
string PLearn::GradientCorrector::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.cc.
OptionList & PLearn::GradientCorrector::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.cc.
RemoteMethodMap & PLearn::GradientCorrector::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.cc.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.cc.
StaticInitializer GradientCorrector::_static_initializer_ & PLearn::GradientCorrector::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.cc.
void PLearn::GradientCorrector::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::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 67 of file GradientCorrector.cc.
References PLearn::Object::build(), and build_().
{ inherited::build(); build_(); }
void PLearn::GradientCorrector::build_ | ( | ) | [private] |
This does the actual building.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator.
Definition at line 95 of file GradientCorrector.cc.
References init().
Referenced by build().
{ init(); }
void PLearn::GradientCorrector::declareOptions | ( | OptionList & | ol | ) | [static, protected] |
Declares the class options.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 78 of file GradientCorrector.cc.
References PLearn::declareOption(), PLearn::Object::declareOptions(), PLearn::OptionBase::learntoption, and n_dim.
{ // ### Declare all of this object's options here. // ### For the "flags" of each option, you should typically specify // ### one of OptionBase::buildoption, OptionBase::learntoption or // ### OptionBase::tuningoption. If you don't provide one of these three, // ### this option will be ignored when loading values from a script. // ### You can also combine flags, for example with OptionBase::nosave: // ### (OptionBase::buildoption | OptionBase::nosave) declareOption(ol, "n_dim", &GradientCorrector::n_dim, OptionBase::learntoption, "Number of dimensions of the gradient vectors\n"); // Now call the parent class' declareOptions inherited::declareOptions(ol); }
static const PPath& PLearn::GradientCorrector::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 95 of file GradientCorrector.h.
:
//##### Protected Options ###############################################
GradientCorrector * PLearn::GradientCorrector::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 57 of file GradientCorrector.cc.
virtual void PLearn::GradientCorrector::init | ( | ) | [pure virtual] |
initialize the object to start collecting covariance statistics from fresh
Implemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Referenced by build_().
void PLearn::GradientCorrector::makeDeepCopyFromShallowCopy | ( | CopiesMap & | copies | ) | [virtual] |
Transforms a shallow copy into a deep copy.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Definition at line 73 of file GradientCorrector.cc.
References PLearn::Object::makeDeepCopyFromShallowCopy().
{ inherited::makeDeepCopyFromShallowCopy(copies); }
main method of this class: reads from the gradient "g" field and writes into the "v" field an estimator of inv(cov) g.
The argument is an index over examples, which is used to know when cycling through a minibatch. The statistics on the covariance are updated.
Implemented in PLearn::NatGradEstimator, and PLearn::NatGradEstimator.
Reimplemented from PLearn::Object.
Reimplemented in PLearn::NatGradEstimator.
Definition at line 95 of file GradientCorrector.h.
### declare public option fields (such as build options) here
number of input dimensions (size of g_t or v_t)
Reimplemented in PLearn::NatGradEstimator.
Definition at line 65 of file GradientCorrector.h.
Referenced by declareOptions().
verbosity level, track improvement, spectrum, etgc.
Reimplemented in PLearn::NatGradEstimator.
Definition at line 68 of file GradientCorrector.h.