@Test public void ピアソンの相関係数() { Critics critics = new Critics(); SimilarityCalculator calculator = new PearsonCorrelationCalculator(); Double expected = 0.396059017191; Double actual = calculator.calc(critics.of(Persons.LISA_ROSE), critics.of(Persons.GENE_SEYMOUR)); assertTrue(Math.abs(expected - actual) < 0.0001); }
@Test public void ユークリッド距離() { Critics critics = new Critics(); SimilarityCalculator calculator = new EucridDistanceCalculator(); Double expected = 0.148148148148; Double actual = calculator.calc(critics.of(Persons.LISA_ROSE), critics.of(Persons.GENE_SEYMOUR)); assertTrue(Math.abs(expected - actual) < 0.0001); }