Xmipp
v3.23.11-Nereus
|
#include <basic_pca.h>
Public Member Functions | |
void | clear () |
Clear. More... | |
void | reserve (int newSize) |
Resize. More... | |
void | addVector (const MultidimArray< float > &_v) |
Add vector. More... | |
void | computeStatistics (MultidimArray< double > &avg, MultidimArray< double > &stddev) |
Compute Statistics. More... | |
void | subtractAvg () |
Subtract average. More... | |
void | gramSchmidt () |
void | standardarizeVariables () |
Standardarize variables. More... | |
void | learnPCABasis (size_t NPCA, size_t Niter) |
Learn basis. More... | |
void | projectOnPCABasis (Matrix2D< double > &CtY) |
Project on basis. More... | |
void | reconsFromPCA (const Matrix2D< double > &CtY, std::vector< MultidimArray< float > > &recons) |
Reconstruct from PCA basis. More... | |
void | evaluateZScore (int NPCA, int Niter, bool trained=false, const char *filename="temp.txt", int numdesc=0) |
double | getZscore (int n) |
double | getSortedZscore (int n) |
int | getSorted (int n) |
Public Attributes | |
std::vector< MultidimArray< float > > | v |
std::vector< MultidimArray< double > > | PCAbasis |
MultidimArray< double > | avg |
MultidimArray< double > | Zscore |
MultidimArray< int > | idx |
Matrix1D< double > | w |
Basic PCA class. The difference with PCAAnalyzer is that this one uses a different base class for the input vectors and the algorithm used to compute the PCA decomposition (see Roweis, "EM algorithms for PCA and SPCA", Neural Information Processing Systems 10 (NIPS'97) pp.626-632)
Example of use:
Another example:
Definition at line 62 of file basic_pca.h.
|
inline |
|
inline |
Clear.
Definition at line 84 of file basic_pca.h.
void PCAMahalanobisAnalyzer::computeStatistics | ( | MultidimArray< double > & | avg, |
MultidimArray< double > & | stddev | ||
) |
Compute Statistics.
Definition at line 348 of file basic_pca.cpp.
void PCAMahalanobisAnalyzer::evaluateZScore | ( | int | NPCA, |
int | Niter, | ||
bool | trained = false , |
||
const char * | filename = "temp.txt" , |
||
int | numdesc = 0 |
||
) |
Evaluate Zscore of the vectors stored with Mahalanobis distance. NPCA is the dimension of the dimensionally reduced vectors before Mahalanobis Niter is used to learn the PCA basis (typically, Niter=10).
Definition at line 384 of file basic_pca.cpp.
|
inline |
|
inline |
|
inline |
void PCAMahalanobisAnalyzer::gramSchmidt | ( | ) |
This method computes the orthonormal basis for the vectors of an Eucldian which is formed by the vectors on each column of the matrix. The output of this method will be a matrix in which each column form an orthonormal basis.
computes the orthonormal basis for a subspace
This method computes the orthonormal basis for the vectors of an Euclidean which is formed by the vectors on each column of the matrix. The output of this method will be a matrix in which each column form an orthonormal basis.
Take the current vector
Take the previous vectors
Definition at line 314 of file basic_pca.cpp.
void PCAMahalanobisAnalyzer::learnPCABasis | ( | size_t | NPCA, |
size_t | Niter | ||
) |
Learn basis.
Do the PCAbasis*v
Definition at line 170 of file basic_pca.cpp.
void PCAMahalanobisAnalyzer::projectOnPCABasis | ( | Matrix2D< double > & | CtY | ) |
Project on basis.
Definition at line 119 of file basic_pca.cpp.
void PCAMahalanobisAnalyzer::reconsFromPCA | ( | const Matrix2D< double > & | CtY, |
std::vector< MultidimArray< float > > & | recons | ||
) |
Reconstruct from PCA basis.
Definition at line 153 of file basic_pca.cpp.
|
inline |
void PCAMahalanobisAnalyzer::standardarizeVariables | ( | ) |
Standardarize variables.
Definition at line 61 of file basic_pca.cpp.
void PCAMahalanobisAnalyzer::subtractAvg | ( | ) |
Subtract average.
Definition at line 33 of file basic_pca.cpp.
MultidimArray<double> PCAMahalanobisAnalyzer::avg |
Definition at line 72 of file basic_pca.h.
MultidimArray<int> PCAMahalanobisAnalyzer::idx |
Definition at line 78 of file basic_pca.h.
std::vector< MultidimArray<double> > PCAMahalanobisAnalyzer::PCAbasis |
Definition at line 69 of file basic_pca.h.
std::vector< MultidimArray<float> > PCAMahalanobisAnalyzer::v |
Definition at line 66 of file basic_pca.h.
Matrix1D<double> PCAMahalanobisAnalyzer::w |
Definition at line 81 of file basic_pca.h.
MultidimArray<double> PCAMahalanobisAnalyzer::Zscore |
Definition at line 75 of file basic_pca.h.