Search in sources :

Example 26 with Database

use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.

the class NNChainTest method testGroupAverage.

/**
 * Run agglomerative hierarchical clustering with fixed parameters and compare
 * the result to a golden standard.
 */
@Test
public void testGroupAverage() {
    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, // 
    GroupAverageLinkage.class).build().run(db);
    testFMeasure(db, clustering, 0.93866265);
    testClusterSizes(clustering, new int[] { 200, 211, 227 });
}
Also used : CutDendrogramByNumberOfClusters(de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.extraction.CutDendrogramByNumberOfClusters) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 27 with Database

use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.

the class ClustersWithNoiseExtractionTest method testClustering.

@Test
public void testClustering() {
    Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
    Clustering<?> clustering = // 
    new ELKIBuilder<>(ClustersWithNoiseExtraction.class).with(ClustersWithNoiseExtraction.Parameterizer.K_ID, // 
    3).with(ClustersWithNoiseExtraction.Parameterizer.MINCLUSTERSIZE_ID, // 
    5).with(AbstractAlgorithm.ALGORITHM_ID, // 
    AnderbergHierarchicalClustering.class).build().run(db);
    testFMeasure(db, clustering, 0.9242);
    testClusterSizes(clustering, new int[] { 56, 123, 151 });
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 28 with Database

use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.

the class CutDendrogramByNumberOfClustersTest method testSLINKHierarchical.

@Test
public void testSLINKHierarchical() {
    Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
    Clustering<?> clustering = // 
    new ELKIBuilder<>(CutDendrogramByNumberOfClusters.class).with(CutDendrogramByNumberOfClusters.Parameterizer.MINCLUSTERS_ID, // 
    10).with(// 
    CutDendrogramByNumberOfClusters.Parameterizer.HIERARCHICAL_ID).with(AbstractAlgorithm.ALGORITHM_ID, // 
    SLINK.class).build().run(db);
    testFMeasure(db, clustering, 0.9474250948);
    testClusterSizes(clustering, new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 62, 104, 154 });
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 29 with Database

use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.

the class SimplifiedHierarchyExtractionTest method testHDBSCANResults.

@Test
public void testHDBSCANResults() {
    Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
    Result result = // 
    new ELKIBuilder<>(SimplifiedHierarchyExtraction.class).with(SimplifiedHierarchyExtraction.Parameterizer.MINCLUSTERSIZE_ID, // 
    50).with(AbstractAlgorithm.ALGORITHM_ID, // 
    HDBSCANLinearMemory.class).with(HDBSCANLinearMemory.Parameterizer.MIN_PTS_ID, // 
    20).build().run(db);
    Clustering<?> clustering = findSingleClustering(result);
    testFMeasure(db, clustering, 0.96941);
    testClusterSizes(clustering, new int[] { 7, 14, 54, 103, 152 });
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) HDBSCANLinearMemory(de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.HDBSCANLinearMemory) Result(de.lmu.ifi.dbs.elki.result.Result) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 30 with Database

use of de.lmu.ifi.dbs.elki.database.Database in project elki by elki-project.

the class SimplifiedHierarchyExtractionTest method testHDBSCANDegenerate.

@Test
public void testHDBSCANDegenerate() {
    Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
    Result result = // 
    new ELKIBuilder<>(SimplifiedHierarchyExtraction.class).with(SimplifiedHierarchyExtraction.Parameterizer.MINCLUSTERSIZE_ID, // 
    1).with(AbstractAlgorithm.ALGORITHM_ID, // 
    HDBSCANLinearMemory.class).with(HDBSCANLinearMemory.Parameterizer.MIN_PTS_ID, // 
    20).build().run(db);
    Clustering<?> clustering = findSingleClustering(result);
    // minclustersize=1 is useless
    testFMeasure(db, clustering, 0.0182169);
    assertEquals(2 * 330 - 1, clustering.getAllClusters().size());
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) HDBSCANLinearMemory(de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.HDBSCANLinearMemory) Result(de.lmu.ifi.dbs.elki.result.Result) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Aggregations

Database (de.lmu.ifi.dbs.elki.database.Database)288 Test (org.junit.Test)240 AbstractClusterAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)151 ELKIBuilder (de.lmu.ifi.dbs.elki.utilities.ELKIBuilder)102 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)85 OutlierResult (de.lmu.ifi.dbs.elki.result.outlier.OutlierResult)69 AbstractOutlierAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.outlier.AbstractOutlierAlgorithmTest)50 Model (de.lmu.ifi.dbs.elki.data.model.Model)29 CutDendrogramByNumberOfClusters (de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical.extraction.CutDendrogramByNumberOfClusters)26 Clustering (de.lmu.ifi.dbs.elki.data.Clustering)14 StaticArrayDatabase (de.lmu.ifi.dbs.elki.database.StaticArrayDatabase)11 AbstractFrequentItemsetAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.itemsetmining.AbstractFrequentItemsetAlgorithmTest)10 AssociationRuleGeneration (de.lmu.ifi.dbs.elki.algorithm.itemsetmining.associationrules.AssociationRuleGeneration)10 AssociationRuleResult (de.lmu.ifi.dbs.elki.result.AssociationRuleResult)10 ListParameterization (de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization)10 AbstractSimpleAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest)9 MedoidModel (de.lmu.ifi.dbs.elki.data.model.MedoidModel)9 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)9 NumberVector (de.lmu.ifi.dbs.elki.data.NumberVector)8 DBIDs (de.lmu.ifi.dbs.elki.database.ids.DBIDs)8