#include <AdaptGradientOptimizer.h>
Inheritance diagram for PLearn::AdaptGradientOptimizer:
Public Member Functions | |
AdaptGradientOptimizer (real the_start_learning_rate=0.01, real the_decrease_constant=0, real the_min_learning_rate=0.001, real the_max_learning_rate=0.02, int the_learning_rate_adaptation=0, real the_adapt_coeff1=0, real the_adapt_coeff2=0, int n_updates=1, const string &filename="", int every_iterations=1) | |
AdaptGradientOptimizer (VarArray the_params, Var the_cost, real the_start_learning_rate=0.01, real the_decrease_constant=0, real the_min_learning_rate=0.001, real the_max_learning_rate=0.02, int the_learning_rate_adaptation=0, real the_adapt_coeff1=0, real the_adapt_coeff2=0, int n_updates=1, const string &filename="", int every_iterations=1) | |
AdaptGradientOptimizer (VarArray the_params, Var the_cost, VarArray update_for_measure, real the_start_learning_rate=0.01, real the_decrease_constant=0, real the_min_learning_rate=0.001, real the_max_learning_rate=0.02, int the_learning_rate_adaptation=0, real the_adapt_coeff1=0, real the_adapt_coeff2=0, int n_updates=1, const string &filename="", int every_iterations=1) | |
PLEARN_DECLARE_OBJECT (AdaptGradientOptimizer) | |
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 |
initial learning rate | |
real | min_learning_rate |
min value for learning_rate when adapting | |
real | max_learning_rate |
max value for learning_rate when adapting | |
int | learning_rate_adaptation |
Learning rate adaptation kind : 0 : none 1 : basic 2 : ALAP1 3 : variance. | |
real | adapt_coeff1 |
a coefficient for learning rate adaptation | |
real | adapt_coeff2 |
a coefficient for learning rate adaptation | |
real | decrease_constant |
int | mini_batch |
int | adapt_every |
after how many updates we adapt learning rate | |
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_ () |
void | adaptLearningRateBasic (Vec old_params, Vec new_evol) |
void | adaptLearningRateALAP1 (Vec old_gradient, Vec new_gradient) |
void | adaptLearningRateVariance () |
Private Attributes | |
bool | stochastic_hack |
Vec | learning_rates |
Vec | gradient |
Vec | tmp_storage |
Vec | old_evol |
Array< Mat > | oldgradientlocations |
Vec | store_var_grad |
Vec | store_grad |
Vec | store_quad_grad |
int | count_updates |
A (possibly stochastic) gradient optimizer using various learning rate adaptation methods.
Definition at line 64 of file AdaptGradientOptimizer.h.
|
Reimplemented from PLearn::Optimizer. Definition at line 66 of file AdaptGradientOptimizer.h. Referenced by AdaptGradientOptimizer(). |
|
Definition at line 51 of file AdaptGradientOptimizer.cc. References inherited. |
|
Definition at line 71 of file AdaptGradientOptimizer.cc. |
|
Definition at line 90 of file AdaptGradientOptimizer.cc. |
|
Definition at line 207 of file AdaptGradientOptimizer.cc. References adapt_coeff1, learning_rate, max_learning_rate, min_learning_rate, and PLearn::VarArray::nelems(). Referenced by optimizeN(). |
|
Definition at line 227 of file AdaptGradientOptimizer.cc. References adapt_coeff1, adapt_coeff2, PLearn::TVec< Var >::data(), k, learning_rates, max_learning_rate, min_learning_rate, and PLearn::TVec< Var >::size(). Referenced by optimizeN(). |
|
Definition at line 278 of file AdaptGradientOptimizer.cc. References adapt_coeff1, PLearn::TVec< T >::clear(), count_updates, learning_rates, max_learning_rate, min_learning_rate, PLearn::VarArray::nelems(), store_grad, store_quad_grad, and store_var_grad. Referenced by optimizeN(). |
|
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 142 of file AdaptGradientOptimizer.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 163 of file AdaptGradientOptimizer.cc. References PLearn::TVec< T >::clear(), PLearn::VarArray::clearGradient(), PLearn::VarArray::copyTo(), count_updates, PLearn::TVec< T >::fill(), gradient, learning_rate, learning_rate_adaptation, learning_rates, PLearn::VarArray::nelems(), PLearn::SumOfVariable::nsamples, old_evol, oldgradientlocations, PLearn::TVec< Mat >::resize(), PLearn::TVec< T >::resize(), PLearn::TVec< Var >::size(), start_learning_rate, stochastic_hack, store_grad, store_quad_grad, store_var_grad, and tmp_storage. 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 112 of file AdaptGradientOptimizer.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 140 of file AdaptGradientOptimizer.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 312 of file AdaptGradientOptimizer.cc. References PLERROR. |
|
sub-classes should define this, which is the new main method
Implements PLearn::Optimizer. Definition at line 321 of file AdaptGradientOptimizer.cc. References adapt_every, adaptLearningRateALAP1(), adaptLearningRateBasic(), adaptLearningRateVariance(), PLearn::VarArray::clearGradient(), PLearn::VarArray::copyGradientTo(), PLearn::VarArray::copyTo(), count_updates, decrease_constant, PLearn::endl(), PLearn::VarArray::fbprop(), gradient, learning_rate, learning_rate_adaptation, learning_rates, PLearn::VarArray::nelems(), old_evol, oldgradientlocations, PLearn::TVec< Var >::size(), start_learning_rate, stochastic_hack, store_grad, store_quad_grad, tmp_storage, PLearn::VecStatsCollector::update(), PLearn::VarArray::update(), and PLearn::VarArray::updateAndClear(). |
|
|
|
a coefficient for learning rate adaptation
Definition at line 84 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateALAP1(), adaptLearningRateBasic(), and adaptLearningRateVariance(). |
|
a coefficient for learning rate adaptation
Definition at line 85 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateBasic(). |
|
after how many updates we adapt learning rate
Definition at line 88 of file AdaptGradientOptimizer.h. Referenced by optimizeN(). |
|
Definition at line 103 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateVariance(), build_(), and optimizeN(). |
|
Definition at line 86 of file AdaptGradientOptimizer.h. Referenced by optimizeN(). |
|
Definition at line 94 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |
|
gradient descent specific parameters (directly modifiable by the user)
Definition at line 72 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateALAP1(), build_(), and optimizeN(). |
|
Learning rate adaptation kind : 0 : none 1 : basic 2 : ALAP1 3 : variance.
Definition at line 83 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |
|
Definition at line 93 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateBasic(), adaptLearningRateVariance(), build_(), and optimizeN(). |
|
max value for learning_rate when adapting
Definition at line 77 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateALAP1(), adaptLearningRateBasic(), and adaptLearningRateVariance(). |
|
min value for learning_rate when adapting
Definition at line 76 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateALAP1(), adaptLearningRateBasic(), and adaptLearningRateVariance(). |
|
Definition at line 87 of file AdaptGradientOptimizer.h. |
|
Definition at line 98 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |
|
Definition at line 99 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |
|
initial learning rate
Definition at line 75 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |
|
Definition at line 92 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |
|
Definition at line 101 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateVariance(), build_(), and optimizeN(). |
|
Definition at line 102 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateVariance(), build_(), and optimizeN(). |
|
Definition at line 100 of file AdaptGradientOptimizer.h. Referenced by adaptLearningRateVariance(), and build_(). |
|
Definition at line 95 of file AdaptGradientOptimizer.h. Referenced by build_(), and optimizeN(). |