PlasmonaOutlierEliminator implements OutlierEliminator<T> { @Override public Set<T> removeOutliers(final Set<T> candidateSet) { if (candidateSet.size() <= 2) { return candidateSet; } final PointList candidates = new PointList(pointFactory, candidateSet); final List<PointDoublePair> centroidDistances = calculateCentroidDistances(candidates); final List<PointDoublePair> medianDistanceDivergences = calculateDistanceDivergences(centroidDistances); removeOutliers(medianDistanceDivergences, candidateSet); return candidateSet; } PlasmonaOutlierEliminator(PointFactory factory); @Override Set<T> removeOutliers(final Set<T> candidateSet);  }
@Test public void testThatTheOutlierIsRemovedWhenItIsObviousThatItIsAnOutlierWithTheOutlierAddedInTheMiddleOfTheMap() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesWithAnObviousOutlierInTheMiddleOfTheMap(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesWithAnObviousOutlierInTheMiddleOfTheMapExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Ignore("The algorithm does not yet seem to handle this case correctly.") @Test public void testThatGeoPointsPlacedInASquareHaveNoOutliers() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesPlacedInASquare(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesPlacedInASquareExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Ignore("The algorithm does not yet seem to handle this case correctly.") @Test public void testThatFourGeoPointsPlacedInASquareAndOnePlacedInTheMiddleHaveNoOutliers() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesPlacedInASquareAndOnePlacedInTheMiddle(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesPlacedInASquareAndOnePlacedInTheMiddleExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void testThatAnOutlierFarAwayFromGeoPointsPlacedInASquareIsDetectedProperly() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesPlacedInASquareAndOnePlacedFarAway(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesPlacedInASquareAndOnePlacedFarAwayExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void testRasterCoordinates() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesRasterCoordinates(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesRasterCoordinatesExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void test() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesTest(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesTestExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Ignore("The algorithm does not yet seem to handle this case correctly.") @Test public void testThat2PointsFarAwayFromAnother2PointsHaveNoOutliers() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesTwoPointsFarAwayFromAnotherTwoPoints(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesTwoPointsFarAwayFromAnotherTwoPointsExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void testThat2PointsFarAwayFrom3PointsNearToEachAreDetectedAsOutliers() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesTwoPointsFarAwayFromThreePointsNearToEachOther(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesTwoPointsFarAwayFromThreePointsNearToEachOtherExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void testThatOutliersFromARealMapAreDetected() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesOutliersFromARealMap(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesOutliersFromARealMapExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void testThatNoPointIsEliminatedWhenTheTotalAmountOfPointsIsToSmall() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesTooSmallAmount(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesTooSmallAmountExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }
@Test public void testThatTheOutlierIsRemovedWhenItIsObviousThatItIsAnOutlierWithVaryingGeoPoints() throws NicTrackerException { final Set<NicGeoPoint> geoPointsIn = CandidateFixtures.createCandidatesWithAnObviousOutlier(); final Set<NicGeoPoint> expected = CandidateFixtures.createCandidatesWithAnObviousOutlierExpected(); final Set<NicGeoPoint> geoPointsOut = poe.removeOutliers(geoPointsIn); assertEquals(expected, geoPointsOut); }