Search in sources :

Example 1 with SingleAssignmentKMeans

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

the class FarthestSumPointsInitialMeansTest method testFarthestSumPointsInitialMeans.

/**
 * Run KMeans with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testFarthestSumPointsInitialMeans() {
    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, // 
    FarthestSumPointsInitialMeans.class).build().run(db);
    testFMeasure(db, result, 0.80399668933);
    testClusterSizes(result, new int[] { 32, 169, 199, 201, 399 });
}
Also used : SingleAssignmentKMeans(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 2 with SingleAssignmentKMeans

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

the class RandomlyGeneratedInitialMeansTest method testRandomlyGeneratedInitialMeans.

/**
 * Run KMeans with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testRandomlyGeneratedInitialMeans() {
    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, // 
    0).with(KMeans.INIT_ID, // 
    RandomlyGeneratedInitialMeans.class).build().run(db);
    testFMeasure(db, result, 0.74344789);
    testClusterSizes(result, new int[] { 1, 145, 208, 246, 400 });
}
Also used : SingleAssignmentKMeans(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 3 with SingleAssignmentKMeans

use of de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans 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 });
}
Also used : SingleAssignmentKMeans(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 4 with SingleAssignmentKMeans

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

the class KMeansPlusPlusInitialMeansTest method testSingleAssignmentKMeansPlusPlus.

/**
 * Run KMeans with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testSingleAssignmentKMeansPlusPlus() {
    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, // 
    KMeansPlusPlusInitialMeans.class).build().run(db);
    testFMeasure(db, result, 0.99800500);
    testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 });
}
Also used : SingleAssignmentKMeans(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans) Database(de.lmu.ifi.dbs.elki.database.Database) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 5 with SingleAssignmentKMeans

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

the class RandomlyChosenInitialMeansTest method testRandomlyChosenInitialMeans.

/**
 * Run KMeans with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testRandomlyChosenInitialMeans() {
    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, // 
    7).with(KMeans.INIT_ID, // 
    RandomlyChosenInitialMeans.class).build().run(db);
    testFMeasure(db, result, 0.702733);
    testClusterSizes(result, new int[] { 64, 95, 202, 306, 333 });
}
Also used : SingleAssignmentKMeans(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans) 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)5 SingleAssignmentKMeans (de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.SingleAssignmentKMeans)5 Database (de.lmu.ifi.dbs.elki.database.Database)5 Test (org.junit.Test)5