Search in sources :

Example 11 with NormalDistribution

use of de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution in project elki by elki-project.

the class NormalLMMEstimatorTest method testEstimator.

@Test
public void testEstimator() {
    final NormalLMMEstimator est = instantiate(NormalLMMEstimator.class, NormalDistribution.class);
    load("norm.ascii.gz");
    double[] data = this.data.get("random_01_01");
    NormalDistribution dist = est.estimate(data, DoubleArrayAdapter.STATIC);
    assertStat("mean", dist.getMean(), 0.1, -0.01038465173940939);
    assertStat("stddev", dist.getStddev(), 0.1, -0.008827779497812646);
    data = this.data.get("random_0_1");
    dist = est.estimate(data, DoubleArrayAdapter.STATIC);
    assertStat("mean", dist.getMean(), 0., -0.02278981436658599);
    assertStat("stddev", dist.getStddev(), 1., -0.02088104864887541);
    data = this.data.get("random_1_3");
    dist = est.estimate(data, DoubleArrayAdapter.STATIC);
    assertStat("mean", dist.getMean(), 1., -0.4189550588142462);
    assertStat("stddev", dist.getStddev(), 3., 0.24292144344037636);
}
Also used : NormalDistribution(de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution) Test(org.junit.Test)

Aggregations

NormalDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.NormalDistribution)11 Test (org.junit.Test)8 Random (java.util.Random)5 Distribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.Distribution)3 UniformDistribution (de.lmu.ifi.dbs.elki.math.statistics.distribution.UniformDistribution)2 NormalMOMEstimator (de.lmu.ifi.dbs.elki.math.statistics.distribution.estimator.NormalMOMEstimator)2 ListParameterization (de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization)2 DoubleVector (de.lmu.ifi.dbs.elki.data.DoubleVector)1 IntegerVector (de.lmu.ifi.dbs.elki.data.IntegerVector)1 Model (de.lmu.ifi.dbs.elki.data.model.Model)1 GeneratorSingleCluster (de.lmu.ifi.dbs.elki.data.synthetic.bymodel.GeneratorSingleCluster)1 FieldTypeInformation (de.lmu.ifi.dbs.elki.data.type.FieldTypeInformation)1 WritableDoubleDataStore (de.lmu.ifi.dbs.elki.database.datastore.WritableDoubleDataStore)1 DBIDIter (de.lmu.ifi.dbs.elki.database.ids.DBIDIter)1 DoubleRelation (de.lmu.ifi.dbs.elki.database.relation.DoubleRelation)1 MaterializedDoubleRelation (de.lmu.ifi.dbs.elki.database.relation.MaterializedDoubleRelation)1 AbstractDataSourceTest (de.lmu.ifi.dbs.elki.datasource.AbstractDataSourceTest)1 MultipleObjectsBundle (de.lmu.ifi.dbs.elki.datasource.bundle.MultipleObjectsBundle)1 ReplaceNaNWithRandomFilter (de.lmu.ifi.dbs.elki.datasource.filter.cleaning.ReplaceNaNWithRandomFilter)1 MeanVariance (de.lmu.ifi.dbs.elki.math.MeanVariance)1