use of com.amazon.randomcutforest.returntypes.DensityOutput in project random-cut-forest-by-aws by aws.
the class RandomCutForestShingledBenchmark method basicDensityAndUpdate.
@Benchmark
@OperationsPerInvocation(DATA_SIZE)
public RandomCutForest basicDensityAndUpdate(BenchmarkState state, Blackhole blackhole) {
double[][] data = state.data;
forest = state.forest;
DensityOutput output = new DensityOutput(forest.getDimensions(), forest.getSampleSize());
for (int i = INITIAL_DATA_SIZE; i < data.length; i++) {
output = forest.getSimpleDensity(data[i]);
forest.update(data[i]);
}
blackhole.consume(output);
return forest;
}
use of com.amazon.randomcutforest.returntypes.DensityOutput in project random-cut-forest-by-aws by aws.
the class RandomCutForestFunctionalTest method testSimpleDensity.
@ParameterizedTest
@ArgumentsSource(TestForestProvider.class)
public void testSimpleDensity(RandomCutForest forest) {
DensityOutput output1 = forest.getSimpleDensity(new double[] { 0.0, 0.0, 0.0 });
DensityOutput output2 = forest.getSimpleDensity(new double[] { 6.0, 6.0, 0.0 });
DensityOutput output3 = forest.getSimpleDensity(new double[] { -4.0, -4.0, 0.0 });
DensityOutput output4 = forest.getSimpleDensity(new double[] { -6.0, -6.0, 0.0 });
assertTrue(output1.getDensity(0.001, 3) > output2.getDensity(0.001, 3));
assertTrue(output1.getDensity(0.001, 3) > output3.getDensity(0.001, 3));
assertTrue(output1.getDensity(0.001, 3) > output4.getDensity(0.001, 3));
assertTrue(output3.getDensity(0.001, 3) > output4.getDensity(0.001, 3));
}
use of com.amazon.randomcutforest.returntypes.DensityOutput in project random-cut-forest-by-aws by aws.
the class RandomCutForestBenchmark method basicDensityAndUpdate.
@Benchmark
@OperationsPerInvocation(DATA_SIZE)
public RandomCutForest basicDensityAndUpdate(BenchmarkState state, Blackhole blackhole) {
double[][] data = state.data;
forest = state.forest;
DensityOutput output = new DensityOutput(forest.getDimensions(), forest.getSampleSize());
for (int i = INITIAL_DATA_SIZE; i < data.length; i++) {
output = forest.getSimpleDensity(data[i]);
forest.update(data[i]);
}
blackhole.consume(output);
return forest;
}
Aggregations