use of de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.SLINK in project elki by elki-project.
the class HDBSCANHierarchyExtractionTest method testSLINKResults.
@Test
public void testSLINKResults() {
Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
HDBSCANHierarchyExtraction slink = //
new ELKIBuilder<>(HDBSCANHierarchyExtraction.class).with(HDBSCANHierarchyExtraction.Parameterizer.MINCLUSTERSIZE_ID, //
50).with(AbstractAlgorithm.ALGORITHM_ID, //
SLINK.class).build();
testFMeasure(db, slink.run(db), 0.9407684);
testClusterSizes(slink.run(db), new int[] { 8, 62, 104, 156 });
}
use of de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.SLINK in project elki by elki-project.
the class FileBasedSparseDoubleDistanceFunctionTest method testExternalDistance.
@Test
public void testExternalDistance() throws IOException {
Database db = //
new ELKIBuilder<>(StaticArrayDatabase.class).with(AbstractDatabase.Parameterizer.DATABASE_CONNECTION_ID, //
DBIDRangeDatabaseConnection.class).with(DBIDRangeDatabaseConnection.Parameterizer.COUNT_ID, //
4).build();
db.initialize();
FileBasedSparseDoubleDistanceFunction df = new //
FileBasedSparseDoubleDistanceFunction(new AsciiDistanceParser(CSVReaderFormat.DEFAULT_FORMAT), null, Double.POSITIVE_INFINITY);
// We need to read from a resource, instead of a file.
df.loadCache(4, FileUtil.openSystemFile(FILENAME));
SLINK<DBID> slink = new SLINK<>(df);
CutDendrogramByHeight clus = new CutDendrogramByHeight(slink, 0.5, false);
Clustering<DendrogramModel> c = clus.run(db);
testClusterSizes(c, new int[] { 2, 2 });
}
use of de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.SLINK in project elki by elki-project.
the class HDBSCANHierarchyExtractionTest method testSLINKDegenerate.
@Test
public void testSLINKDegenerate() {
Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
HDBSCANHierarchyExtraction slink = //
new ELKIBuilder<>(HDBSCANHierarchyExtraction.class).with(HDBSCANHierarchyExtraction.Parameterizer.MINCLUSTERSIZE_ID, //
1).with(AbstractAlgorithm.ALGORITHM_ID, //
SLINK.class).build();
testFMeasure(db, slink.run(db), 0.497315);
testClusterSizes(slink.run(db), new int[] { 0, 1, 329 });
}
use of de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.SLINK in project elki by elki-project.
the class FileBasedSparseFloatDistanceFunctionTest method testExternalDistance.
@Test
public void testExternalDistance() throws IOException {
Database db = //
new ELKIBuilder<>(StaticArrayDatabase.class).with(AbstractDatabase.Parameterizer.DATABASE_CONNECTION_ID, //
DBIDRangeDatabaseConnection.class).with(DBIDRangeDatabaseConnection.Parameterizer.COUNT_ID, //
4).build();
db.initialize();
FileBasedSparseFloatDistanceFunction df = new //
FileBasedSparseFloatDistanceFunction(new AsciiDistanceParser(CSVReaderFormat.DEFAULT_FORMAT), null, Float.POSITIVE_INFINITY);
// We need to read from a resource, instead of a file.
df.loadCache(4, FileUtil.openSystemFile(FILENAME));
SLINK<DBID> slink = new SLINK<>(df);
CutDendrogramByHeight clus = new CutDendrogramByHeight(slink, 0.5, false);
Clustering<DendrogramModel> c = clus.run(db);
testClusterSizes(c, new int[] { 2, 2 });
}
Aggregations