shark::RpropMinus Class Reference

This class offers methods for the usage of the Resilient-Backpropagation-algorithm without weight-backtracking. More...

#include <shark/Algorithms/GradientDescent/Rprop.h>

+ Inheritance diagram for shark::RpropMinus:

Public Member Functions

SHARK_EXPORT_SYMBOL RpropMinus ()
 
std::string name () const
 From INameable: return the class name. More...
 
SHARK_EXPORT_SYMBOL void init (ObjectiveFunctionType const &objectiveFunction, SearchPointType const &startingPoint)
 initializes the optimizer using a predefined starting point More...
 
virtual SHARK_EXPORT_SYMBOL void init (ObjectiveFunctionType const &objectiveFunction, SearchPointType const &startingPoint, double initDelta)
 
SHARK_EXPORT_SYMBOL void step (ObjectiveFunctionType const &objectiveFunction)
 Carry out one step of the optimizer for the supplied objective function. More...
 
virtual SHARK_EXPORT_SYMBOL void read (InArchive &archive)
 Read the component from the supplied archive. More...
 
virtual SHARK_EXPORT_SYMBOL void write (OutArchive &archive) const
 Write the component to the supplied archive. More...
 
void setEtaMinus (double etaMinus)
 set decrease factor More...
 
void setEtaPlus (double etaPlus)
 set increase factor More...
 
void setMaxDelta (double d)
 set upper limit on update More...
 
void setMinDelta (double d)
 set lower limit on update More...
 
double maxDelta () const
 return the maximal step size component More...
 
RealVector const & derivative () const
 Returns the derivative at the current point. Can be used for stopping criteria. More...
 
- Public Member Functions inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
std::size_t numInitPoints () const
 By default most single objective optimizers only require a single point. More...
 
virtual void init (ObjectiveFunctionType const &function, std::vector< SearchPointType > const &initPoints)
 Initialize the optimizer for the supplied objective function using a set of initialisation points. More...
 
virtual const SolutionTypesolution () const
 returns the current solution of the optimizer More...
 
- Public Member Functions inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool requiresValue () const
 
bool requiresFirstDerivative () const
 
bool requiresSecondDerivative () const
 
bool canSolveConstrained () const
 
bool requiresClosestFeasible () const
 
virtual ~AbstractOptimizer ()
 
virtual void init (ObjectiveFunctionType const &function)
 Initialize the optimizer for the supplied objective function. More...
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 
- Public Member Functions inherited from shark::ISerializable
virtual ~ISerializable ()
 Virtual d'tor. More...
 
void load (InArchive &archive, unsigned int version)
 Versioned loading of components, calls read(...). More...
 
void save (OutArchive &archive, unsigned int version) const
 Versioned storing of components, calls write(...). More...
 
 BOOST_SERIALIZATION_SPLIT_MEMBER ()
 

Protected Attributes

ObjectiveFunctionType::FirstOrderDerivative m_derivative
 
double m_increaseFactor
 The increase factor \( \eta^+ \), set to 1.2 by default. More...
 
double m_decreaseFactor
 The decrease factor \( \eta^- \), set to 0.5 by default. More...
 
double m_maxDelta
 The upper limit of the increments \( \Delta w_i^{(t)} \), set to 1e100 by default. More...
 
double m_minDelta
 The lower limit of the increments \( \Delta w_i^{(t)} \), set to 0.0 by default. More...
 
size_t m_parameterSize
 
RealVector m_oldDerivative
 The last error gradient. More...
 
RealVector m_delta
 The absolute update values (increment) for all weights. More...
 
- Protected Attributes inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
SolutionType m_best
 Current solution of the optimizer. More...
 
- Protected Attributes inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
Features m_features
 

Additional Inherited Members

- Public Types inherited from shark::AbstractSingleObjectiveOptimizer< RealVector >
typedef base_type::SearchPointType SearchPointType
 
typedef base_type::SolutionType SolutionType
 
typedef base_type::ResultType ResultType
 
typedef base_type::ObjectiveFunctionType ObjectiveFunctionType
 
- Public Types inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
enum  Feature
 Models features that the optimizer requires from the objective function. More...
 
typedef RealVector SearchPointType
 
typedef double ResultType
 
typedef SingleObjectiveResultSet< RealVector > SolutionType
 
