use of de.lmu.ifi.dbs.elki.data.model.DimensionModel in project elki by elki-project.
the class COPACTest method testCOPACResults.
/**
* Run COPAC with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testCOPACResults() {
Database db = makeSimpleDatabase(UNITTEST + "correlation-hierarchy.csv", 450);
// these parameters are not picked too well - room for improvement.
Clustering<DimensionModel> result = //
new ELKIBuilder<COPAC<DoubleVector>>(COPAC.class).with(DBSCAN.Parameterizer.EPSILON_ID, //
0.02).with(DBSCAN.Parameterizer.MINPTS_ID, //
50).with(COPAC.Parameterizer.K_ID, //
15).build().run(db);
testFMeasure(db, result, 0.8484056);
testClusterSizes(result, new int[] { 54, 196, 200 });
}
use of de.lmu.ifi.dbs.elki.data.model.DimensionModel 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;
}
use of de.lmu.ifi.dbs.elki.data.model.DimensionModel in project elki by elki-project.
the class COPACTest method testCOPACOverlap.
/**
* Run COPAC with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testCOPACOverlap() {
Database db = makeSimpleDatabase(UNITTEST + "correlation-overlap-3-5d.ascii", 650);
Clustering<DimensionModel> result = //
new ELKIBuilder<COPAC<DoubleVector>>(COPAC.class).with(DBSCAN.Parameterizer.EPSILON_ID, //
0.5).with(DBSCAN.Parameterizer.MINPTS_ID, //
20).with(COPAC.Parameterizer.K_ID, //
45).with(PCARunner.Parameterizer.PCA_COVARIANCE_MATRIX, //
WeightedCovarianceMatrixBuilder.class).with(WeightedCovarianceMatrixBuilder.Parameterizer.WEIGHT_ID, //
ErfcWeight.class).with(EigenPairFilter.PCA_EIGENPAIR_FILTER, //
PercentageEigenPairFilter.class).with(PercentageEigenPairFilter.Parameterizer.ALPHA_ID, //
0.8).build().run(db);
testFMeasure(db, result, 0.86505092);
testClusterSizes(result, new int[] { 32, 172, 197, 249 });
}
Aggregations