GClasses
GClasses::GManifoldSculpting Class Reference

Detailed Description

Manifold Sculpting. A non-linear dimensionality reduction algorithm. (See Gashler, Michael S. and Ventura, Dan and Martinez, Tony. Iterative non-linear dimensionality reduction with manifold sculpting. In Advances in Neural Information Processing Systems 20, pages 513–520, MIT Press, Cambridge, MA, 2008.)

#include <GManifold.h>

Inheritance diagram for GClasses::GManifoldSculpting:
GClasses::GTransform

Public Member Functions

 GManifoldSculpting (size_t nNeighbors, size_t targetDims, GRand *pRand)
 
virtual ~GManifoldSculpting ()
 
double aveNeighborDist ()
 Returns the average distance between neighbors. More...
 
void beginTransform (const GMatrix *pRealSpaceData)
 Call this before calling SquishPass. pRealSpaceData should be a dataset of all real values. More...
 
void clampPoint (size_t n)
 Partially supervise the specified point. More...
 
size_t countShortcuts (size_t nThreshold)
 Counts the number of times that a point has a neighbor with an index that is >= nThreshold away from this points index. (If the manifold is sampled in order such that points are expected to find neighbors with indexes close to their own, this can serve to identify when parts of the manifold are too close to other parts for so many neighbors to be used.) More...
 
GMatrixdata ()
 
double learningRate ()
 Returns the current learning rate. More...
 
virtual GMatrixreduce (const GMatrix &in)
 Perform NLDR. More...
 
const GRelationrelationAfter ()
 
void setMinAndMaxNeighborDist (double min, double max)
 Neighbors that are closer than min or farther than max will be ignored. The default is [0, 1e20]. It is common to make nNeighbors big and max small so that the hyper-sphere will define the neighborhood. More...
 
void setNeighborFinder (GNeighborFinderGeneralizing *pNF)
 Specifies to use the neighborhoods determined by the specified neighbor-finder instead of the nearest Euclidean-distance neighbors. If this method is called, pNF should have the same number of neighbors and the same dataset as is passed into this class. More...
 
void setPreprocessedData (GMatrix *pData)
 This will takes ownership of pData. (It will modify pData too.) Specifies reduced dimensionality data created by another algorithm, which should be refined using Manifold Sculpting. More...
 
void setSquishingRate (double d)
 Set the rate of squishing. (.99 is a good value) More...
 
double squishPass (size_t nSeedDataPoint)
 Perform one iteration of squishing. Returns a heuristical error value. More...
 
- Public Member Functions inherited from GClasses::GTransform
 GTransform ()
 
 GTransform (const GDomNode *pNode)
 
virtual ~GTransform ()
 

Protected Member Functions

size_t adjustDataPoint (size_t nPoint, double *pError)
 
double averageNeighborDistance (size_t nDims)
 
void calculateMetadata (const GMatrix *pData)
 
double computeError (size_t nPoint)
 
void moveMeanToOrigin ()
 
struct GManifoldSculptingNeighbor * record (size_t n)
 
struct GManifoldSculptingStuff * stuff (size_t n)
 
virtual double supervisedError (size_t nPoint)
 You can overload this to add some intelligent supervision to the heuristic. More...
 
double vectorCorrelation (const double *pdA, const double *pdV, const double *pdB)
 
double vectorCorrelation2 (double squaredScale, size_t a, size_t vertex, struct GManifoldSculptingNeighbor *pNeighborRec)
 
- 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...
 

Protected Attributes

double m_dAveNeighborDist
 
double m_dLearningRate
 
double m_dSquishingRate
 
double m_maxNeighborDist
 
double m_minNeighborDist
 
size_t m_nCurrentDimension
 
size_t m_nDimensions
 
size_t m_nNeighbors
 
size_t m_nPass
 
size_t m_nRecordSize
 
size_t m_nStuffIndex
 
size_t m_nTargetDims
 
GMatrixm_pData
 
unsigned char * m_pMetaData
 
GNeighborFinderGeneralizingm_pNF
 
GRandm_pRand
 
GRelationm_pRelationAfter
 
std::deque< size_t > m_q
 
double m_scale
 

Constructor & Destructor Documentation

GClasses::GManifoldSculpting::GManifoldSculpting ( size_t  nNeighbors,
size_t  targetDims,
GRand pRand 
)
virtual GClasses::GManifoldSculpting::~GManifoldSculpting ( )
virtual

Member Function Documentation

size_t GClasses::GManifoldSculpting::adjustDataPoint ( size_t  nPoint,
double *  pError 
)
protected
double GClasses::GManifoldSculpting::aveNeighborDist ( )
inline

Returns the average distance between neighbors.

