GClasses
GClasses::GScalingUnfolder Class Reference

Detailed Description

This is a nonlinear dimensionality reduction algorithm loosely inspired by Maximum Variance Unfolding. It iteratively scales up the data, then restores distances between neighbors.

#include <GManifold.h>

Inheritance diagram for GClasses::GScalingUnfolder:
GClasses::GTransform

Public Member Functions

 GScalingUnfolder ()
 
 GScalingUnfolder (GDomNode *pNode)
 
virtual ~GScalingUnfolder ()
 
GRandrand ()
 Returns a reference to the pseudo-random number generator used by this object. More...
 
virtual GMatrixreduce (const GMatrix &in)
 Reduces the dimensionality of "in". More...
 
void setNeighborCount (size_t n)
 Specify the number of neighbors to use. (The default is 14.) More...
 
void setPasses (size_t n)
 Specify the number of times to 'scale the data then recover local relationships'. More...
 
void setRefinesPerScale (size_t n)
 Specify the number of times to refine the points after each scaling. More...
 
void setScaleRate (double d)
 Specify the scaling rate. The default is 0.9. More...
 
void setTargetDims (size_t n)
 Specify the number of dimensions in the output results. More...
 
void unfold (GMatrix &intrinsic, GNeighborGraph &nf, size_t encoderTrainIters=0, GNeuralNetLearner *pEncoder=NULL, GNeuralNetLearner *pDecoder=NULL, const GMatrix *pVisible=NULL)
 Unfolds the points in intrinsic, such that distances specified in nf are preserved. If pVisible is non-NULL, then pEncoder will be incrementally trained to encode pVisible to intrinsic. More...
 
- Public Member Functions inherited from GClasses::GTransform
 GTransform ()
 
 GTransform (const GDomNode *pNode)
 
virtual ~GTransform ()
 

Static Public Member Functions

static void restore_local_distances_pass (GMatrix &intrinsic, GNeighborGraph &ng, size_t neighborCount, GRand &rand)
 Perform a single pass over all the edges and attempt to restore local relationships. More...
 
static size_t unfold_iter (GMatrix &intrinsic, GRand &rand, size_t neighborCount=12, double scaleFactor=1.01, size_t refinements=100)
 A convenience method for iteratively unfolding the manifold sampled by a matrix. (This method is not used within this class.) It finds the k-nearest neighbors within the matrix. (If the neighbor-graph is not connected, it doubles k until it is connected.) Next, this method multiplies the matrix by scaleFactor. Finally, it refines the points to restore local distances. (It would not typically be efficient to call this in a tight loop, because that would perform the neighbor-finding step each time.) Returns the number of neighbors actually used to find a connected graph. More...
 

Protected Attributes

size_t m_neighborCount
 
size_t m_passes
 
GRand m_rand
 
size_t m_refines_per_scale
 
double m_scaleRate
 
size_t m_targetDims
 

Additional Inherited Members

- Protected Member Functions inherited from GClasses::GTransform
virtual GDomNodebaseDomNode (GDom *pDoc, const char *szClassName) const
 Child classes should use this in their implementation of serialize. More...
 

Constructor & Destructor Documentation

GClasses::GScalingUnfolder::GScalingUnfolder ( )
GClasses::GScalingUnfolder::GScalingUnfolder ( GDomNode pNode)
virtual GClasses::GScalingUnfolder::~GScalingUnfolder ( )
virtual

Member Function Documentation

GRand& GClasses::GScalingUnfolder::rand ( )
inline

Returns a reference to the pseudo-random number generator used by this object.

virtual GMatrix* GClasses::GScalingUnfolder::reduce ( const GMatrix in)
virtual

Reduces the dimensionality of "in".

Implements GClasses::GTransform.

static void GClasses::GScalingUnfolder::restore_local_distances_pass ( GMatrix intrinsic,
GNeighborGraph ng,
size_t  neighborCount,
GRand rand 
)
static

Perform a single pass over all the edges and attempt to restore local relationships.

void GClasses::GScalingUnfolder::setNeighborCount ( size_t  n)
inline

Specify the number of neighbors to use. (The default is 14.)

void GClasses::GScalingUnfolder::setPasses ( size_t  n)
inline

Specify the number of times to 'scale the data then recover local relationships'.

void GClasses::GScalingUnfolder::setRefinesPerScale ( size_t  n)
inline

Specify the number of times to refine the points after each scaling.

void GClasses::GScalingUnfolder::setScaleRate ( double  d)
inline

Specify the scaling rate. The default is 0.9.

void GClasses::GScalingUnfolder::setTargetDims ( size_t  n)
inline

Specify the number of dimensions in the output results.

void GClasses::GScalingUnfolder::unfold ( GMatrix intrinsic,
GNeighborGraph nf,
size_t  encoderTrainIters = 0,
GNeuralNetLearner pEncoder = NULL,
GNeuralNetLearner pDecoder = NULL,
const GMatrix pVisible = NULL 
)

Unfolds the points in intrinsic, such that distances specified in nf are preserved. If pVisible is non-NULL, then pEncoder will be incrementally trained to encode pVisible to intrinsic.

static size_t GClasses::GScalingUnfolder::unfold_iter ( GMatrix intrinsic,
GRand rand,
size_t  neighborCount = 12,
double  scaleFactor = 1.01,
size_t  refinements = 100 
)
static

A convenience method for iteratively unfolding the manifold sampled by a matrix. (This method is not used within this class.) It finds the k-nearest neighbors within the matrix. (If the neighbor-graph is not connected, it doubles k until it is connected.) Next, this method multiplies the matrix by scaleFactor. Finally, it refines the points to restore local distances. (It would not typically be efficient to call this in a tight loop, because that would perform the neighbor-finding step each time.) Returns the number of neighbors actually used to find a connected graph.

Member Data Documentation

size_t GClasses::GScalingUnfolder::m_neighborCount
protected
size_t GClasses::GScalingUnfolder::m_passes
protected
GRand GClasses::GScalingUnfolder::m_rand
protected
size_t GClasses::GScalingUnfolder::m_refines_per_scale
protected
double GClasses::GScalingUnfolder::m_scaleRate
protected
size_t GClasses::GScalingUnfolder::m_targetDims
protected