GClasses
GClasses::GEmpiricalGradientDescent Class Reference

Detailed Description

This algorithm does a gradient descent by feeling a small distance out in each dimension to measure the gradient. For efficiency reasons, it only measures the gradient in one dimension (which it cycles round-robin style) per iteration and uses the remembered gradient in the other dimensions.

#include <GHillClimber.h>

Inheritance diagram for GClasses::GEmpiricalGradientDescent:
GClasses::GOptimizer

Public Member Functions

 GEmpiricalGradientDescent (GTargetFunction *pCritic, GRand *pRand)
 
virtual ~GEmpiricalGradientDescent ()
 
virtual const GVeccurrentVector ()
 Returns the best vector yet found. More...
 
virtual double iterate ()
 Performs a little more optimization. (Call this in a loop until acceptable results are found.) More...
 
void setLearningRate (double d)
 Sets the learning rate. More...
 
void setMomentum (double d)
 Sets the momentum value. More...
 
- Public Member Functions inherited from GClasses::GOptimizer
 GOptimizer (GTargetFunction *pCritic)
 
virtual ~GOptimizer ()
 
void basicTest (double minAccuracy, double warnRange=0.001)
 This is a helper method used by the unit tests of several model learners. More...
 
double searchUntil (size_t nBurnInIterations, size_t nIterations, double dImprovement)
 This will first call iterate() nBurnInIterations times, then it will repeatedly call iterate() in blocks of nIterations times. If the error heuristic has not improved by the specified ratio after a block of iterations, it will stop. (For example, if the error before the block of iterations was 50, and the error after is 49, then training will stop if dImprovement is > 0.02.) If the error heuristic is not stable, then the value of nIterations should be large. More...
 

Protected Member Functions

void reset ()
 

Protected Attributes

double m_dFeelDistance
 
double m_dLearningRate
 
double m_dMomentum
 
size_t m_nDimensions
 
GVec m_pDelta
 
GVec m_pGradient
 
GRandm_pRand
 
GVec m_pVector
 
- Protected Attributes inherited from GClasses::GOptimizer
GTargetFunctionm_pCritic
 

Constructor & Destructor Documentation

GClasses::GEmpiricalGradientDescent::GEmpiricalGradientDescent ( GTargetFunction pCritic,
GRand pRand 
)
virtual GClasses::GEmpiricalGradientDescent::~GEmpiricalGradientDescent ( )
virtual

Member Function Documentation

virtual const GVec& GClasses::GEmpiricalGradientDescent::currentVector ( )
inlinevirtual

Returns the best vector yet found.

Implements GClasses::GOptimizer.

virtual double GClasses::GEmpiricalGradientDescent::iterate ( )
virtual

Performs a little more optimization. (Call this in a loop until acceptable results are found.)

Implements GClasses::GOptimizer.

void GClasses::GEmpiricalGradientDescent::reset ( )
protected
void GClasses::GEmpiricalGradientDescent::setLearningRate ( double  d)
inline

Sets the learning rate.

void GClasses::GEmpiricalGradientDescent::setMomentum ( double  d)
inline

Sets the momentum value.

Member Data Documentation

double GClasses::GEmpiricalGradientDescent::m_dFeelDistance
protected
double GClasses::GEmpiricalGradientDescent::m_dLearningRate
protected
double GClasses::GEmpiricalGradientDescent::m_dMomentum
protected
size_t GClasses::GEmpiricalGradientDescent::m_nDimensions
protected
GVec GClasses::GEmpiricalGradientDescent::m_pDelta
protected
GVec GClasses::GEmpiricalGradientDescent::m_pGradient
protected
GRand* GClasses::GEmpiricalGradientDescent::m_pRand
protected
GVec GClasses::GEmpiricalGradientDescent::m_pVector
protected