use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.
the class KMeansHamerlyTest method testKMeansHamerly.
/**
* Run KMeans with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testKMeansHamerly() {
Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000);
Clustering<?> result = //
new ELKIBuilder<KMeansHamerly<DoubleVector>>(KMeansHamerly.class).with(KMeans.K_ID, //
5).with(KMeans.SEED_ID, //
7).build().run(db);
testFMeasure(db, result, 0.998005);
testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 });
}
use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.
the class FarthestPointsInitialMeansTest method testFarthestPointsInitialMeans.
/**
* Run KMeans with fixed parameters and compare the result to a golden
* standard.
*/
@Test
public void testFarthestPointsInitialMeans() {
Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000);
Clustering<?> result = //
new ELKIBuilder<SingleAssignmentKMeans<DoubleVector>>(SingleAssignmentKMeans.class).with(KMeans.K_ID, //
5).with(KMeans.SEED_ID, //
3).with(KMeans.INIT_ID, //
FarthestPointsInitialMeans.class).build().run(db);
testFMeasure(db, result, 0.88132453);
testClusterSizes(result, new int[] { 128, 199, 201, 201, 271 });
}
use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.
the class NNChainTest method testCentroid.
/**
* Run agglomerative hierarchical clustering with fixed parameters and compare
* the result to a golden standard.
*/
@Test
public void testCentroid() {
Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638);
Clustering<?> clustering = //
new ELKIBuilder<>(CutDendrogramByNumberOfClusters.class).with(CutDendrogramByNumberOfClusters.Parameterizer.MINCLUSTERS_ID, //
3).with(AbstractAlgorithm.ALGORITHM_ID, //
NNChain.class).with(AGNES.Parameterizer.LINKAGE_ID, //
CentroidLinkage.class).build().run(db);
testFMeasure(db, clustering, 0.93866265);
testClusterSizes(clustering, new int[] { 200, 211, 227 });
}
use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.
the class NNChainTest method testBetaVariance.
/**
* Run agglomerative hierarchical clustering with fixed parameters and compare
* the result to a golden standard.
*/
@Test
public void testBetaVariance() {
Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638);
Clustering<?> clustering = //
new ELKIBuilder<>(CutDendrogramByNumberOfClusters.class).with(CutDendrogramByNumberOfClusters.Parameterizer.MINCLUSTERS_ID, //
3).with(AbstractAlgorithm.ALGORITHM_ID, //
NNChain.class).with(AGNES.Parameterizer.LINKAGE_ID, //
FlexibleBetaLinkage.class).with(FlexibleBetaLinkage.Parameterizer.BETA_ID, //
-.33).build().run(db);
testFMeasure(db, clustering, 0.9381678);
testClusterSizes(clustering, new int[] { 200, 217, 221 });
}
use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.
the class EvaluateConcordantPairs method processNewResult.
@Override
public void processNewResult(ResultHierarchy hier, Result result) {
List<Clustering<?>> crs = Clustering.getClusteringResults(result);
if (crs.isEmpty()) {
return;
}
Database db = ResultUtil.findDatabase(hier);
Relation<? extends NumberVector> rel = db.getRelation(this.distanceFunction.getInputTypeRestriction());
for (Clustering<?> c : crs) {
evaluateClustering(db, (Relation<? extends NumberVector>) rel, c);
}
}
Aggregations