use of de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCAFilteredResult in project elki by elki-project.
the class AbstractFilteredPCAIndex method initialize.
@Override
public void initialize() {
if (relation == null || relation.size() <= 0) {
throw new EmptyDataException();
}
// recomputed for the partitions!
if (storage != null) {
return;
}
storage = DataStoreUtil.makeStorage(relation.getDBIDs(), DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP, PCAFilteredResult.class);
long start = System.currentTimeMillis();
FiniteProgress progress = getLogger().isVerbose() ? new FiniteProgress("Performing local PCA", relation.size(), getLogger()) : null;
// TODO: use a bulk operation?
for (DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
DoubleDBIDList objects = objectsForPCA(iditer);
SortedEigenPairs epairs = pca.processIds(objects, relation).getEigenPairs();
int numstrong = filter.filter(epairs.eigenValues());
PCAFilteredResult pcares = new PCAFilteredResult(epairs, numstrong, 1., 0.);
storage.put(iditer, pcares);
getLogger().incrementProcessed(progress);
}
getLogger().ensureCompleted(progress);
long end = System.currentTimeMillis();
if (getLogger().isVerbose()) {
long elapsedTime = end - start;
getLogger().verbose(this.getClass().getName() + " runtime: " + elapsedTime + " milliseconds.");
}
}
Aggregations