#include <GradientOptimizer.h>
Inheritance diagram for PLearn::GradientOptimizer:
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_ () |
|
Reimplemented from PLearn::Optimizer. Definition at line 58 of file GradientOptimizer.h. Referenced by GradientOptimizer(). |
|
Definition at line 52 of file GradientOptimizer.cc. References inherited. |
|
Definition at line 60 of file GradientOptimizer.cc. |
|
Definition at line 69 of file GradientOptimizer.cc. |
|
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_(). |
|
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(). |
|
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. |
|
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(). |
|
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. |
|
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(). |
|
|
|
Definition at line 72 of file GradientOptimizer.h. Referenced by optimize(), and optimizeN(). |
|
gradient descent specific parameters (directly modifiable by the user)
Definition at line 68 of file GradientOptimizer.h. Referenced by optimize(), and optimizeN(). |
|
Definition at line 78 of file GradientOptimizer.h. Referenced by optimizeN(). |
|
Definition at line 71 of file GradientOptimizer.h. Referenced by optimize(), and optimizeN(). |