Search in sources :

Example 11 with ELKIBuilder

use of de.lmu.ifi.dbs.elki.utilities.ELKIBuilder in project elki by elki-project.

the class SimplifiedHierarchyExtractionTest method testMiniMaxNNResults.

@Test
public void testMiniMaxNNResults() {
    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, // 
    MiniMaxNNChain.class).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 : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) Result(de.lmu.ifi.dbs.elki.result.Result) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 12 with ELKIBuilder

use of de.lmu.ifi.dbs.elki.utilities.ELKIBuilder in project elki by elki-project.

the class SimplifiedHierarchyExtractionTest method testSLINKDegenerate.

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

Example 13 with ELKIBuilder

use of de.lmu.ifi.dbs.elki.utilities.ELKIBuilder in project elki by elki-project.

the class CLARATest method testCLARA.

/**
 * Run CLARA with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testCLARA() {
    Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000);
    Clustering<MedoidModel> result = // 
    new ELKIBuilder<CLARA<DoubleVector>>(CLARA.class).with(KMeans.K_ID, // 
    5).with(CLARA.Parameterizer.RANDOM_ID, // 
    1).with(CLARA.Parameterizer.NUMSAMPLES_ID, // 
    2).with(CLARA.Parameterizer.SAMPLESIZE_ID, // 
    50).build().run(db);
    testFMeasure(db, result, 0.998005);
    testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) MedoidModel(de.lmu.ifi.dbs.elki.data.model.MedoidModel) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 14 with ELKIBuilder

use of de.lmu.ifi.dbs.elki.utilities.ELKIBuilder in project elki by elki-project.

the class KMeansBisectingTest method testKMeansBisectingFMeasure.

/**
 * Run KMeansBisecting with fixed parameters (k = 2) and compare f-measure to
 * golden standard.
 */
@Test
public void testKMeansBisectingFMeasure() {
    Database db = makeSimpleDatabase(UNITTEST + "bisecting-test.csv", 300);
    KMeansBisecting<DoubleVector, MeanModel> kmeans = // 
    new ELKIBuilder<KMeansBisecting<DoubleVector, MeanModel>>(KMeansBisecting.class).with(KMeans.K_ID, // 
    2).with(KMeans.SEED_ID, // 
    0).with(BestOfMultipleKMeans.Parameterizer.TRIALS_ID, // 
    5).with(BestOfMultipleKMeans.Parameterizer.KMEANS_ID, // 
    KMeansLloyd.class).with(BestOfMultipleKMeans.Parameterizer.QUALITYMEASURE_ID, // 
    WithinClusterVarianceQualityMeasure.class).build();
    // run KMedians on database
    Clustering<MeanModel> result = kmeans.run(db);
    testFMeasure(db, result, 0.7408);
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) WithinClusterVarianceQualityMeasure(de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.quality.WithinClusterVarianceQualityMeasure) MeanModel(de.lmu.ifi.dbs.elki.data.model.MeanModel) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 15 with ELKIBuilder

use of de.lmu.ifi.dbs.elki.utilities.ELKIBuilder in project elki by elki-project.

the class KMeansElkanTest method testKMeansElkan.

/**
 * Run KMeans with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testKMeansElkan() {
    Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000);
    Clustering<?> result = // 
    new ELKIBuilder<KMeansElkan<DoubleVector>>(KMeansElkan.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 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Aggregations

ELKIBuilder (de.lmu.ifi.dbs.elki.utilities.ELKIBuilder)114 Test (org.junit.Test)111 Database (de.lmu.ifi.dbs.elki.database.Database)102 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)75 AbstractClusterAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)73 OutlierResult (de.lmu.ifi.dbs.elki.result.outlier.OutlierResult)26 AbstractOutlierAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.outlier.AbstractOutlierAlgorithmTest)22 Model (de.lmu.ifi.dbs.elki.data.model.Model)11 AbstractDataSourceTest (de.lmu.ifi.dbs.elki.datasource.AbstractDataSourceTest)10 MultipleObjectsBundle (de.lmu.ifi.dbs.elki.datasource.bundle.MultipleObjectsBundle)10 MedoidModel (de.lmu.ifi.dbs.elki.data.model.MedoidModel)7 SubspaceModel (de.lmu.ifi.dbs.elki.data.model.SubspaceModel)5 InputStreamDatabaseConnection (de.lmu.ifi.dbs.elki.datasource.InputStreamDatabaseConnection)3 WeightedCovarianceMatrixBuilder (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.WeightedCovarianceMatrixBuilder)3 InputStream (java.io.InputStream)3 CorrelationModel (de.lmu.ifi.dbs.elki.data.model.CorrelationModel)2 PercentageEigenPairFilter (de.lmu.ifi.dbs.elki.math.linearalgebra.pca.filter.PercentageEigenPairFilter)2 KolmogorovSmirnovTest (de.lmu.ifi.dbs.elki.math.statistics.tests.KolmogorovSmirnovTest)2 WelchTTest (de.lmu.ifi.dbs.elki.math.statistics.tests.WelchTTest)2 ArrayList (java.util.ArrayList)2