double GClasses::GManifoldSculpting::averageNeighborDistance ( size_t  nDims)
protected
void GClasses::GManifoldSculpting::beginTransform ( const GMatrix pRealSpaceData)

Call this before calling SquishPass. pRealSpaceData should be a dataset of all real values.

void GClasses::GManifoldSculpting::calculateMetadata ( const GMatrix pData)
protected
void GClasses::GManifoldSculpting::clampPoint ( size_t  n)

Partially supervise the specified point.

double GClasses::GManifoldSculpting::computeError ( size_t  nPoint)
protected
size_t GClasses::GManifoldSculpting::countShortcuts ( size_t  nThreshold)

Counts the number of times that a point has a neighbor with an index that is >= nThreshold away from this points index. (If the manifold is sampled in order such that points are expected to find neighbors with indexes close to their own, this can serve to identify when parts of the manifold are too close to other parts for so many neighbors to be used.)

GMatrix& GClasses::GManifoldSculpting::data ( )
inline
double GClasses::GManifoldSculpting::learningRate ( )
inline

Returns the current learning rate.

void GClasses::GManifoldSculpting::moveMeanToOrigin ( )
protected
struct GManifoldSculptingNeighbor* GClasses::GManifoldSculpting::record ( size_t  n)
inlineprotected
virtual GMatrix* GClasses::GManifoldSculpting::reduce ( const GMatrix in)
virtual

Perform NLDR.

Implements GClasses::GTransform.

const GRelation& GClasses::GManifoldSculpting::relationAfter ( )
inline
void GClasses::GManifoldSculpting::setMinAndMaxNeighborDist ( double  min,
double  max 
)
inline

Neighbors that are closer than min or farther than max will be ignored. The default is [0, 1e20]. It is common to make nNeighbors big and max small so that the hyper-sphere will define the neighborhood.

void GClasses::GManifoldSculpting::setNeighborFinder ( GNeighborFinderGeneralizing pNF)
inline

Specifies to use the neighborhoods determined by the specified neighbor-finder instead of the nearest Euclidean-distance neighbors. If this method is called, pNF should have the same number of neighbors and the same dataset as is passed into this class.

void GClasses::GManifoldSculpting::setPreprocessedData ( GMatrix pData)

This will takes ownership of pData. (It will modify pData too.) Specifies reduced dimensionality data created by another algorithm, which should be refined using Manifold Sculpting.

void GClasses::GManifoldSculpting::setSquishingRate ( double  d)
inline

Set the rate of squishing. (.99 is a good value)

double GClasses::GManifoldSculpting::squishPass ( size_t  nSeedDataPoint)

Perform one iteration of squishing. Returns a heuristical error value.

struct GManifoldSculptingStuff* GClasses::GManifoldSculpting::stuff ( size_t  n)
inlineprotected
virtual double GClasses::GManifoldSculpting::supervisedError ( size_t  nPoint)
inlineprotectedvirtual

You can overload this to add some intelligent supervision to the heuristic.

double GClasses::GManifoldSculpting::vectorCorrelation ( const double *  pdA,
const double *  pdV,
const double *  pdB 
)
protected
double GClasses::GManifoldSculpting::vectorCorrelation2 ( double  squaredScale,
size_t  a,
size_t  vertex,
struct GManifoldSculptingNeighbor *  pNeighborRec 
)
protected

Member Data Documentation

double GClasses::GManifoldSculpting::m_dAveNeighborDist
protected
double GClasses::GManifoldSculpting::m_dLearningRate
protected
double GClasses::GManifoldSculpting::m_dSquishingRate
protected
double GClasses::GManifoldSculpting::m_maxNeighborDist
protected
double GClasses::GManifoldSculpting::m_minNeighborDist
protected
size_t GClasses::GManifoldSculpting::m_nCurrentDimension
protected
size_t GClasses::GManifoldSculpting::m_nDimensions
protected
size_t GClasses::GManifoldSculpting::m_nNeighbors
protected
size_t GClasses::GManifoldSculpting::m_nPass
protected
size_t GClasses::GManifoldSculpting::m_nRecordSize
protected
size_t GClasses::GManifoldSculpting::m_nStuffIndex
protected
size_t GClasses::GManifoldSculpting::m_nTargetDims
protected
GMatrix* GClasses::GManifoldSculpting::m_pData
protected
unsigned char* GClasses::GManifoldSculpting::m_pMetaData
protected
GNeighborFinderGeneralizing* GClasses::GManifoldSculpting::m_pNF
protected
GRand* GClasses::GManifoldSculpting::m_pRand
protected
GRelation* GClasses::GManifoldSculpting::m_pRelationAfter
protected
std::deque<size_t> GClasses::GManifoldSculpting::m_q
protected
double GClasses::GManifoldSculpting::m_scale
protected