Search in sources :

Example 1 with CLARA

use of de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.CLARA in project elki by elki-project.

the class FirstKInitialMeansTest method testFirstKInitialMedoids.

/**
 * Run CLARA with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testFirstKInitialMedoids() {
    Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000);
    Clustering<?> result = // 
    new ELKIBuilder<CLARA<DoubleVector>>(CLARA.class).with(KMeans.K_ID, // 
    5).with(KMeans.INIT_ID, // 
    FirstKInitialMeans.class).with(KMeans.MAXITER_ID, // 
    1).with(CLARA.Parameterizer.SAMPLESIZE_ID, // 
    10).with(CLARA.Parameterizer.RANDOM_ID, // 
    0).build().run(db);
    testFMeasure(db, result, 0.7454859);
    testClusterSizes(result, new int[] { 45, 155, 200, 287, 313 });
}
Also used : CLARA(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.CLARA) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 2 with CLARA

use of de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.CLARA in project elki by elki-project.

the class PAMInitialMeansTest method testPAMInitialMedoids.

/**
 * Run CLARA with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testPAMInitialMedoids() {
    Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000);
    Clustering<?> result = // 
    new ELKIBuilder<CLARA<DoubleVector>>(CLARA.class).with(KMeans.K_ID, // 
    5).with(KMeans.INIT_ID, // 
    PAMInitialMeans.class).with(KMeans.MAXITER_ID, // 
    1).with(CLARA.Parameterizer.SAMPLESIZE_ID, // 
    10).with(CLARA.Parameterizer.RANDOM_ID, // 
    0).build().run(db);
    testFMeasure(db, result, 0.99602);
    testClusterSizes(result, new int[] { 198, 200, 200, 200, 202 });
}
Also used : CLARA(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.CLARA) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Aggregations

AbstractClusterAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)2 CLARA (de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.CLARA)2 Database (de.lmu.ifi.dbs.elki.database.Database)2 Test (org.junit.Test)2