LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::kernelPCA Class Reference

Functor for computing a kernel principal component analysis. More...

#include <ltiKPCA.h>

Inheritance diagram for lti::kernelPCA:
Inheritance graph
[legend]
Collaboration diagram for lti::kernelPCA:
Collaboration graph
[legend]

List of all members.

Classes

class  parameters
 the parameters for the class principalComponents More...

Public Member Functions

 kernelPCA ()
 kernelPCA (const kernelPCA &other)
virtual ~kernelPCA ()
virtual const char * getTypeName () const
virtual bool apply (const dmatrix &data, dmatrix &result)
virtual bool apply (dmatrix &srcdest)
bool apply (const dvector &src, dvector &result)
virtual bool transform (const dvector &src, dvector &result) const
virtual bool transform (const dmatrix &src, dmatrix &result) const
virtual bool transform (dmatrix &srcdest) const
virtual bool computeTransformMatrix (const dmatrix &src)
virtual bool train (const dmatrix &src)
virtual bool getEigenValues (dvector &result) const
virtual const dvectorgetEigenValues () const
virtual bool getEigenVectors (dmatrix &result) const
virtual const dmatrixgetEigenVectors () const
virtual void setDimension (int k)
kernelPCAcopy (const kernelPCA &other)
virtual functorclone () const
const parametersgetParameters () const
virtual bool updateParameters ()
virtual bool read (ioHandler &handler, const bool complete=true)
virtual bool write (ioHandler &handler, const bool complete=true) const
int getUsedDimension () const

Protected Member Functions

int checkDim ()
bool computeKernelMatrix (const dmatrix &src, dmatrix &kmat)
bool computeTestKernelMatrix (const dmatrix &src, dmatrix &kmat) const
bool computeTestKernelVector (const dvector &src, dvector &kvct) const

Detailed Description

Functor for computing a kernel principal component analysis.

It receives a set of input vectors in form of a matrix (each row of the matrix corresponds to an input vector), which will be transformed with KPCA.

The first time you use the apply()-method, the transformation matrix will be computed. You can use this transformation matrix with other data sets using the transform() methods.

Please note that the eigenvector matrices will contain the eigenvector in the COLUMNS and not in the rows, as could be expected. This avoids the requirement of transposing matrices in the vector transformations (see also lti::eigenSystem<T>).

The Kernel PCA is described in Schoelkopf, B., Smola, A. and Mueller, K. "Nonlinear Component Analysis as a Kernel Eigenvalue Problem", Neural Computation, vol. 10, no. 5, pp. 1299-1319


Constructor & Destructor Documentation

lti::kernelPCA::kernelPCA (  ) 

default constructor

lti::kernelPCA::kernelPCA ( const kernelPCA other  ) 

copy constructor

Parameters:
other the object to be copied
virtual lti::kernelPCA::~kernelPCA (  )  [virtual]

destructor


Member Function Documentation

bool lti::kernelPCA::apply ( const dvector src,
dvector result 
) [inline]

Transforms a single vector according to a previously computed transformation matrix.

(this is an alias for the transform() method)

References transform().

virtual bool lti::kernelPCA::apply ( dmatrix srcdest  )  [virtual]

On-Place version of the transformation.

If you don't need to transform the input data, and just want to use the input matrix to compute the principal components you can use the method computeTransformMatrix(). If you just need to transform the data, without computing the transformation matrix, you can use the method transform().

Parameters:
srcdest dmatrix with the source data, which will also contain the result.
Returns:
a reference to srcdest.
virtual bool lti::kernelPCA::apply ( const dmatrix data,
dmatrix result 
) [virtual]

Computes the principal components of the data matrix and transforms it according to the new coordinate system.

The result is the transformed matrix. data and result must not be references to the same matrix. This method uses the eigenvector functor given in the parameters. By default, it uses ltilib's own jacobi functor. However, you can speed it up considerably by using the eigensystem functor in the lamath directory.

If you don't need to transform the input data, and just want to use the input matrix to compute the principal components you can use the method computeTransformMatrix(). If you just need to transform the data, without computing the transformation matrix, you can use the method transform().

Parameters:
data dmatrix with the source data.
result dmatrix with the result data.
Returns:
true if the KPCA could be computed, false otherwise
int lti::kernelPCA::checkDim (  )  [protected]

Determines the intrinsic dimensionality of the data set if the user specify autoDim, otherwise return parameters::resultDim.

The member usedDimensionality will be set with the returned value

virtual functor* lti::kernelPCA::clone (  )  const [virtual]

