imaging::LinearPca Class Reference
[Statistic Module]

Linear principal component analysis. More...

#include <LinearPca.hpp>

List of all members.

Public Member Functions

 LinearPca (const ublas::matrix< float_t > &data)
 LinearPca (const ublas::matrix< float_t > &data, size_t dimension)
const ublas::vector< float_t > & mean () const
void compute_vector (const ublas::vector< float_t > &coefficients, ublas::vector< float_t > &vector) const
float_t norm (const ublas::vector< float_t > &vector) const
void compute_coefficients (const ublas::vector< float_t > &vector, ublas::vector< float_t > &coefficients) const
void compute_coefficients (const ublas::matrix< float_t > &matrix, ublas::matrix< float_t > &coefficients) const
const ublas::vector< float_t > & standard_deviations () const
size_t dimension () const
size_t data_dimension () const
float_t squared_norm_derivative (const ublas::vector< float_t > &vector, const ublas::vector< float_t > &direction) const


Detailed Description

Linear principal component analysis.

This class computes a (linear) principal component analysis (PCA) of given data. It provides functions to retrieve the standard deviations of the data within the principal components and to compute the PCA coefficients of vectors and vice-versa.

A LinearPCA object is always set to some current data and a current dimension, either by passing the data and the dimension to the constructor or by calling set_data(). All member functions refer to the current data at the current dimension. The default dimension is the data dimension, i.e. the number of columns of the data matrix.


Constructor & Destructor Documentation

imaging::LinearPca::LinearPca ( const ublas::matrix< float_t > &  data  ) 

Constructs a LinearPca and sets the current data to data. The rows of data correspond to sample vectors, its columns to the components of the sample vectors. This function results in a PCA which preserves the dimension of the data, i.e. the PCA coefficients of a vector are of the same dimension as the original vector. The current dimension is set to the data dimension. The PCA is always computed with respect to the mean of the data. You do not have to center yourself.

Keep in mind that this function computes the PCA, which involves the computation of the data covariance matrix and its eigensystem.

imaging::LinearPca::LinearPca ( const ublas::matrix< float_t > &  data,
size_t  dimension 
)

Constructs a LinearPca and sets the current data to data. The rows of data correspond to sample vectors, its columns to the components of the sample vectors. This function results in a PCA which reduces the dimension of the data to dimension, i.e. the PCA coefficients of a vector have less components than the original vector. The current dimension is set to dimension.

Keep in mind that this function computes the PCA, which involves the computation of the data covariance matrix and its eigensystem.


Member Function Documentation

const ublas::vector< float_t > & imaging::LinearPca::mean (  )  const

Returns the mean of the current data.

void imaging::LinearPca::compute_vector ( const ublas::vector< float_t > &  coefficients,
ublas::vector< float_t > &  vector 
) const

Computes a vector from PCA coefficients. The size of coefficients must be the same as the current dimension of the PCA.

float_t imaging::LinearPca::norm ( const ublas::vector< float_t > &  vector  )  const

Computes the 2-norm of the PCA coefficients of vector. This is the same as the Mahalanobis distance between vector and the mean of the current data.

References compute_coefficients().

void imaging::LinearPca::compute_coefficients ( const ublas::vector< float_t > &  vector,
ublas::vector< float_t > &  coefficients 
) const

Computes the PCA coefficients of vector. The size of vector must be the same as the dimension of the current data.

Referenced by norm().

void imaging::LinearPca::compute_coefficients ( const ublas::matrix< float_t > &  matrix,
ublas::matrix< float_t > &  coefficients 
) const

Computes the PCA coefficients of the rows of matrix and stores them in the rows of coefficients. The number of columns of matrix must be the same as the dimension of the current data.

const ublas::vector< float_t > & imaging::LinearPca::standard_deviations (  )  const

Returns a reference to the standard deviations within the principal components of the current data. The standard deviations are sorted from the largest to the smallest value.

size_t imaging::LinearPca::dimension (  )  const

Returns the dimension of the PCA, i.e. the number of principal components. In case the dimension is smaller than the data dimension, the PCA reduces the dimension of the original data.

size_t imaging::LinearPca::data_dimension (  )  const

Returns the dimension of the current data regardless of the actual dimension of the PCA.

float_t imaging::LinearPca::squared_norm_derivative ( const ublas::vector< float_t > &  vector,
const ublas::vector< float_t > &  direction 
) const

Computes the directional derivative into direction of the sum of the squared PCA coefficients of vector. This is the same as the directional derivative into direction of the Mahalanobis distance between vector and the mean of the current data .


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

Generated on Tue Feb 10 10:01:31 2009 for imaging2 by  doxygen 1.5.5