@Test public void testIris() throws ScoreException { double scoreBetter = subject.score(FakeClustering.iris()); double scoreWorser = subject.score(FakeClustering.irisWrong4()); // should recognize better clustering assertEquals(true, subject.isBetter(scoreBetter, scoreWorser)); }
/** Test of score method, of class NMI. */ @Test public void testScore_Clustering_Dataset() throws ScoreException { measure(FakeClustering.iris(), 1.0); double score = measure(irisWrong, 0.6545182434318744); double score2 = measure(FakeClustering.irisWrong(), irisCorrect, 0.06793702240876041); assertTrue(score2 < score); }
/** Test of score method, of class NMI. */ @Test public void testScore_Clustering_Clustering() throws ScoreException { // this is fixed clustering which correspods to true classes in dataset measure(FakeClustering.iris(), FakeClustering.iris(), 1.0); double score = measure(irisWrong, irisCorrect, 0.6496820278112178); double score2 = measure(FakeClustering.irisWrong(), irisCorrect, 0.06793702240876041); assertTrue(score2 < score); }
/** Test of score method, of class F-measure. */ @Test public void testScore_Clustering_Dataset() throws ScoreException { double score; // each cluster should have this scores: // Cabernet = 0.7200 // Syrah = 0.5555 // Pinot = 0.7272 score = measure(FakeClustering.wineClustering(), FakeClustering.wineCorrect(), 0.48132780082987553); // when using class labels result should be the same measure(FakeClustering.wineClustering(), score); }
public ExternalTest() { ext100p2 = FakeClustering.ext100p2(); ext100p3 = FakeClustering.ext100p3(); }
public NMIsqrtTest() throws FileNotFoundException, IOException { irisCorrect = FakeClustering.iris(); irisWrong = FakeClustering.irisWrong2(); subject = new NMIsqrt(); }
@Test public void testMostlyWrong() throws ScoreException { double score = subject.score(FakeClustering.irisMostlyWrong()); System.out.println("f-measure (mw) = " + score); assertEquals(true, score < 0.5); }
/** * Check against definition (and tests in R package clusterCrit) * https://cran.r-project.org/web/packages/clusterCrit/index.html * * <p>NOTE: There's a small problem with precision of floating point operations. First 7 decimal * digits seems to match. */ @Test public void testClusterCrit() throws ScoreException { double score = subject.score(FakeClustering.int100p4()); // clustCrit: 105.942129943902 assertEquals(105.942129943902, score, delta); }