returns a pointer to a clone of this functor.

Implements lti::functor.

bool lti::kernelPCA::computeKernelMatrix ( const dmatrix src,
dmatrix kmat 
) [protected]

compute kernel matrix.

The data will be centered.

bool lti::kernelPCA::computeTestKernelMatrix ( const dmatrix src,
dmatrix kmat 
) const [protected]

compute test kernel matrix.

The data will be centered. It will be assumed that the source data (srcData) contains the right data

bool lti::kernelPCA::computeTestKernelVector ( const dvector src,
dvector kvct 
) const [protected]

compute test kernel vector.

The data will be centered. It will be assumed that the source data (srcData) contains the right data

virtual bool lti::kernelPCA::computeTransformMatrix ( const dmatrix src  )  [virtual]

Compute the transformation matrix.

Similar to the apply() method, but it does not transform the given data (this saves some time).

Parameters:
src the matrix with the input data to be analysed.
Returns:
true if transformation matrix could be computed, false otherwise
kernelPCA& lti::kernelPCA::copy ( const kernelPCA other  ) 

copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::functor.

virtual const dvector& lti::kernelPCA::getEigenValues (  )  const [virtual]

Returns the previously computed eigenvalues of the covariance matrix.

Returns:
a const reference to the last computed eigenvalues
virtual bool lti::kernelPCA::getEigenValues ( dvector result  )  const [virtual]

Returns the previously computed eigenvalues of the covariance matrix.

Parameters:
result the vector which will receive the eigenvalues.
Returns:
true if the values could be obtained, false otherwise.
virtual const dmatrix& lti::kernelPCA::getEigenVectors (  )  const [virtual]

Returns the previously computed eigenvectors of the covariance matrix.

Returns:
a const reference to the last computed eigenvectors. Each row of the matrix contains one eigenvector.
virtual bool lti::kernelPCA::getEigenVectors ( dmatrix result  )  const [virtual]

Returns the previously computed eigenvectors of the covariance matrix.

Each ROW (as opposite to PCA) will contain the eigenvectors.

Parameters:
result the matrix which will receive the eigenvectors. Each row of the matrix contains one eigenvector.
Returns:
true if the vectors could be obtained, false otherwise
const parameters& lti::kernelPCA::getParameters (  )  const

returns used parameters

Reimplemented from lti::functor.

virtual const char* lti::kernelPCA::getTypeName (  )  const [virtual]

returns the name of this type ("kernelPCA")

Reimplemented from lti::linearAlgebraFunctor.

int lti::kernelPCA::getUsedDimension (  )  const [inline]

Number of dimensions considered in the transformation.

Returns:
the number of dimensions used for the transformation. It is always less or equal the number of dimensions of the input vectors.
virtual bool lti::kernelPCA::read ( ioHandler handler,
const bool  complete = true 
) [virtual]

Reads this functor from the given handler.

Reimplemented from lti::functor.

virtual void lti::kernelPCA::setDimension ( int  k  )  [virtual]

Set the dimension to which the vectors should be reduced.

virtual bool lti::kernelPCA::train ( const dmatrix src  )  [virtual]
virtual bool lti::kernelPCA::transform ( dmatrix srcdest  )  const [virtual]

Transform an entire matrix according to a previously computed transformation matrix.

Unfortunately, we must choose a name different from apply.

Parameters:
srcdest the data matrix. The result will be left here too.
Returns:
true if successful, false otherwise.
virtual bool lti::kernelPCA::transform ( const dmatrix src,
dmatrix result 
) const [virtual]

Transform an entire matrix according to a previously computed transformation matrix.

Unfortunately, we must choose a name different from apply.

Parameters:
src the data matrix
result the matrix which will receive the transformed data
Returns:
true if successful, false otherwise.
virtual bool lti::kernelPCA::transform ( const dvector src,
dvector result 
) const [virtual]

Transforms a single vector according to a previously computed transformation matrix.

Parameters:
src the data vector
result the vector which will receive the transformed data
Returns:
a reference to result

Referenced by apply().

virtual bool lti::kernelPCA::updateParameters (  )  [virtual]

set functor's parameters.

This member makes a copy of theParam: the functor will keep its own copy of the parameters!

Returns:
true if successful, false otherwise

Reimplemented from lti::functor.

virtual bool lti::kernelPCA::write ( ioHandler handler,
const bool  complete = true 
) const [virtual]

Writes this functor to the given handler.

Reimplemented from lti::functor.


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:28:26 2010 for LTI-Lib by Doxygen 1.6.1