Search in sources :

Example 86 with Database

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

the class KMeansPlusPlusInitialMeansTest method testSingleAssignmentKMeansPlusPlusMedoids.

/**
 * Run CLARA with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testSingleAssignmentKMeansPlusPlusMedoids() {
    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.SEED_ID, // 
    3).with(KMeans.INIT_ID, // 
    KMeansPlusPlusInitialMeans.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.932711);
    testClusterSizes(result, new int[] { 165, 199, 201, 201, 234 });
}
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)

Example 87 with Database

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

the class RandomlyChosenInitialMeansTest method testRandomlyChosenInitialMedoids.

/**
 * Run CLARA with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testRandomlyChosenInitialMedoids() {
    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.SEED_ID, // 
    7).with(KMeans.INIT_ID, // 
    RandomlyChosenInitialMeans.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 : 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)

Example 88 with Database

use of de.lmu.ifi.dbs.elki.database.Database 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)

Example 89 with Database

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

the class FPGrowthTest method testLarge.

@Test
public void testLarge() {
    Database db = loadTransactions(UNITTEST + "itemsets/zutaten.txt.gz", 16401);
    FrequentItemsetsResult res = // 
    new ELKIBuilder<>(FPGrowth.class).with(FPGrowth.Parameterizer.MINSUPP_ID, 200).build().run(db);
    assertEquals("Size not as expected.", 184, res.getItemsets().size());
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) FrequentItemsetsResult(de.lmu.ifi.dbs.elki.result.FrequentItemsetsResult) Test(org.junit.Test)

Example 90 with Database

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

the class CertaintyFactorTest method testToyExample.

@Test
public void testToyExample() {
    Database db = loadTransactions(UNITTEST + "itemsets/increasing5.txt", 5);
    AssociationRuleResult res = // 
    new ELKIBuilder<>(AssociationRuleGeneration.class).with(FPGrowth.Parameterizer.MINSUPP_ID, // 
    2).with(AssociationRuleGeneration.Parameterizer.MINMEASURE_ID, // 
    1.).with(AssociationRuleGeneration.Parameterizer.INTERESTMEASURE_ID, // 
    CertaintyFactor.class).build().run(db);
    assertEquals("Size not as expected.", 18, res.getRules().size());
}
Also used : AssociationRuleResult(de.lmu.ifi.dbs.elki.result.AssociationRuleResult) AssociationRuleGeneration(de.lmu.ifi.dbs.elki.algorithm.itemsetmining.associationrules.AssociationRuleGeneration) Database(de.lmu.ifi.dbs.elki.database.Database) Test(org.junit.Test) AbstractFrequentItemsetAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.itemsetmining.AbstractFrequentItemsetAlgorithmTest)

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