@Test public void testSingleLinkageSameResultTwoAlg() { // Dataset<? extends Instance> dataset = FakeDatasets.schoolData(); Dataset<? extends Instance> dataset = FakeDatasets.kumarData(); // use one algorithm as reference one AgglomerativeClustering alg1 = new HC(); Container ref = new HclustBenchmark().completeLinkage(alg1, dataset); ref.run(); Container other; AgglomerativeClustering alg2 = new HCLW(); other = new HclustBenchmark().completeLinkage(alg2, dataset); other.run(); System.out.println("comparing " + algorithms[0].getName() + " vs " + alg2.getName()); assertEquals(true, ref.equals(other)); }
private void compareTreeResults( Dataset<? extends Instance> dataset, String linkage, AgglomerativeClustering[] algs) { // use one algorithm as reference one Container ref = new HclustBenchmark().hclust(algs[0], dataset, linkage); ref.run(); Container other; // compare result to others for (int i = 1; i < algs.length; i++) { AgglomerativeClustering algorithm = algs[i]; other = new HclustBenchmark().hclust(algorithm, dataset, linkage); other.run(); System.out.println( "comparing " + algs[0].getName() + " vs " + algorithm.getName() + " linkage: " + linkage); assertEquals(true, ref.equals(other)); } }