GClasses
GClasses::GTemporalNeighborFinder Class Reference

A neighbor finder that specializes in dynamical systems. It determines neighbors by searching for the shortest path of actions between observations, and computes the distance as the number of time-steps in that path. This algorithm was published in Gashler, Michael S. and Martinez, Tony. Temporal nonlinear dimensionality reduction. In Proceedings of the International Joint Conference on Neural Networks IJCNN’11, pages 1959–1966, IEEE Press, 2011. More...

#include <GNeighborFinder.h>

Inheritance diagram for GClasses::GTemporalNeighborFinder:
GClasses::GNeighborFinder

Public Member Functions

 GTemporalNeighborFinder (GMatrix *pObservations, GMatrix *pActions, bool ownActionsData, size_t neighborCount, GRand *pRand, size_t maxDims=12)
 pObservations is typically a matrix of high-dimensional observations. pActions is a matrix of corresponding actions (peformed after the corresponding observation was observed). If ownActionsData is true, then this object will delete pActions when it is deleted. This neighbor-finder is somewhat slow in high-dimensional space. Consequently, if the data has more than maxDims dimensions, it will internally use PCA to reduce it to maxDims dimensions before computing neighbors. The default is 12. More...
 
virtual ~GTemporalNeighborFinder ()
 
virtual void neighbors (size_t *pOutNeighbors, size_t index)
 Computes the neighbors of the specified vector. More...
 
virtual void neighbors (size_t *pOutNeighbors, double *pOutDistances, size_t index)
 Computes the neighbors and distances of the specified vector. More...
 
- Public Member Functions inherited from GClasses::GNeighborFinder
 GNeighborFinder (const GMatrix *pData, size_t neighborCount)
 
virtual ~GNeighborFinder ()
 
virtual bool canGeneralize ()
 Returns true if this neighbor finder can operate on points that are not in the dataset passed to the constructor. More...
 
const GMatrixdata ()
 Returns the data passed to the constructor of this object. More...
 
virtual bool isCached ()
 Returns true iff the neighbors and distances are pre-computed. More...
 
size_t neighborCount ()
 Returns the number of neighbors to find. More...
 
void sortNeighbors (size_t *pNeighbors, double *pDistances)
 Uses Quick Sort to sort the neighbors from least to most dissimilar, followed by any slots for with INVALID_INDEX for the index. (Note: This method is pointless, since the neighors are already guaranteed to come in sorted order. Todo: figure out why it is still here) More...
 

Protected Member Functions

bool findPath (size_t from, size_t to, double *path, double distCap)
 Returns false if distCap is exceeded, or if the results are too imprecise to be reliable. Otherwise, returns true, and path is set to contain the number of times that each action must be performed to travel from point "from" to point "to". More...
 
GMatrixpreprocessObservations (GMatrix *pObs, size_t maxDims)
 This method uses PCA to reduce pObs to maxDims dimensions. (If pObs is already small enough, it just returns pObs.) More...
 

Protected Attributes

std::vector< GSupervisedLearner * > m_consequenceMaps
 
size_t m_maxDims
 
bool m_ownActionsData
 
GMatrixm_pActions
 
GMatrixm_pPreprocessed
 
GRandm_pRand
 
- Protected Attributes inherited from GClasses::GNeighborFinder
size_t m_neighborCount
 
const GMatrixm_pData
 

Additional Inherited Members

- Static Public Member Functions inherited from GClasses::GNeighborFinder
static void sortNeighbors (size_t neighborCount, size_t *pNeighbors, double *pDistances)
 Uses Quick Sort to sort the neighbors from least to most dissimilar, followed by any slots for with INVALID_INDEX for the index. (Note: This method is pointless, since the neighors are already guaranteed to come in sorted order. Todo: figure out why it is still here) More...
 

Detailed Description

A neighbor finder that specializes in dynamical systems. It determines neighbors by searching for the shortest path of actions between observations, and computes the distance as the number of time-steps in that path. This algorithm was published in Gashler, Michael S. and Martinez, Tony. Temporal nonlinear dimensionality reduction. In Proceedings of the International Joint Conference on Neural Networks IJCNN’11, pages 1959–1966, IEEE Press, 2011.

Constructor & Destructor Documentation

GClasses::GTemporalNeighborFinder::GTemporalNeighborFinder ( GMatrix pObservations,
GMatrix pActions,
bool  ownActionsData,
size_t  neighborCount,
GRand pRand,
size_t  maxDims = 12 
)

pObservations is typically a matrix of high-dimensional observations. pActions is a matrix of corresponding actions (peformed after the corresponding observation was observed). If ownActionsData is true, then this object will delete pActions when it is deleted. This neighbor-finder is somewhat slow in high-dimensional space. Consequently, if the data has more than maxDims dimensions, it will internally use PCA to reduce it to maxDims dimensions before computing neighbors. The default is 12.

virtual GClasses::GTemporalNeighborFinder::~GTemporalNeighborFinder ( )
virtual

Member Function Documentation

bool GClasses::GTemporalNeighborFinder::findPath ( size_t  from,
size_t  to,
double *  path,
double  distCap 
)
protected

Returns false if distCap is exceeded, or if the results are too imprecise to be reliable. Otherwise, returns true, and path is set to contain the number of times that each action must be performed to travel from point "from" to point "to".

virtual void GClasses::GTemporalNeighborFinder::neighbors ( size_t *  pOutNeighbors,
size_t  index 
)
virtual

Computes the neighbors of the specified vector.

Implements GClasses::GNeighborFinder.

virtual void GClasses::GTemporalNeighborFinder::neighbors ( size_t *  pOutNeighbors,
double *  pOutDistances,
size_t  index 
)
virtual

Computes the neighbors and distances of the specified vector.

Implements GClasses::GNeighborFinder.

GMatrix* GClasses::GTemporalNeighborFinder::preprocessObservations ( GMatrix pObs,
size_t  maxDims 
)
protected

This method uses PCA to reduce pObs to maxDims dimensions. (If pObs is already small enough, it just returns pObs.)

Member Data Documentation

std::vector<GSupervisedLearner*> GClasses::GTemporalNeighborFinder::m_consequenceMaps
protected
size_t GClasses::GTemporalNeighborFinder::m_maxDims
protected
bool GClasses::GTemporalNeighborFinder::m_ownActionsData
protected
GMatrix* GClasses::GTemporalNeighborFinder::m_pActions
protected
GMatrix* GClasses::GTemporalNeighborFinder::m_pPreprocessed
protected
GRand* GClasses::GTemporalNeighborFinder::m_pRand
protected