use of de.lmu.ifi.dbs.elki.math.linearalgebra.pca.EigenPair in project elki by elki-project.
the class GlobalPrincipalComponentAnalysisTransform method prepareComplete.
@Override
protected void prepareComplete() {
mean = covmat.getMeanVector();
PCAResult pcares = (new PCARunner(null)).processCovarMatrix(covmat.destroyToPopulationMatrix());
SortedEigenPairs eps = pcares.getEigenPairs();
covmat = null;
if (filter == null) {
proj = new double[dim][dim];
for (int d = 0; d < dim; d++) {
EigenPair ep = eps.getEigenPair(d);
double[] ev = ep.getEigenvector();
double mult = 1. / FastMath.sqrt(ep.getEigenvalue());
// Fill weighted and transposed:
for (int i = 0; i < dim; i++) {
proj[d][i] = ev[i] * mult;
}
}
} else {
final int pdim = filter.filter(eps.eigenValues());
if (LOG.isVerbose()) {
LOG.verbose("Reducing dimensionality from " + dim + " to " + pdim + " via PCA.");
}
proj = new double[pdim][dim];
for (int d = 0; d < pdim; d++) {
EigenPair ep = eps.getEigenPair(d);
double[] ev = ep.getEigenvector();
double mult = 1. / FastMath.sqrt(ep.getEigenvalue());
// Fill weighted and transposed:
for (int i = 0; i < dim; i++) {
proj[d][i] = ev[i] * mult;
}
}
}
buf = new double[dim];
}
Aggregations