Search in sources :

Example 1 with PreDeConModel

use of de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.PreDeConNeighborPredicate.PreDeConModel in project elki by elki-project.

the class FourCNeighborPredicate method computeLocalModel.

@Override
protected PreDeConModel computeLocalModel(DBIDRef id, DoubleDBIDList neighbors, Relation<V> relation) {
    mvSize.put(neighbors.size());
    SortedEigenPairs epairs = pca.processIds(neighbors, relation).getEigenPairs();
    int cordim = filter.filter(epairs.eigenValues());
    PCAFilteredResult pcares = new PCAFilteredResult(epairs, cordim, settings.kappa, 1.);
    double[][] m_hat = pcares.similarityMatrix();
    double[] obj = relation.get(id).toArray();
    // To save computing the square root below.
    double sqeps = settings.epsilon * settings.epsilon;
    HashSetModifiableDBIDs survivors = DBIDUtil.newHashSet(neighbors.size());
    for (DBIDIter iter = neighbors.iter(); iter.valid(); iter.advance()) {
        // Compute weighted / projected distance:
        double[] diff = minusEquals(relation.get(iter).toArray(), obj);
        double dist = transposeTimesTimes(diff, m_hat, diff);
        if (dist <= sqeps) {
            survivors.add(iter);
        }
    }
    if (cordim <= settings.lambda) {
        mvSize2.put(survivors.size());
    }
    mvCorDim.put(cordim);
    return new PreDeConModel(cordim, survivors);
}
Also used : HashSetModifiableDBIDs(de.lmu.ifi.dbs.elki.database.ids.HashSetModifiableDBIDs) SortedEigenPairs(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.SortedEigenPairs) PreDeConModel(de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.PreDeConNeighborPredicate.PreDeConModel) PCAFilteredResult(de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCAFilteredResult) DBIDIter(de.lmu.ifi.dbs.elki.database.ids.DBIDIter)

Aggregations

PreDeConModel (de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.PreDeConNeighborPredicate.PreDeConModel)1 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)1 HashSetModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.HashSetModifiableDBIDs)1 PCAFilteredResult (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCAFilteredResult)1 SortedEigenPairs (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.SortedEigenPairs)1