The following is a simple example of how to perform basic principle component analysis in EJML.
Principal Component Analysis (PCA) is typically used to develop a linear model for a set of data (e.g. face images) which can then be used to test for membership. PCA works by converting the set of data to a new basis that is a subspace of the original set. The subspace is selected to maximize information.
PCA is typically derived as an eigenvalue problem. However in this implementation is used instead because it will produce a more numerically stable solution. Computation using EVD requires explicitly computing the variance of each sample set. The variance is computed by squaring the residual, which can cause loss of precision.
Usage:
1) call setup()
2) For each sample (e.g. an image ) call addSample()
3) After all the samples have been added call computeBasis()
4) Call sampleToEigenSpace() , eigenToSampleSpace() , errorMembership() , response()
|
|