GClasses
GClasses::GMomentumGreedySearch Class Reference

Detailed Description

At each iteration this algorithm moves in only one dimension. If the situation doesn't improve it tries the opposite direction. If both directions are worse, it decreases the step size for that dimension, otherwise it increases the step size for that dimension.

#include <GHillClimber.h>

Inheritance diagram for GClasses::GMomentumGreedySearch:
GClasses::GOptimizer

Public Member Functions

 GMomentumGreedySearch (GTargetFunction *pCritic)
 
virtual ~GMomentumGreedySearch ()
 
virtual const GVeccurrentVector ()
 Returns a pointer to the state vector. More...
 
virtual double iterate ()
 Makes another attempt to find a better vector. Returns the heuristic error. (Usually you will call this method in a loop until your stopping criteria has been met.) More...
 
void setAllStepSizes (double dStepSize)
 Set all the current step sizes to this value. More...
 
void setChangeFactor (double d)
 d should be a value between 0 and 1 More...
 
GVecstepSizes ()
 Returns the vector of step sizes. 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...
 

Static Public Member Functions

static void test ()
 Performs unit testing. Throws an exception if any test fails. More...
 

Protected Member Functions

double iterateOneDim ()
 
void reset ()
 

Protected Attributes

double m_dChangeFactor
 
double m_dError
 
size_t m_nCurrentDim
 
size_t m_nDimensions
 
GVec m_pStepSizes
 
GVec m_pVector
 
- Protected Attributes inherited from GClasses::GOptimizer
GTargetFunctionm_pCritic
 

Constructor & Destructor Documentation

GClasses::GMomentumGreedySearch::GMomentumGreedySearch ( GTargetFunction pCritic)
virtual GClasses::GMomentumGreedySearch::~GMomentumGreedySearch ( )
virtual

Member Function Documentation

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

Returns a pointer to the state vector.

Implements GClasses::GOptimizer.

virtual double GClasses::GMomentumGreedySearch::iterate ( )
virtual

Makes another attempt to find a better vector. Returns the heuristic error. (Usually you will call this method in a loop until your stopping criteria has been met.)

Implements GClasses::GOptimizer.

double GClasses::GMomentumGreedySearch::iterateOneDim ( )
protected
void GClasses::GMomentumGreedySearch::reset ( )
protected
void GClasses::GMomentumGreedySearch::setAllStepSizes ( double  dStepSize)

Set all the current step sizes to this value.

void GClasses::GMomentumGreedySearch::setChangeFactor ( double  d)
inline

d should be a value between 0 and 1

GVec& GClasses::GMomentumGreedySearch::stepSizes ( )

Returns the vector of step sizes.

static void GClasses::GMomentumGreedySearch::test ( )
static

Performs unit testing. Throws an exception if any test fails.

Member Data Documentation

double GClasses::GMomentumGreedySearch::m_dChangeFactor
protected
double GClasses::GMomentumGreedySearch::m_dError
protected
size_t GClasses::GMomentumGreedySearch::m_nCurrentDim
protected
size_t GClasses::GMomentumGreedySearch::m_nDimensions
protected
GVec GClasses::GMomentumGreedySearch::m_pStepSizes
protected
GVec GClasses::GMomentumGreedySearch::m_pVector
protected