use of de.lmu.ifi.dbs.elki.data.model.DendrogramModel 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.data.model.DendrogramModel in project elki by elki-project.
the class HDBSCANHierarchyExtractionEvaluator method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result newResult) {
ArrayList<PointerHierarchyRepresentationResult> hrs = ResultUtil.filterResults(hier, newResult, PointerHierarchyRepresentationResult.class);
for (PointerHierarchyRepresentationResult pointerresult : hrs) {
Clustering<DendrogramModel> result = inner.run(pointerresult);
pointerresult.addChildResult(result);
}
}
use of de.lmu.ifi.dbs.elki.data.model.DendrogramModel 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