GClasses
GClasses::GNeuroPCA Class Reference

This class is a generalization of PCA. When the bias is clamped, and the activation function is "identity", it is strictly equivalent to PCA. By default, however, the bias is allowed to drift from the mean, which gives better results. Also, by default, the activation function is "logistic", which enables it to find non-linear components in the data. (GUnsupervisedBackProp is a multi-layer generalization of this algorithm.) More...

#include <GManifold.h>

Inheritance diagram for GClasses::GNeuroPCA:
GClasses::GTransform

Public Member Functions

 GNeuroPCA (size_t targetDims, GRand *pRand)
 
virtual ~GNeuroPCA ()
 
void clampBias ()
 Specify to not update the bias values. More...
 
void computeEigVals ()
 Specify to compute the eigenvalues during training. This method must be called before reduce is called. More...
 
double * eigVals ()
 Returns the eigenvalues. Returns NULL if computeEigVals was not called. More...
 
virtual GMatrixreduce (const GMatrix &in)
 See the comment for GTransform::reduce. More...
 
void setActivation (GActivationFunction *pActivation)
 Sets the activation function. (Takes ownership of pActivation.) More...
 
size_t targetDims ()
 Returns the number of principal components to find. More...
 
GMatrixweights ()
 Returns the weight vectors. More...
 
- Public Member Functions inherited from GClasses::GTransform
 GTransform ()
 
 GTransform (GDomNode *pNode, GLearnerLoader &ll)
 
virtual ~GTransform ()
 

Protected Member Functions

void computeComponent (const GMatrix *pIn, GMatrix *pOut, size_t col, GMatrix *pPreprocess)
 
double computeSumSquaredErr (const GMatrix *pIn, GMatrix *pOut, size_t cols)
 
- 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

GActivationFunctionm_pActivation
 
double * m_pEigVals
 
GRandm_pRand
 
GMatrixm_pWeights
 
size_t m_targetDims
 
bool m_updateBias
 

Detailed Description

This class is a generalization of PCA. When the bias is clamped, and the activation function is "identity", it is strictly equivalent to PCA. By default, however, the bias is allowed to drift from the mean, which gives better results. Also, by default, the activation function is "logistic", which enables it to find non-linear components in the data. (GUnsupervisedBackProp is a multi-layer generalization of this algorithm.)

Constructor & Destructor Documentation

GClasses::GNeuroPCA::GNeuroPCA ( size_t  targetDims,
GRand pRand 
)
virtual GClasses::GNeuroPCA::~GNeuroPCA ( )
virtual

Member Function Documentation

void GClasses::GNeuroPCA::clampBias ( )
inline

Specify to not update the bias values.

void GClasses::GNeuroPCA::computeComponent ( const GMatrix pIn,
GMatrix pOut,
size_t  col,
GMatrix pPreprocess 
)
protected
void GClasses::GNeuroPCA::computeEigVals ( )

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

double GClasses::GNeuroPCA::computeSumSquaredErr ( const GMatrix pIn,
GMatrix pOut,
size_t  cols 
)
protected
double* GClasses::GNeuroPCA::eigVals ( )
inline

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

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

See the comment for GTransform::reduce.

Implements GClasses::GTransform.

void GClasses::GNeuroPCA::setActivation ( GActivationFunction pActivation)

Sets the activation function. (Takes ownership of pActivation.)

size_t GClasses::GNeuroPCA::targetDims ( )
inline

Returns the number of principal components to find.

GMatrix* GClasses::GNeuroPCA::weights ( )
inline

Returns the weight vectors.

Member Data Documentation

GActivationFunction* GClasses::GNeuroPCA::m_pActivation
protected
double* GClasses::GNeuroPCA::m_pEigVals
protected
GRand* GClasses::GNeuroPCA::m_pRand
protected
GMatrix* GClasses::GNeuroPCA::m_pWeights
protected
size_t GClasses::GNeuroPCA::m_targetDims
protected
bool GClasses::GNeuroPCA::m_updateBias
protected