typedef AbstractObjectiveFunction< RealVector, ResultTypeObjectiveFunctionType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 
- Protected Member Functions inherited from shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >
void checkFeatures (ObjectiveFunctionType const &objectiveFunction)
 Convenience function that checks whether the features of the supplied objective function match with the required features of the optimizer. More...
 

Detailed Description

This class offers methods for the usage of the Resilient-Backpropagation-algorithm without weight-backtracking.

The Rprop algorithm is an improvement of the algorithms with adaptive learning rates (as the Adaptive Backpropagation algorithm by Silva and Ameida, please see AdpBP.h for a description of the working of such an algorithm), that uses increments for the update of the weights, that are independent from the absolute partial derivatives. This makes sense, because large flat regions in the search space (plateaus) lead to small absolute partial derivatives and so the increments are chosen small, but the increments should be large to skip the plateau. In contrast, the absolute partial derivatives are very large at the "slopes" of very "narrow canyons", which leads to large increments that will skip the minimum lying at the bottom of the canyon, but it would make more sense to chose small increments to hit the minimum.
So, the Rprop algorithm only uses the signs of the partial derivatives and not the absolute values to adapt the parameters.
Instead of individual learning rates, it uses the parameter \(\Delta_i^{(t)}\) for weight \(w_i,\ i = 1, \dots, n\) in iteration \(t\), where the parameter will be adapted before the change of the weights:

