Search in sources :

Example 1 with SimpleGaussianContinuousUncertainObject

use of de.lmu.ifi.dbs.elki.data.uncertain.SimpleGaussianContinuousUncertainObject in project elki by elki-project.

the class SimpleGaussianUncertainifier method newFeatureVector.

@Override
public <A> SimpleGaussianContinuousUncertainObject newFeatureVector(Random rand, A array, NumberArrayAdapter<?, A> adapter) {
    final int dim = adapter.size(array);
    double[] min = new double[dim], max = new double[dim];
    if (symmetric) {
        for (int i = 0; i < dim; ++i) {
            double v = adapter.getDouble(array, i);
            double width = rand.nextDouble() * (maxDev - minDev) + minDev;
            min[i] = v - width;
            max[i] = v + width;
        }
    } else {
        for (int i = 0; i < dim; ++i) {
            // Choose standard deviation
            final double s = rand.nextDouble() * (maxDev - minDev) + minDev;
            // Assume our center is off by a standard deviation of s.
            double v = adapter.getDouble(array, i) + rand.nextGaussian() * s;
            min[i] = v - s;
            max[i] = v + s;
        }
    }
    return new SimpleGaussianContinuousUncertainObject(new HyperBoundingBox(min, max));
}
Also used : HyperBoundingBox(de.lmu.ifi.dbs.elki.data.HyperBoundingBox) SimpleGaussianContinuousUncertainObject(de.lmu.ifi.dbs.elki.data.uncertain.SimpleGaussianContinuousUncertainObject)

Aggregations

HyperBoundingBox (de.lmu.ifi.dbs.elki.data.HyperBoundingBox)1 SimpleGaussianContinuousUncertainObject (de.lmu.ifi.dbs.elki.data.uncertain.SimpleGaussianContinuousUncertainObject)1