Search in sources :

Example 1 with UniformContinuousUncertainObject

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

the class UniformUncertainifier method newFeatureVector.

@Override
public <A> UniformContinuousUncertainObject 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) {
            double v = adapter.getDouble(array, i);
            min[i] = v - (rand.nextDouble() * (maxDev - minDev) + minDev);
            max[i] = v + (rand.nextDouble() * (maxDev - minDev) + minDev);
        }
    }
    return new UniformContinuousUncertainObject(new HyperBoundingBox(min, max));
}
Also used : UniformContinuousUncertainObject(de.lmu.ifi.dbs.elki.data.uncertain.UniformContinuousUncertainObject) HyperBoundingBox(de.lmu.ifi.dbs.elki.data.HyperBoundingBox)

Aggregations

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