use of de.lmu.ifi.dbs.elki.evaluation.clustering.ClusterContingencyTable in project elki by elki-project.
the class DeLiCluTest method testDeLiCluResults.
/**
* Run DeLiClu with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testDeLiCluResults() {
ListParameterization indexparams = new ListParameterization();
// We need a special index for this algorithm:
indexparams.addParameter(StaticArrayDatabase.Parameterizer.INDEX_ID, DeLiCluTreeFactory.class);
indexparams.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 1000);
Database db = makeSimpleDatabase(UNITTEST + "hierarchical-2d.ascii", 710, indexparams);
Clustering<?> clustering = //
new ELKIBuilder<>(OPTICSXi.class).with(DeLiClu.Parameterizer.MINPTS_ID, //
18).with(OPTICSXi.Parameterizer.XI_ID, //
0.038).with(OPTICSXi.Parameterizer.XIALG_ID, //
DeLiClu.class).build().run(db);
// Test F-Measure
Clustering<Model> rbl = new ByLabelClustering().run(db);
ClusterContingencyTable ct = new ClusterContingencyTable(true, false);
ct.process(clustering, rbl);
double score = ct.getPaircount().f1Measure();
// identical each time, the results will vary.
if (Math.abs(score - 0.8771174) < 1e-5) {
assertEquals("Score does not match.", 0.8771174, score, 1e-5);
} else {
assertEquals("Score does not match.", 0.8819664, score, 1e-5);
}
}
Aggregations