use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.
the class LSDBCTest method testLSDBCResults.
@Test
public void testLSDBCResults() {
Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
Clustering<Model> result = //
new ELKIBuilder<LSDBC<DoubleVector>>(LSDBC.class).with(LSDBC.Parameterizer.ALPHA_ID, //
0.4).with(LSDBC.Parameterizer.K_ID, //
20).build().run(db);
testFMeasure(db, result, 0.44848979);
testClusterSizes(result, new int[] { 38, 38, 41, 54, 159 });
}
use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.
the class AbstractClusterAlgorithmTest method testFMeasure.
/**
* Test the clustering result by comparing the score with an expected value.
*
* @param database Database to test
* @param clustering Clustering result
* @param expected Expected score
*/
protected <O> void testFMeasure(Database database, Clustering<?> clustering, double expected) {
// Run by-label as reference
ByLabelClustering bylabel = new ByLabelClustering();
Clustering<Model> rbl = bylabel.run(database);
ClusterContingencyTable ct = new ClusterContingencyTable(true, false);
ct.process(clustering, rbl);
double score = ct.getPaircount().f1Measure();
Logging.getLogger(this.getClass()).verbose(this.getClass().getSimpleName() + " score: " + score + " expect: " + expected);
assertEquals(this.getClass().getSimpleName() + ": Score does not match.", expected, score, 0.0001);
}
use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.
the class GriDBSCANTest method testGriDBSCANWide.
/**
* Run DBSCAN with fixed parameters and compare the result to a golden
* standard, with larger grid width (fewer cells, less redundancy).
*/
@Test
public void testGriDBSCANWide() {
Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
Clustering<Model> result = //
new ELKIBuilder<GriDBSCAN<DoubleVector>>(GriDBSCAN.class).with(DBSCAN.Parameterizer.EPSILON_ID, //
0.04).with(DBSCAN.Parameterizer.MINPTS_ID, //
20).with(GriDBSCAN.Parameterizer.GRID_ID, //
0.4).build().run(db);
testFMeasure(db, result, 0.996413);
testClusterSizes(result, new int[] { 29, 50, 101, 150 });
}
use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.
the class GriDBSCANTest method testGriDBSCANResults.
/**
* Run DBSCAN with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testGriDBSCANResults() {
Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
Clustering<Model> result = //
new ELKIBuilder<GriDBSCAN<DoubleVector>>(GriDBSCAN.class).with(DBSCAN.Parameterizer.EPSILON_ID, //
0.04).with(DBSCAN.Parameterizer.MINPTS_ID, //
20).with(GriDBSCAN.Parameterizer.GRID_ID, //
0.08).build().run(db);
testFMeasure(db, result, 0.996413);
testClusterSizes(result, new int[] { 29, 50, 101, 150 });
}
use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.
the class SNNClusteringTest method testSNNClusteringResults.
/**
* Run SNNClustering with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testSNNClusteringResults() {
Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d.ascii", 1200);
Clustering<Model> result = //
new ELKIBuilder<SNNClustering<DoubleVector>>(SNNClustering.class).with(SNNClustering.Parameterizer.EPSILON_ID, //
77).with(SNNClustering.Parameterizer.MINPTS_ID, //
28).with(SharedNearestNeighborPreprocessor.Factory.NUMBER_OF_NEIGHBORS_ID, //
100).build().run(db);
testFMeasure(db, result, 0.832371422);
testClusterSizes(result, new int[] { 73, 228, 213, 219, 231, 236 });
}
Aggregations