Machine learning algorithms in C++
Public Member Functions | Private Attributes
PCA Class Reference

Principal component analysis. More...

#include <PCA.hpp>

Collaboration diagram for PCA:

Public Member Functions

 PCA (MatrixD data)
 Principal component analysis algorithm. More...
 
void fit ()
 Finds the principal components of a Matrix. More...
 
MatrixD transform ()
 Rotates the data set, using the eigenvectors of the covariance matrix as the new base. More...
 
MatrixD transform (int numComponents)
 Rotates the data set, using the eigenvectors of the covariance matrix with the largest eigenvalues as the new base. More...
 
const MatrixD & getEigenvalues () const
 
const MatrixD & getEigenvectors () const
 
const MatrixD & getPercentages () const
 
const MatrixD & getCumPercentages () const
 

Private Attributes

MatrixD X
 
MatrixD eigenvalues
 
MatrixD eigenvectors
 
MatrixD percentages
 
MatrixD cumPercentages
 

Detailed Description

Principal component analysis.

Definition at line 18 of file PCA.hpp.

Constructor & Destructor Documentation

◆ PCA()

PCA::PCA ( MatrixD  data)
inlineexplicit

Principal component analysis algorithm.

Parameters
datathe matrix whose principal components will be found

Definition at line 28 of file PCA.hpp.

Member Function Documentation

◆ fit()

void PCA::fit ( )
inline

Finds the principal components of a Matrix.

Eigenvectors and eigenvalues are found via the Jacobi eigenvalue algorithm

Definition at line 35 of file PCA.hpp.

◆ getCumPercentages()

const MatrixD& PCA::getCumPercentages ( ) const
inline

Definition at line 91 of file PCA.hpp.

◆ getEigenvalues()

const MatrixD& PCA::getEigenvalues ( ) const
inline

Definition at line 79 of file PCA.hpp.

◆ getEigenvectors()

const MatrixD& PCA::getEigenvectors ( ) const
inline

Definition at line 83 of file PCA.hpp.

◆ getPercentages()

const MatrixD& PCA::getPercentages ( ) const
inline

Definition at line 87 of file PCA.hpp.

◆ transform() [1/2]

MatrixD PCA::transform ( )
inline

Rotates the data set, using the eigenvectors of the covariance matrix as the new base.

Returns
the original dataset rotated using the eigenvectors of the covariance matrix as the new base

Definition at line 60 of file PCA.hpp.

◆ transform() [2/2]

MatrixD PCA::transform ( int  numComponents)
inline

Rotates the data set, using the eigenvectors of the covariance matrix with the largest eigenvalues as the new base.

Returns
the original dataset rotated using the eigenvectors of the covariance matrix with the largest eigenvalues as the new base

Definition at line 68 of file PCA.hpp.

Field Documentation

◆ cumPercentages

MatrixD PCA::cumPercentages
private

Definition at line 21 of file PCA.hpp.

◆ eigenvalues

MatrixD PCA::eigenvalues
private

Definition at line 21 of file PCA.hpp.

◆ eigenvectors

MatrixD PCA::eigenvectors
private

Definition at line 21 of file PCA.hpp.

◆ percentages

MatrixD PCA::percentages
private

Definition at line 21 of file PCA.hpp.

◆ X

MatrixD PCA::X
private

Definition at line 21 of file PCA.hpp.


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