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);
}
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);
}
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);
}
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 });
}
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);
}
Aggregations