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

PLearn::GradientOptimizer Class Reference

#include <GradientOptimizer.h>

Inheritance diagram for PLearn::GradientOptimizer:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 GradientOptimizer (real the_start_learning_rate=0.01, real the_decrease_constant=0, int n_updates=1, const string &filename="", int every_iterations=1)
 GradientOptimizer (VarArray the_params, Var the_cost, real the_start_learning_rate=0.01, real the_decrease_constant=0, int n_updates=1, const string &filename="", int every_iterations=1)
 GradientOptimizer (VarArray the_params, Var the_cost, VarArray update_for_measure, real the_start_learning_rate=0.01, real the_decrease_constant=0, int n_updates=1, const string &filename="", int every_iterations=1)
 PLEARN_DECLARE_OBJECT (GradientOptimizer)
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
virtual void build ()
 Should call simply inherited::build(), then this class's build_().

virtual real optimize ()
 sub-classes should define this, which is the main method

virtual bool optimizeN (VecStatsCollector &stats_coll)
 sub-classes should define this, which is the new main method


Public Attributes

real learning_rate
 gradient descent specific parameters (directly modifiable by the user)

real start_learning_rate
real decrease_constant
Mat lr_schedule

Static Protected 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)


Private Types

typedef Optimizer inherited

Private Member Functions

void build_ ()

Member Typedef Documentation

typedef Optimizer PLearn::GradientOptimizer::inherited [private]
 

Reimplemented from PLearn::Optimizer.

Definition at line 58 of file GradientOptimizer.h.

Referenced by GradientOptimizer().


Constructor & Destructor Documentation

PLearn::GradientOptimizer::GradientOptimizer real  the_start_learning_rate = 0.01,
real  the_decrease_constant = 0,
int  n_updates = 1,
const string filename = "",
int  every_iterations = 1
 

Definition at line 52 of file GradientOptimizer.cc.

References inherited.

PLearn::GradientOptimizer::GradientOptimizer VarArray  the_params,
Var  the_cost,
real  the_start_learning_rate = 0.01,
real  the_decrease_constant = 0,
int  n_updates = 1,
const string filename = "",
int  every_iterations = 1
 

Definition at line 60 of file GradientOptimizer.cc.

PLearn::GradientOptimizer::GradientOptimizer VarArray  the_params,
Var  the_cost,
VarArray  update_for_measure,
real  the_start_learning_rate = 0.01,
real  the_decrease_constant = 0,
int  n_updates = 1,
const string filename = "",
int  every_iterations = 1
 

Definition at line 69 of file GradientOptimizer.cc.


Member Function Documentation

virtual void PLearn::GradientOptimizer::build  )  [inline, 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::Optimizer.

Definition at line 100 of file GradientOptimizer.h.

References build_().

void PLearn::GradientOptimizer::build_  )  [inline, private]
 

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

Definition at line 106 of file GradientOptimizer.h.

Referenced by build().

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

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

Definition at line 81 of file GradientOptimizer.cc.

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

virtual void PLearn::GradientOptimizer::makeDeepCopyFromShallowCopy CopiesMap copies  )  [inline, 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. Typical implementation:

void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies) { SUPERCLASS_OF_THIS::makeDeepCopyFromShallowCopy(copies); member_ptr = member_ptr->deepCopy(copies); member_smartptr = member_smartptr->deepCopy(copies); member_mat.makeDeepCopyFromShallowCopy(copies); member_vec.makeDeepCopyFromShallowCopy(copies); ... }

Reimplemented from PLearn::Object.

Definition at line 98 of file GradientOptimizer.h.

References PLearn::CopiesMap, and makeDeepCopyFromShallowCopy().

Referenced by makeDeepCopyFromShallowCopy().

real PLearn::GradientOptimizer::optimize  )  [virtual]
 

sub-classes should define this, which is the main method

Implements PLearn::Optimizer.

Definition at line 140 of file GradientOptimizer.cc.

References PLearn::addIfNonMissing(), PLearn::TVec< T >::clear(), PLearn::VarArray::clearGradient(), decrease_constant, PLearn::displayVarGraph(), PLearn::displayvg, PLearn::endl(), PLearn::VarArray::fbprop(), learning_rate, PLearn::SumOfVariable::nsamples, PLearn::TVec< T >::resize(), PLearn::TVec< Var >::size(), start_learning_rate, PLearn::VarArray::updateAndClear(), and PLearn::Vec.

bool PLearn::GradientOptimizer::optimizeN VecStatsCollector stats_coll  )  [virtual]
 

sub-classes should define this, which is the new main method

Implements PLearn::Optimizer.

Definition at line 215 of file GradientOptimizer.cc.

References PLearn::VarArray::clearGradient(), decrease_constant, PLearn::displayVarGraph(), PLearn::VarArray::fbprop(), PLearn::TVec< Var >::hasMissing(), learning_rate, PLearn::TMat< T >::length(), lr_schedule, PLearn::SumOfVariable::nsamples, PLERROR, PLearn::TVec< T >::resize(), PLearn::TVec< Var >::size(), start_learning_rate, PLearn::VecStatsCollector::update(), and PLearn::VarArray::updateAndClear().

PLearn::GradientOptimizer::PLEARN_DECLARE_OBJECT GradientOptimizer   ) 
 


Member Data Documentation

real PLearn::GradientOptimizer::decrease_constant
 

Definition at line 72 of file GradientOptimizer.h.

Referenced by optimize(), and optimizeN().

real PLearn::GradientOptimizer::learning_rate
 

gradient descent specific parameters (directly modifiable by the user)

Definition at line 68 of file GradientOptimizer.h.

Referenced by optimize(), and optimizeN().

Mat PLearn::GradientOptimizer::lr_schedule
 

Definition at line 78 of file GradientOptimizer.h.

Referenced by optimizeN().

real PLearn::GradientOptimizer::start_learning_rate
 

Definition at line 71 of file GradientOptimizer.h.

Referenced by optimize(), and optimizeN().


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