GClasses
GClasses::MyRecurrentModel Class Reference

#include <GLearnerLib.h>

Inheritance diagram for GClasses::MyRecurrentModel:
GClasses::GRecurrentModel GClasses::GSystemLearner

Public Member Functions

 MyRecurrentModel (GSupervisedLearner *pTransition, GSupervisedLearner *pObservation, size_t actionDims, size_t contextDims, size_t obsDims, GRand *pRand, std::vector< size_t > *pParamDims, const char *stateFilename, double validateInterval)
 
virtual ~MyRecurrentModel ()
 
virtual void onFinishedComputingStateEstimate (GMatrix *pStateEstimate)
 This method is called when trainMoses finishes computing the state estimate. By default, it does nothing, but you can overload it if you wish to do something with it. More...
 
virtual void onObtainValidationScore (int timeSlice, double seconds, double squaredError)
 
- Public Member Functions inherited from GClasses::GRecurrentModel
 GRecurrentModel (GSupervisedLearner *pTransition, GSupervisedLearner *pObservation, size_t actionDims, size_t contextDims, size_t obsDims, GRand *pRand, std::vector< size_t > *pParamDims=NULL)
 Takes ownership of pTransition and pObservation. More...
 
 GRecurrentModel (GDomNode *pNode, GRand *pRand)
 Load from a DOM. More...
 
virtual ~GRecurrentModel ()
 
virtual void calibrate (const double *pObs)
 See the comment for GSystemLearner::calibrate. More...
 
double * context ()
 Returns a pointer to the context vector. More...
 
size_t contextDims ()
 Returns the number of dimensions in the context (state) vector. More...
 
virtual void doAction (const double *pAction)
 See the comment for GSystemLearner::doAction. More...
 
GImageframes (GMatrix *pDataAction, GMatrix *pDataObs, bool calibrateContext, unsigned int frameWidth, int stepsPerImage, double scalePredictions)
 Generates a film-strip-like sequence of frames that compare the expected observations (left) with predicted observations (right). If the predictions are not in the form of images, or they are not parameterized with two variables, then this method will throw. More...
 
size_t obsDims ()
 Returns the number of obs dims. More...
 
GSupervisedLearnerobservationFunc ()
 Returns the observation function. More...
 
virtual void onObtainValidationScore (size_t timeSlice, double seconds, double squaredError)
 If validateDuringTraining was called, then this method is called whenever validation data is obtained. More...
 
size_t paramDims ()
 Trains with the back-prop-through-time algorithm. Returns the final sequence length. More...
 
size_t * paramRanges ()
 
double * params ()
 
virtual void predict (double *pObs)
 See the comment for GSystemLearner::predict. More...
 
void predictPixel (const double *pParams, double *pObs)
 
double quickValidate (GMatrix *pDataAction, GMatrix *pDataObs, size_t pixelSamples, double *paramArray, bool monotonic)
 Quickly compute an error estimate for use as an optimization heurisitic. More...
 
virtual GDomNodeserialize (GDom *pDoc) const
 See the comment for GSystemLearner::serialize. More...
 
void setTrainingSeconds (double d)
 Set the number of seconds to train. More...
 
void setUseIsomap (bool b)
 Specify whether to use Isomap (instead of BreadthFirstUnfolding). (This only applies when trainMoses is called.) More...
 
void trainEvolutionary (GMatrix *pActions, GMatrix *pObservations)
 Trains with an evolutionary optimizer. More...
 
void trainHillClimber (GMatrix *pActions, GMatrix *pObservations, double dev, double decay, double seconds, bool climb, bool anneal)
 Trains with a hill climber. More...
 
void trainMoses (GMatrix *pActions, GMatrix *pObservations)
 Trains with the MOSES algorithm. (Calls onFinishedComputingStateEstimate when the state estimate is computed.) More...
 
GSupervisedLearnertransitionFunc ()
 Returns the transition function. More...
 
double validate (std::vector< GMatrix * > &validationData, bool calibrateContext, bool monotonic, double multiplier)
 Computes the mean squared error with respect to some test sequence of actions and observations. More...
 
void validateDuringTraining (double timeInterval, std::vector< GMatrix * > *pValidationData)
 Perform validation at periodic intervals with the specified data during training. Results are passed to the onObtainValidationScore method. pValidationData should refer to some number of validation data pairs, where each validation data pair is an observation dataset followed by an action dataset. More...
 
- Public Member Functions inherited from GClasses::GSystemLearner
 GSystemLearner ()
 
 GSystemLearner (GDomNode *pNode)
 
virtual ~GSystemLearner ()
 

Protected Attributes

double m_dStart
 
const char * m_stateFilename
 
double m_validateInterval
 
- Protected Attributes inherited from GClasses::GRecurrentModel
size_t m_actionDims
 
size_t m_channels
 
size_t m_contextDims
 
double m_multiplier
 
size_t m_obsDims
 
size_t m_paramDims
 
double * m_pBuf
 
double * m_pContext
 
size_t m_pixels
 
GSupervisedLearnerm_pObservationFunc
 
size_t * m_pParamRanges
 
double * m_pParams
 
GRandm_pRand
 
GSupervisedLearnerm_pTransitionFunc
 
std::vector< GMatrix * > * m_pValidationData
 
double m_trainingSeconds
 
bool m_transitionDelta
 
bool m_useIsomap
 
double m_validationInterval
 

Additional Inherited Members

- Static Public Member Functions inherited from GClasses::GRecurrentModel
static void blurImageVector (const double *pIn, double *pOut, int wid, int hgt, int chan, double valueRange, int radius, int iters)
 Blur the image vector. More...
 
- Protected Member Functions inherited from GClasses::GRecurrentModel
GMatrixjoshuaEstimateState (GMatrix *pActions, GMatrix *pObservations)
 
GMatrixmosesEstimateState (GMatrix *pActions, GMatrix *pObservations)
 
void prepareForOptimization (GMatrix *pActions, GMatrix *pObservations)
 
void trainObservationFunction (GMatrix *pEstState, GMatrix *pObservations)
 
void trainObservationFunctionIteratively (double dStart, GMatrix *pEstState, GMatrix *pObservations)
 
void trainTransitionFunction (GMatrix *pActions, GMatrix *pEstState)
 
- Protected Member Functions inherited from GClasses::GSystemLearner
GDomNodebaseDomNode (GDom *pDoc, const char *szClassName) const
 Child classes should use this in their implementation of serialize. More...
 

Constructor & Destructor Documentation

GClasses::MyRecurrentModel::MyRecurrentModel ( GSupervisedLearner pTransition,
GSupervisedLearner pObservation,
size_t  actionDims,
size_t  contextDims,
size_t  obsDims,
GRand pRand,
std::vector< size_t > *  pParamDims,
const char *  stateFilename,
double  validateInterval 
)
inline
virtual GClasses::MyRecurrentModel::~MyRecurrentModel ( )
inlinevirtual

Member Function Documentation

virtual void GClasses::MyRecurrentModel::onFinishedComputingStateEstimate ( GMatrix pStateEstimate)
inlinevirtual

This method is called when trainMoses finishes computing the state estimate. By default, it does nothing, but you can overload it if you wish to do something with it.

Reimplemented from GClasses::GRecurrentModel.

virtual void GClasses::MyRecurrentModel::onObtainValidationScore ( int  timeSlice,
double  seconds,
double  squaredError 
)
inlinevirtual

Member Data Documentation

double GClasses::MyRecurrentModel::m_dStart
protected
const char* GClasses::MyRecurrentModel::m_stateFilename
protected
double GClasses::MyRecurrentModel::m_validateInterval
protected