Search in sources :

Example 66 with ListParameterization

use of de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization in project elki by elki-project.

the class KappaDistributionTest method testParameterizer.

@Test
public void testParameterizer() throws ClassInstantiationException {
    load("kappa.ascii.gz");
    ListParameterization params = new ListParameterization();
    params.addParameter(KappaDistribution.Parameterizer.LOCATION_ID, .1);
    params.addParameter(KappaDistribution.Parameterizer.SCALE_ID, .2);
    params.addParameter(KappaDistribution.Parameterizer.SHAPE1_ID, .3);
    params.addParameter(KappaDistribution.Parameterizer.SHAPE2_ID, .4);
    Distribution dist = ClassGenericsUtil.parameterizeOrAbort(KappaDistribution.class, params);
    checkPDF(dist, "pdf_scipy_01_02_03_04", 1e-14);
}
Also used : ListParameterization(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization) Test(org.junit.Test)

Example 67 with ListParameterization

use of de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization in project elki by elki-project.

the class LogisticDistributionTest method testParameterizer.

@Test
public void testParameterizer() throws ClassInstantiationException {
    load("logistic.ascii.gz");
    ListParameterization params = new ListParameterization();
    params.addParameter(LogisticDistribution.Parameterizer.LOCATION_ID, .1);
    params.addParameter(LogisticDistribution.Parameterizer.SCALE_ID, 1.);
    Distribution dist = ClassGenericsUtil.parameterizeOrAbort(LogisticDistribution.class, params);
    checkPDF(dist, "pdf_scipy_01", 1e-15);
}
Also used : ListParameterization(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization) Test(org.junit.Test)

Example 68 with ListParameterization

use of de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization in project elki by elki-project.

the class RayleighDistributionTest method testParameterizer.

@Test
public void testParameterizer() throws ClassInstantiationException {
    load("weibull.ascii.gz");
    ListParameterization params = new ListParameterization();
    params.addParameter(RayleighDistribution.Parameterizer.SCALE_ID, MathUtil.SQRTHALF);
    Distribution dist = ClassGenericsUtil.parameterizeOrAbort(RayleighDistribution.class, params);
    checkPDF(dist, "pdf_scipy_2_1", 1e-15);
    load("ray.ascii.gz");
    params = new ListParameterization();
    params.addParameter(RayleighDistribution.Parameterizer.SCALE_ID, 2);
    dist = ClassGenericsUtil.parameterizeOrAbort(RayleighDistribution.class, params);
    checkPDF(dist, "pdf_scipy_2", 1e-15);
}
Also used : ListParameterization(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization) Test(org.junit.Test)

Example 69 with ListParameterization

use of de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization 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 70 with ListParameterization

use of de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization in project elki by elki-project.

the class NNDescentTest method testPreprocessor.

@Test
public void testPreprocessor() {
    Database db = AbstractSimpleAlgorithmTest.makeSimpleDatabase(dataset, shoulds);
    Relation<DoubleVector> rel = db.getRelation(TypeUtil.DOUBLE_VECTOR_FIELD);
    DistanceQuery<DoubleVector> distanceQuery = db.getDistanceQuery(rel, EuclideanDistanceFunction.STATIC);
    // get linear queries
    LinearScanDistanceKNNQuery<DoubleVector> lin_knn_query = new LinearScanDistanceKNNQuery<>(distanceQuery);
    // get preprocessed queries
    ListParameterization config = new ListParameterization();
    config.addParameter(NNDescent.Factory.DISTANCE_FUNCTION_ID, distanceQuery.getDistanceFunction());
    config.addParameter(NNDescent.Factory.K_ID, k);
    config.addParameter(NNDescent.Factory.Parameterizer.SEED_ID, 0);
    config.addParameter(NNDescent.Factory.Parameterizer.DELTA_ID, 0.1);
    config.addParameter(NNDescent.Factory.Parameterizer.RHO_ID, 0.5);
    NNDescent.Factory<DoubleVector> preprocf = ClassGenericsUtil.parameterizeOrAbort(NNDescent.Factory.class, config);
    NNDescent<DoubleVector> preproc = preprocf.instantiate(rel);
    KNNQuery<DoubleVector> preproc_knn_query = preproc.getKNNQuery(distanceQuery, k);
    // add as index
    db.getHierarchy().add(rel, preproc);
    assertFalse("Preprocessor knn query class incorrect.", preproc_knn_query instanceof LinearScanDistanceKNNQuery);
    // test queries
    testKNNQueries(rel, lin_knn_query, preproc_knn_query, k);
    // also test partial queries, forward only
    testKNNQueries(rel, lin_knn_query, preproc_knn_query, k / 2);
}
Also used : LinearScanDistanceKNNQuery(de.lmu.ifi.dbs.elki.database.query.knn.LinearScanDistanceKNNQuery) NNDescent(de.lmu.ifi.dbs.elki.index.preprocessed.knn.NNDescent) Database(de.lmu.ifi.dbs.elki.database.Database) DoubleVector(de.lmu.ifi.dbs.elki.data.DoubleVector) ListParameterization(de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization) Test(org.junit.Test) AbstractSimpleAlgorithmTest(de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest)

Aggregations

ListParameterization (de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization)76 Test (org.junit.Test)68 AbstractIndexStructureTest (de.lmu.ifi.dbs.elki.index.AbstractIndexStructureTest)26 Database (de.lmu.ifi.dbs.elki.database.Database)10 AbstractSimpleAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest)9 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)9 LinearScanDistanceKNNQuery (de.lmu.ifi.dbs.elki.database.query.knn.LinearScanDistanceKNNQuery)8 HilbertSpatialSorter (de.lmu.ifi.dbs.elki.math.spacefillingcurves.HilbertSpatialSorter)6 SpacefillingKNNPreprocessor (de.lmu.ifi.dbs.elki.index.preprocessed.knn.SpacefillingKNNPreprocessor)5 Random (java.util.Random)3 AbstractClusterAlgorithmTest (de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest)2 Model (de.lmu.ifi.dbs.elki.data.model.Model)2 StaticArrayDatabase (de.lmu.ifi.dbs.elki.database.StaticArrayDatabase)2 InputStreamDatabaseConnection (de.lmu.ifi.dbs.elki.datasource.InputStreamDatabaseConnection)2 MaterializeKNNAndRKNNPreprocessor (de.lmu.ifi.dbs.elki.index.preprocessed.knn.MaterializeKNNAndRKNNPreprocessor)2 NormalDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution)2 NormalMOMEstimator (de.lmu.ifi.dbs.elki.math.statistics.distribution.estimator.NormalMOMEstimator)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ByLabelClustering (de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering)1