GClasses

GClasses::GPCA Class Reference

Principal Component Analysis. (Computes the principal components about the mean of the data when you call train. The transformed (reduced-dimensional) data will have a mean about the origin.) More...

#include <GTransform.h>

Inheritance diagram for GClasses::GPCA:
GClasses::GTwoWayIncrementalTransform GClasses::GIncrementalTransform GClasses::GTransform

List of all members.

Public Member Functions

 GPCA (size_t targetDims, GRand *pRand)
 GPCA (GDomNode *pNode, GLearnerLoader &ll)
 Load from a DOM.
virtual ~GPCA ()
virtual GDomNodeserialize (GDom *pDoc)
 Marshal this object into a DOM, which can then be converted to a variety of serial formats.
void computeEigVals ()
 Specify to compute the eigenvalues during training. This method must be called before train is called.
void aboutOrigin ()
 Specify to compute the principal components about the origin (instead of computing them about the mean).
double * eigVals ()
 Returns the eigenvalues. Returns NULL if computeEigVals was not called.
size_t targetDims ()
 Returns the number of principal components that it will find.
double * mean ()
 Returns the mean of the data used to train this transform.
double * basis (size_t i)
 Returns the i'th principal component vector.
GMatrixcomponents ()
 Returns a dataset where the first row is the centroid, and the remaining rows are the principal component vectors in order of decreasing eigenvalue.
virtual void train (GMatrix &data)
 See the comment for GIncrementalTransform::train.
virtual void transform (const double *pIn, double *pOut)
 See the comment for GIncrementalTransform::transform. Projects the specified point into fewer dimensions.
virtual void untransform (const double *pIn, double *pOut)
 Computes a (lossy) high-dimensional point that corresponds with the specified low-dimensional coordinates.
virtual void untransformToDistribution (const double *pIn, GPrediction *pOut)
 See the comment for GTwoWayIncrementalTransform::untransformToDistribution.

Protected Attributes

size_t m_targetDims
GMatrixm_pBasisVectors
double * m_pEigVals
bool m_aboutOrigin
GRandm_pRand

Detailed Description

Principal Component Analysis. (Computes the principal components about the mean of the data when you call train. The transformed (reduced-dimensional) data will have a mean about the origin.)


Constructor & Destructor Documentation

GClasses::GPCA::GPCA ( size_t  targetDims,
GRand pRand 
)
GClasses::GPCA::GPCA ( GDomNode pNode,
GLearnerLoader ll 
)

Load from a DOM.

virtual GClasses::GPCA::~GPCA ( ) [virtual]

Member Function Documentation

void GClasses::GPCA::aboutOrigin ( ) [inline]

Specify to compute the principal components about the origin (instead of computing them about the mean).

double* GClasses::GPCA::basis ( size_t  i) [inline]

Returns the i'th principal component vector.

GMatrix* GClasses::GPCA::components ( ) [inline]

Returns a dataset where the first row is the centroid, and the remaining rows are the principal component vectors in order of decreasing eigenvalue.

void GClasses::GPCA::computeEigVals ( )

Specify to compute the eigenvalues during training. This method must be called before train is called.

double* GClasses::GPCA::eigVals ( ) [inline]

Returns the eigenvalues. Returns NULL if computeEigVals was not called.

double* GClasses::GPCA::mean ( ) [inline]

Returns the mean of the data used to train this transform.

virtual GDomNode* GClasses::GPCA::serialize ( GDom pDoc) [virtual]

Marshal this object into a DOM, which can then be converted to a variety of serial formats.

Implements GClasses::GIncrementalTransform.

size_t GClasses::GPCA::targetDims ( ) [inline]

Returns the number of principal components that it will find.

virtual void GClasses::GPCA::train ( GMatrix data) [virtual]
virtual void GClasses::GPCA::transform ( const double *  pIn,
double *  pOut 
) [virtual]

See the comment for GIncrementalTransform::transform. Projects the specified point into fewer dimensions.

Implements GClasses::GIncrementalTransform.

virtual void GClasses::GPCA::untransform ( const double *  pIn,
double *  pOut 
) [virtual]

Computes a (lossy) high-dimensional point that corresponds with the specified low-dimensional coordinates.

Implements GClasses::GTwoWayIncrementalTransform.

virtual void GClasses::GPCA::untransformToDistribution ( const double *  pIn,
GPrediction pOut 
) [virtual]

Member Data Documentation

double* GClasses::GPCA::m_pEigVals [protected]
size_t GClasses::GPCA::m_targetDims [protected]