Search in sources :

Example 56 with Model

use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.

the class GeneralizedDBSCANTest method testDBSCANResults.

/**
 * Run Generalized DBSCAN with fixed parameters and compare the result to a
 * golden standard.
 */
@Test
public void testDBSCANResults() {
    Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330);
    Clustering<Model> result = // 
    new ELKIBuilder<>(GeneralizedDBSCAN.class).with(DBSCAN.Parameterizer.EPSILON_ID, // 
    0.04).with(DBSCAN.Parameterizer.MINPTS_ID, // 
    20).build().run(db);
    testFMeasure(db, result, 0.996413);
    testClusterSizes(result, new int[] { 29, 50, 101, 150 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) Model(de.lmu.ifi.dbs.elki.data.model.Model) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 57 with Model

use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.

the class ParallelGeneralizedDBSCANTest method testDBSCANOnSingleLinkDataset.

/**
 * Run Generalized DBSCAN with fixed parameters and compare the result to a
 * golden standard.
 */
@Test
public void testDBSCANOnSingleLinkDataset() {
    Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638);
    Clustering<Model> result = // 
    new ELKIBuilder<>(ParallelGeneralizedDBSCAN.class).with(DBSCAN.Parameterizer.EPSILON_ID, // 
    11.5).with(DBSCAN.Parameterizer.MINPTS_ID, // 
    120).build().run(db);
    testFMeasure(db, result, 0.954382);
    testClusterSizes(result, new int[] { 11, 200, 203, 224 });
}
Also used : ELKIBuilder(de.lmu.ifi.dbs.elki.utilities.ELKIBuilder) Database(de.lmu.ifi.dbs.elki.database.Database) Model(de.lmu.ifi.dbs.elki.data.model.Model) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 58 with Model

use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.

the class OpenGL3DParallelCoordinates method getStylePolicy.

/**
 * Hack: Get/Create the style result.
 *
 * @return Style result
 */
public StylingPolicy getStylePolicy(ResultHierarchy hier, StyleLibrary stylelib) {
    Database db = ResultUtil.findDatabase(hier);
    AutomaticEvaluation.ensureClusteringResult(db, db);
    List<Clustering<? extends Model>> clusterings = Clustering.getClusteringResults(db);
    if (clusterings.size() > 0) {
        return new ClusterStylingPolicy(clusterings.get(0), stylelib);
    } else {
        throw new AbortException("No clustering result generated?!?");
    }
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) Model(de.lmu.ifi.dbs.elki.data.model.Model) Clustering(de.lmu.ifi.dbs.elki.data.Clustering) ClusterStylingPolicy(de.lmu.ifi.dbs.elki.visualization.style.ClusterStylingPolicy) AbortException(de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)

Example 59 with Model

use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.

the class PreDeConTest method testPreDeConResults.

/**
 * Run PreDeCon with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testPreDeConResults() {
    // Additional input parameters
    ListParameterization inp = new ListParameterization();
    inp.addParameter(AbstractDatabaseConnection.Parameterizer.FILTERS_ID, ClassLabelFilter.class);
    inp.addParameter(ClassLabelFilter.Parameterizer.CLASS_LABEL_INDEX_ID, 1);
    Database db = makeSimpleDatabase(UNITTEST + "axis-parallel-subspace-clusters-6d.csv.gz", 2500, inp);
    Clustering<Model> result = // 
    new ELKIBuilder<PreDeCon<DoubleVector>>(PreDeCon.class).with(DBSCAN.Parameterizer.EPSILON_ID, // 
    60).with(DBSCAN.Parameterizer.MINPTS_ID, // 
    40).with(PreDeCon.Settings.Parameterizer.DELTA_ID, // 
    400).with(PreDeCon.Settings.Parameterizer.KAPPA_ID, // 
    20.).with(PreDeCon.Settings.Parameterizer.LAMBDA_ID, // 
    4).build().run(db);
    // FIXME: find better working parameters?
    testFMeasure(db, result, 0.724752);
    testClusterSizes(result, new int[] { 43, 93, 108, 611, 638, 1007 });
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) Model(de.lmu.ifi.dbs.elki.data.model.Model) ListParameterization(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest) Test(org.junit.Test)

Example 60 with Model

use of de.lmu.ifi.dbs.elki.data.model.Model in project elki by elki-project.

the class DeLiCluTest method testDeLiCluResults.

/**
 * Run DeLiClu with fixed parameters and compare the result to a golden
 * standard.
 */
@Test
public void testDeLiCluResults() {
    ListParameterization indexparams = new ListParameterization();
    // We need a special index for this algorithm:
    indexparams.addParameter(StaticArrayDatabase.Parameterizer.INDEX_ID, DeLiCluTreeFactory.class);
    indexparams.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 1000);
    Database db = makeSimpleDatabase(UNITTEST + "hierarchical-2d.ascii", 710, indexparams);
    Clustering<?> clustering = // 
    new ELKIBuilder<>(OPTICSXi.class).with(DeLiClu.Parameterizer.MINPTS_ID, // 
    18).with(OPTICSXi.Parameterizer.XI_ID, // 
    0.038).with(OPTICSXi.Parameterizer.XIALG_ID, // 
    DeLiClu.class).build().run(db);
    // Test F-Measure
    Clustering<Model> rbl = new ByLabelClustering().run(db);
    ClusterContingencyTable ct = new ClusterContingencyTable(true, false);
    ct.process(clustering, rbl);
    double score = ct.getPaircount().f1Measure();
    // identical each time, the results will vary.
    if (Math.abs(score - 0.8771174) < 1e-5) {
        assertEquals("Score does not match.", 0.8771174, score, 1e-5);
    } else {
        assertEquals("Score does not match.", 0.8819664, score, 1e-5);
    }
}
Also used : Database(de.lmu.ifi.dbs.elki.database.Database) StaticArrayDatabase(de.lmu.ifi.dbs.elki.database.StaticArrayDatabase) Model(de.lmu.ifi.dbs.elki.data.model.Model) ByLabelClustering(de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering) ClusterContingencyTable(de.lmu.ifi.dbs.elki.evaluation.clustering.ClusterContingencyTable) ListParameterization(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization) Test(org.junit.Test) AbstractClusterAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)

Aggregations

Model (de.lmu.ifi.dbs.elki.data.model.Model)60 Database (de.lmu.ifi.dbs.elki.database.Database)29 Test (org.junit.Test)24 Clustering (de.lmu.ifi.dbs.elki.data.Clustering)21 Cluster (de.lmu.ifi.dbs.elki.data.Cluster)18 AbstractClusterAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)17 ClusterModel (de.lmu.ifi.dbs.elki.data.model.ClusterModel)13 ModifiableDBIDs (de.lmu.ifi.dbs.elki.database.ids.ModifiableDBIDs)12 ELKIBuilder (de.lmu.ifi.dbs.elki.utilities.ELKIBuilder)11 DBIDs (de.lmu.ifi.dbs.elki.database.ids.DBIDs)10 ArrayList (java.util.ArrayList)9 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)8 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)8 AbortException (de.lmu.ifi.dbs.elki.utilities.exceptions.AbortException)8 FiniteProgress (de.lmu.ifi.dbs.elki.logging.progress.FiniteProgress)7 HashMap (java.util.HashMap)5 ByLabelClustering (de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering)3 SubspaceModel (de.lmu.ifi.dbs.elki.data.model.SubspaceModel)3 IndefiniteProgress (de.lmu.ifi.dbs.elki.logging.progress.IndefiniteProgress)3 CorePredicate (de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.CorePredicate)2