Search in sources :

Example 1 with COPACNeighborPredicate

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

the class COPAC method run.

/**
 * Run the COPAC algorithm.
 *
 * @param database Database
 * @param relation Vector field relation
 * @return COPAC clustering
 */
public Clustering<DimensionModel> run(Database database, Relation<V> relation) {
    COPACNeighborPredicate.Instance npred = new COPACNeighborPredicate<V>(settings).instantiate(database, relation);
    CorePredicate.Instance<DBIDs> cpred = new MinPtsCorePredicate(settings.minpts).instantiate(database);
    Clustering<Model> dclusters = new GeneralizedDBSCAN.Instance<>(npred, cpred, false).run();
    // Re-wrap the detected clusters for COPAC:
    Clustering<DimensionModel> result = new Clustering<>("COPAC clustering", "copac-clustering");
    // Generalized DBSCAN clusterings will be flat.
    for (It<Cluster<Model>> iter = dclusters.iterToplevelClusters(); iter.valid(); iter.advance()) {
        Cluster<Model> clus = iter.get();
        if (clus.size() > 0) {
            int dim = npred.dimensionality(clus.getIDs().iter());
            DimensionModel model = new DimensionModel(dim);
            result.addToplevelCluster(new Cluster<>(clus.getIDs(), model));
        }
    }
    return result;
}
Also used : MinPtsCorePredicate(de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.MinPtsCorePredicate) CorePredicate(de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.CorePredicate) DimensionModel(de.lmu.ifi.dbs.elki.data.model.DimensionModel) DBIDs(de.lmu.ifi.dbs.elki.database.ids.DBIDs) Cluster(de.lmu.ifi.dbs.elki.data.Cluster) MinPtsCorePredicate(de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.MinPtsCorePredicate) COPACNeighborPredicate(de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.COPACNeighborPredicate) Clustering(de.lmu.ifi.dbs.elki.data.Clustering) DimensionModel(de.lmu.ifi.dbs.elki.data.model.DimensionModel) Model(de.lmu.ifi.dbs.elki.data.model.Model) GeneralizedDBSCAN(de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.GeneralizedDBSCAN)

Aggregations

COPACNeighborPredicate (de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.COPACNeighborPredicate)1 CorePredicate (de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.CorePredicate)1 GeneralizedDBSCAN (de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.GeneralizedDBSCAN)1 MinPtsCorePredicate (de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.MinPtsCorePredicate)1 Cluster (de.lmu.ifi.dbs.elki.data.Cluster)1 Clustering (de.lmu.ifi.dbs.elki.data.Clustering)1 DimensionModel (de.lmu.ifi.dbs.elki.data.model.DimensionModel)1 Model (de.lmu.ifi.dbs.elki.data.model.Model)1 DBIDs (de.lmu.ifi.dbs.elki.database.ids.DBIDs)1