use of de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllInOne in project elki by elki-project.
the class ClusterContingencyTableTest method testCompareDatabases.
/**
* Validate {@link ClusterContingencyTable} with respect to its ability to
* compare data clusterings.
*/
@Test
public void testCompareDatabases() {
Database db = AbstractSimpleAlgorithmTest.makeSimpleDatabase(dataset, shoulds);
Clustering<Model> rai = new TrivialAllInOne().run(db);
Clustering<Model> ran = new TrivialAllNoise().run(db);
Clustering<?> rbl = new ByLabelClustering().run(db);
assertEquals(1.0, computeFMeasure(rai, rai, false), Double.MIN_VALUE);
assertEquals(1.0, computeFMeasure(ran, ran, false), Double.MIN_VALUE);
assertEquals(1.0, computeFMeasure(rbl, rbl, false), Double.MIN_VALUE);
assertEquals(0.009950248756218905, computeFMeasure(ran, rbl, true), Double.MIN_VALUE);
assertEquals(0.0033277870216306157, computeFMeasure(rai, ran, true), Double.MIN_VALUE);
assertEquals(0.5, /* 0.3834296724470135 */
computeFMeasure(rai, rbl, false), Double.MIN_VALUE);
}
use of de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllInOne in project elki by elki-project.
the class VisualizerContext method generateDefaultClustering.
/**
* Generate a default (fallback) clustering.
*
* @return generated clustering
*/
private Clustering<Model> generateDefaultClustering() {
final Database db = ResultUtil.findDatabase(hier);
Clustering<Model> c = null;
try {
// Try to cluster by labels
ByLabelHierarchicalClustering split = new ByLabelHierarchicalClustering();
c = split.run(db);
} catch (NoSupportedDataTypeException e) {
// Put everything into one
c = new TrivialAllInOne().run(db);
}
return c;
}
Aggregations