OpenWalnut
1.5.0dev
|
This is a class that analyzes the point distribution of point couds using the Principal Component Analysis. More...
#include <WPrincipalComponentAnalysis.h>
Public Member Functions | |
WPrincipalComponentAnalysis () | |
Creates the Principal Component Analysis instance. More... | |
virtual | ~WPrincipalComponentAnalysis () |
Destroys the Principal Component Analysis instance. More... | |
void | analyzeData (const vector< WPosition > &inputData) |
Analyzes a point data set using the Principal Component Analysis algorithm. More... | |
WPosition | getMean () |
Returns the mean coordinate of all input points. More... | |
vector< WVector3d > | getEigenVectors () |
Returns the point distribution directions. More... | |
vector< double > | getEigenValues () |
Returns Eigen Values (equals how much the directions of getDirections() are distributed). More... | |
Private Member Functions | |
void | extractEigenData () |
Does the actual Eigen Value and Vector Analysis. More... | |
void | sortByVarianceDescending () |
Sorts the Point distribution direction by the descending strength. More... | |
void | swapEigenVectors (size_t eigenVectorIndex1, size_t eigenVectorIndex2) |
Replaces two Eigen Vectors and its Variances by each other. More... | |
Private Attributes | |
size_t | m_inputPointCount |
Point count of the input data. More... | |
size_t | m_dimensions |
Dimension count used in the input data. More... | |
WCovarianceSolver | m_covarianceSolver |
Instance to analyze the covariances of the point data between each dimension pair. More... | |
vector< WVector3d > | m_eigenVectors |
Main point distribution directions. More... | |
vector< double > | m_eigenValues |
Lambda values for A*x-Lambda*x=0. More... | |
EigenSolver< MatrixXd > | m_eigenSolver |
Instance for solving Eigen Values and Vectors. More... | |
bool | m_isValidPCA |
Indicator whether calculation is still valid. More... | |
This is a class that analyzes the point distribution of point couds using the Principal Component Analysis.
This class puts out vectors of main point distribution directions and how much they are distributed in that directions.
The algorithms are based mainly on Covariance calculation and Eigen Value and Vector analysis. General about Principal Component Analysis: http://georgemdallas.wordpress.com/2013/10/30/principal-component- analysis-4-dummies-eigenvectors-eigenvalues-and-dimension-reduction/ See principle of algorithm here: http://www.cs.otago.ac.nz/cosc453/student_tutorials/principal_components.pdf
Definition at line 54 of file WPrincipalComponentAnalysis.h.
WPrincipalComponentAnalysis::WPrincipalComponentAnalysis | ( | ) |
Creates the Principal Component Analysis instance.
Definition at line 28 of file WPrincipalComponentAnalysis.cpp.
References m_isValidPCA.
|
virtual |
Destroys the Principal Component Analysis instance.
Definition at line 33 of file WPrincipalComponentAnalysis.cpp.
void WPrincipalComponentAnalysis::analyzeData | ( | const vector< WPosition > & | inputData | ) |
Analyzes a point data set using the Principal Component Analysis algorithm.
inputData | Point data to be analyzed. |
Definition at line 37 of file WPrincipalComponentAnalysis.cpp.
References WCovarianceSolver::analyzeData(), extractEigenData(), WCovarianceSolver::getCovariance(), m_covarianceSolver, m_dimensions, m_eigenSolver, m_inputPointCount, m_isValidPCA, and sortByVarianceDescending().
|
private |
Does the actual Eigen Value and Vector Analysis.
Definition at line 49 of file WPrincipalComponentAnalysis.cpp.
References m_eigenSolver, m_eigenValues, m_eigenVectors, m_isValidPCA, WMatrixFixed< ValueT, Rows, Cols, ValueStoreT >::size(), and sortByVarianceDescending().
Referenced by analyzeData().
vector< double > WPrincipalComponentAnalysis::getEigenValues | ( | ) |
Returns Eigen Values (equals how much the directions of getDirections() are distributed).
Its index corresponds to the indices of that method. The strengths are sorted descending.
Definition at line 103 of file WPrincipalComponentAnalysis.cpp.
References m_eigenValues.
vector< WVector3d > WPrincipalComponentAnalysis::getEigenVectors | ( | ) |
Returns the point distribution directions.
The first one is the strongest and the last is the weakest point distribution direction. Their index corresponds to getVariance().
Definition at line 99 of file WPrincipalComponentAnalysis.cpp.
References m_eigenVectors.
WPosition WPrincipalComponentAnalysis::getMean | ( | ) |
Returns the mean coordinate of all input points.
Definition at line 95 of file WPrincipalComponentAnalysis.cpp.
References WCovarianceSolver::getMean(), and m_covarianceSolver.
|
private |
Sorts the Point distribution direction by the descending strength.
Definition at line 75 of file WPrincipalComponentAnalysis.cpp.
References m_dimensions, m_eigenValues, m_inputPointCount, and swapEigenVectors().
Referenced by analyzeData(), and extractEigenData().
|
private |
Replaces two Eigen Vectors and its Variances by each other.
eigenVectorIndex1 | Index of the first Eigen Value and Vector |
eigenVectorIndex2 | Index of the second Eigen Value and Vector |
Definition at line 83 of file WPrincipalComponentAnalysis.cpp.
References m_eigenValues, and m_eigenVectors.
Referenced by sortByVarianceDescending().
|
private |
Instance to analyze the covariances of the point data between each dimension pair.
Definition at line 118 of file WPrincipalComponentAnalysis.h.
Referenced by analyzeData(), and getMean().
|
private |
Dimension count used in the input data.
Definition at line 113 of file WPrincipalComponentAnalysis.h.
Referenced by analyzeData(), and sortByVarianceDescending().
|
private |
Instance for solving Eigen Values and Vectors.
Definition at line 130 of file WPrincipalComponentAnalysis.h.
Referenced by analyzeData(), and extractEigenData().
|
private |
Lambda values for A*x-Lambda*x=0.
Definition at line 126 of file WPrincipalComponentAnalysis.h.
Referenced by extractEigenData(), getEigenValues(), sortByVarianceDescending(), and swapEigenVectors().
|
private |
Main point distribution directions.
After process they're sorted by their strength descending.
Definition at line 122 of file WPrincipalComponentAnalysis.h.
Referenced by extractEigenData(), getEigenVectors(), and swapEigenVectors().
|
private |
Point count of the input data.
Definition at line 109 of file WPrincipalComponentAnalysis.h.
Referenced by analyzeData(), and sortByVarianceDescending().
|
private |
Indicator whether calculation is still valid.
Definition at line 134 of file WPrincipalComponentAnalysis.h.
Referenced by analyzeData(), extractEigenData(), and WPrincipalComponentAnalysis().