Search in sources :

Example 1 with SimpleInterpolationVisitor

use of com.amazon.randomcutforest.interpolation.SimpleInterpolationVisitor in project random-cut-forest-by-aws by aws.

the class RandomCutForest method getSimpleDensity.

public DensityOutput getSimpleDensity(float[] point) {
    if (!samplersFull()) {
        return new DensityOutput(dimensions, sampleSize);
    }
    IVisitorFactory<InterpolationMeasure> visitorFactory = new VisitorFactory<>((tree, y) -> new SimpleInterpolationVisitor(tree.projectToTree(y), sampleSize, 1.0, centerOfMassEnabled), (tree, x) -> x.lift(tree::liftFromTree));
    Collector<InterpolationMeasure, ?, InterpolationMeasure> collector = InterpolationMeasure.collector(dimensions, sampleSize, numberOfTrees);
    return new DensityOutput(traverseForest(transformToShingledPoint(point), visitorFactory, collector));
}
Also used : DensityOutput(com.amazon.randomcutforest.returntypes.DensityOutput) SimpleInterpolationVisitor(com.amazon.randomcutforest.interpolation.SimpleInterpolationVisitor) InterpolationMeasure(com.amazon.randomcutforest.returntypes.InterpolationMeasure)

Aggregations

SimpleInterpolationVisitor (com.amazon.randomcutforest.interpolation.SimpleInterpolationVisitor)1 DensityOutput (com.amazon.randomcutforest.returntypes.DensityOutput)1 InterpolationMeasure (com.amazon.randomcutforest.returntypes.InterpolationMeasure)1