use of org.locationtech.geowave.analytic.clustering.LongCentroid in project geowave by locationtech.
the class StripWeakCentroidsRunnerTest method testStable1.
@Test
public void testStable1() throws Exception {
final List<AnalyticItemWrapper<Long>> list = new ArrayList<>();
final int[] cnts = new int[] { 1000, 851, 750, 650, 525, 200, 100, 90, 70 };
for (int i = 0; i < cnts.length; i++) {
list.add(new LongCentroid(i, "", cnts[i]));
}
final StableChangeBreakStrategy<Long> breakS = new StableChangeBreakStrategy<>();
assertEquals(5, breakS.getBreakPoint(list));
}
use of org.locationtech.geowave.analytic.clustering.LongCentroid in project geowave by locationtech.
the class StripWeakCentroidsRunnerTest method testMaxUniform.
@Test
public void testMaxUniform() throws Exception {
final List<AnalyticItemWrapper<Long>> list = new ArrayList<>();
final int[] cnts = new int[] { 1000, 851, 750, 650, 525, 200, 90, 70 };
for (int i = 0; i < cnts.length; i++) {
list.add(new LongCentroid(i, "", cnts[i]));
}
final TailMaxBreakStrategy<Long> breakS = new TailMaxBreakStrategy<>();
assertEquals(5, breakS.getBreakPoint(list));
}
use of org.locationtech.geowave.analytic.clustering.LongCentroid in project geowave by locationtech.
the class CentroidAssociationFnTest method test.
@Test
public void test() {
final CentroidAssociationFn<Long> fn = new CentroidAssociationFn<>();
fn.setDistanceFunction(new DistanceFn<Long>() {
/**
*/
private static final long serialVersionUID = 1L;
@Override
public double measure(final Long x, final Long y) {
return Math.abs(x.longValue() - y.longValue());
}
});
final List<AnalyticItemWrapper<Long>> dataSet = Arrays.asList((AnalyticItemWrapper<Long>) new LongCentroid(345, "", 0), new LongCentroid(764, "", 0), new LongCentroid(89, "", 0), new LongCentroid(900, "", 0));
final List<AnalyticItemWrapper<Long>> centroidSet = Arrays.asList((AnalyticItemWrapper<Long>) new LongCentroid(10, "", 0), (AnalyticItemWrapper<Long>) new LongCentroid(1000, "", 0));
final double cost = fn.compute(dataSet, centroidSet, new AssociationNotification<Long>() {
@Override
public void notify(final CentroidPairing<Long> pairing) {
Assert.assertTrue(expectedPairings.contains(pairing));
}
});
Assert.assertEquals(expectedCost, cost, 0.0001);
}
use of org.locationtech.geowave.analytic.clustering.LongCentroid in project geowave by locationtech.
the class StripWeakCentroidsRunnerTest method testMaxDense.
@Test
public void testMaxDense() throws Exception {
final List<AnalyticItemWrapper<Long>> list = new ArrayList<>();
final int[] cnts = new int[] { 900, 600, 800 };
for (int i = 0; i < cnts.length; i++) {
list.add(new LongCentroid(i, "", cnts[i]));
}
final TailMaxBreakStrategy<Long> breakS = new TailMaxBreakStrategy<>();
assertEquals(3, breakS.getBreakPoint(list));
}
use of org.locationtech.geowave.analytic.clustering.LongCentroid in project geowave by locationtech.
the class StripWeakCentroidsRunnerTest method testStableUniform.
@Test
public void testStableUniform() throws Exception {
final List<AnalyticItemWrapper<Long>> list = new ArrayList<>();
final int[] cnts = new int[] { 1000, 851, 750, 650, 525, 200, 100, 90, 70 };
for (int i = 0; i < cnts.length; i++) {
list.add(new LongCentroid(i, "", cnts[i]));
}
final TailStableChangeBreakStrategy<Long> breakS = new TailStableChangeBreakStrategy<>();
assertEquals(5, breakS.getBreakPoint(list));
}
Aggregations