\( \Delta_i^{(t)} = \Bigg\{ \begin{array}{ll} min( \eta^+ \cdot \Delta_i^{(t-1)}, \Delta_{max} ), & \mbox{if\ } \frac{\partial E^{(t-1)}}{\partial w_i} \cdot \frac{\partial E^{(t)}}{\partial w_i} > 0 \\ max( \eta^- \cdot \Delta_i^{(t-1)}, \Delta_{min} ), & \mbox{if\ } \frac{\partial E^{(t-1)}}{\partial w_i} \cdot \frac{\partial E^{(t)}}{\partial w_i} < 0 \\ \Delta_i^{(t-1)}, & \mbox{otherwise} \end{array} \)

The parameters \(\eta^+ > 1\) and \(0 < \eta^- < 1\) control the speed of the adaptation. To stabilize the increments, they are restricted to the interval \([\Delta_{min}, \Delta_{max}]\).
After the adaptation of the \(\Delta_i\) the update for the weights will be calculated as

\( \Delta w_i^{(t)} := - \mbox{sign} \left( \frac{\partial E^{(t)}}{\partial w_i}\right) \cdot \Delta_i^{(t)} \)

For further information about the algorithm, please refer to:

Martin Riedmiller,
"Advanced Supervised Learning in Multi-layer Perceptrons - From Backpropagation to Adaptive Learning Algorithms".
In "International Journal of Computer Standards and Interfaces", volume 16, no. 5, 1994, pp. 265-278

Author
C. Igel
Date
1999
Changes:
none
Status:
stable

Definition at line 108 of file Rprop.h.

Constructor & Destructor Documentation

◆ RpropMinus()

SHARK_EXPORT_SYMBOL shark::RpropMinus::RpropMinus ( )

Member Function Documentation

◆ derivative()

RealVector const& shark::RpropMinus::derivative ( ) const
inline

Returns the derivative at the current point. Can be used for stopping criteria.

Definition at line 157 of file Rprop.h.

References m_derivative.

◆ init() [1/2]

SHARK_EXPORT_SYMBOL void shark::RpropMinus::init ( ObjectiveFunctionType const &  function,
SearchPointType const &  startingPoint 
)
virtual

◆ init() [2/2]

virtual SHARK_EXPORT_SYMBOL void shark::RpropMinus::init ( ObjectiveFunctionType const &  objectiveFunction,
SearchPointType const &  startingPoint,
double  initDelta 
)
virtual

◆ maxDelta()

double shark::RpropMinus::maxDelta ( ) const
inline

return the maximal step size component

Definition at line 152 of file Rprop.h.

References m_delta.

Referenced by run_one_trial().

◆ name()

std::string shark::RpropMinus::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Reimplemented in shark::IRpropMinus, shark::IRpropPlusFull, shark::IRpropPlus, and shark::RpropPlus.

Definition at line 114 of file Rprop.h.

References init(), read(), SHARK_EXPORT_SYMBOL, step(), and write().

◆ read()

virtual SHARK_EXPORT_SYMBOL void shark::RpropMinus::read ( InArchive archive)
virtual

Read the component from the supplied archive.

Parameters
[in,out]archiveThe archive to read from.

Reimplemented from shark::ISerializable.

Reimplemented in shark::IRpropPlusFull, shark::IRpropPlus, and shark::RpropPlus.

Referenced by name(), shark::RpropPlus::name(), shark::IRpropPlus::name(), and shark::IRpropPlusFull::name().

◆ setEtaMinus()

void shark::RpropMinus::setEtaMinus ( double  etaMinus)
inline

set decrease factor

Definition at line 127 of file Rprop.h.

References m_decreaseFactor, and RANGE_CHECK.

◆ setEtaPlus()

void shark::RpropMinus::setEtaPlus ( double  etaPlus)
inline

set increase factor

Definition at line 134 of file Rprop.h.

References m_increaseFactor, and RANGE_CHECK.

◆ setMaxDelta()

void shark::RpropMinus::setMaxDelta ( double  d)
inline

set upper limit on update

Definition at line 140 of file Rprop.h.

References m_maxDelta, and RANGE_CHECK.

◆ setMinDelta()

void shark::RpropMinus::setMinDelta ( double  d)
inline

set lower limit on update

Definition at line 146 of file Rprop.h.

References m_minDelta, and RANGE_CHECK.

◆ step()

SHARK_EXPORT_SYMBOL void shark::RpropMinus::step ( ObjectiveFunctionType const &  function)
virtual

Carry out one step of the optimizer for the supplied objective function.

Parameters
[in]functionThe objective function to initialize for.

Implements shark::AbstractOptimizer< RealVector, double, SingleObjectiveResultSet< RealVector > >.

Reimplemented in shark::IRpropMinus, shark::IRpropPlusFull, shark::IRpropPlus, and shark::RpropPlus.

Referenced by name(), shark::RpropPlus::name(), shark::IRpropPlus::name(), shark::IRpropPlusFull::name(), and shark::IRpropMinus::name().

◆ write()

virtual SHARK_EXPORT_SYMBOL void shark::RpropMinus::write ( OutArchive archive) const
virtual

Write the component to the supplied archive.

Parameters
[in,out]archiveThe archive to write to.

Reimplemented from shark::ISerializable.

Reimplemented in shark::IRpropPlusFull, shark::IRpropPlus, and shark::RpropPlus.

Referenced by name(), shark::RpropPlus::name(), shark::IRpropPlus::name(), and shark::IRpropPlusFull::name().

Member Data Documentation

◆ m_decreaseFactor

double shark::RpropMinus::m_decreaseFactor
protected

The decrease factor \( \eta^- \), set to 0.5 by default.

Definition at line 167 of file Rprop.h.

Referenced by setEtaMinus().

◆ m_delta

RealVector shark::RpropMinus::m_delta
protected

The absolute update values (increment) for all weights.

Definition at line 181 of file Rprop.h.

Referenced by maxDelta().

◆ m_derivative

ObjectiveFunctionType::FirstOrderDerivative shark::RpropMinus::m_derivative
protected

Definition at line 161 of file Rprop.h.

Referenced by derivative().

◆ m_increaseFactor

double shark::RpropMinus::m_increaseFactor
protected

The increase factor \( \eta^+ \), set to 1.2 by default.

Definition at line 164 of file Rprop.h.

Referenced by setEtaPlus().

◆ m_maxDelta

double shark::RpropMinus::m_maxDelta
protected

The upper limit of the increments \( \Delta w_i^{(t)} \), set to 1e100 by default.

Definition at line 170 of file Rprop.h.

Referenced by setMaxDelta().

◆ m_minDelta

double shark::RpropMinus::m_minDelta
protected

The lower limit of the increments \( \Delta w_i^{(t)} \), set to 0.0 by default.

Definition at line 173 of file Rprop.h.

Referenced by setMinDelta().

◆ m_oldDerivative

RealVector shark::RpropMinus::m_oldDerivative
protected

The last error gradient.

Definition at line 178 of file Rprop.h.

◆ m_parameterSize

size_t shark::RpropMinus::m_parameterSize
protected

Definition at line 175 of file Rprop.h.


The documentation for this class was generated from the following file: