Search in sources :

Example 1 with TrivialAllNoise

use of de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllNoise in project elki by elki-project.

the class ClusterContingencyTableTest method testCompareDatabases.

/**
 * Validate {@link ClusterContingencyTable} with respect to its ability to
 * compare data clusterings.
 */
@Test
public void testCompareDatabases() {
    Database db = AbstractSimpleAlgorithmTest.makeSimpleDatabase(dataset, shoulds);
    Clustering<Model> rai = new TrivialAllInOne().run(db);
    Clustering<Model> ran = new TrivialAllNoise().run(db);
    Clustering<?> rbl = new ByLabelClustering().run(db);
    assertEquals(1.0, computeFMeasure(rai, rai, false), Double.MIN_VALUE);
    assertEquals(1.0, computeFMeasure(ran, ran, false), Double.MIN_VALUE);
    assertEquals(1.0, computeFMeasure(rbl, rbl, false), Double.MIN_VALUE);
    assertEquals(0.009950248756218905, computeFMeasure(ran, rbl, true), Double.MIN_VALUE);
    assertEquals(0.0033277870216306157, computeFMeasure(rai, ran, true), Double.MIN_VALUE);
    assertEquals(0.5, /* 0.3834296724470135 */
    computeFMeasure(rai, rbl, false), Double.MIN_VALUE);
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) Model(de.lmu.ifi.dbs.elki.data.model.Model) TrivialAllNoise(de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllNoise) TrivialAllInOne(de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllInOne) ByLabelClustering(de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering) Test(org.junit.Test) AbstractSimpleAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest)

Aggregations

AbstractSimpleAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest)1 ByLabelClustering (de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering)1 TrivialAllInOne (de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllInOne)1 TrivialAllNoise (de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.TrivialAllNoise)1 Model (de.lmu.ifi.dbs.elki.data.model.Model)1 Database (de.lmu.ifi.dbs.elki.database.Database)1 Test (org.junit.Test)1