1 /* 2 * This file is part of ELKI: 3 * Environment for Developing KDD-Applications Supported by Index-Structures 4 * 5 * Copyright (C) 2018 6 * ELKI Development Team 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Affero General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU Affero General Public License for more details. 17 * 18 * You should have received a copy of the GNU Affero General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 */ 21 package de.lmu.ifi.dbs.elki.algorithm.clustering.correlation; 22 23 import org.junit.Test; 24 25 import de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractClusterAlgorithmTest; 26 import de.lmu.ifi.dbs.elki.data.Clustering; 27 import de.lmu.ifi.dbs.elki.data.DoubleVector; 28 import de.lmu.ifi.dbs.elki.data.model.Model; 29 import de.lmu.ifi.dbs.elki.database.Database; 30 import de.lmu.ifi.dbs.elki.utilities.ELKIBuilder; 31 32 /** 33 * Performs a full ORCLUS run, and compares the result with a clustering derived 34 * from the data set labels. This test ensures that ORCLUS performance doesn't 35 * unexpectedly drop on this data set (and also ensures that the algorithms 36 * work, as a side effect). 37 * 38 * @author Elke Achtert 39 * @author Katharina Rausch 40 * @since 0.7.0 41 */ 42 public class ORCLUSTest extends AbstractClusterAlgorithmTest { 43 /** 44 * Run ORCLUS with fixed parameters and compare the result to a golden 45 * standard. 46 */ 47 @Test testORCLUSResults()48 public void testORCLUSResults() { 49 Database db = makeSimpleDatabase(UNITTEST + "correlation-hierarchy.csv", 450); 50 Clustering<Model> result = new ELKIBuilder<ORCLUS<DoubleVector>>(ORCLUS.class) // 51 .with(ORCLUS.Parameterizer.K_ID, 3) // 52 .with(ORCLUS.Parameterizer.L_ID, 1) // 53 .with(ORCLUS.Parameterizer.SEED_ID, 1) // 54 .build().run(db); 55 testFMeasure(db, result, 0.627537295); 56 testClusterSizes(result, new int[] { 25, 34, 391 }); 57 } 58 59 /** 60 * Run ORCLUS with fixed parameters and compare the result to a golden 61 * standard. 62 */ 63 @Test testORCLUSSkewedDisjoint()64 public void testORCLUSSkewedDisjoint() { 65 Database db = makeSimpleDatabase(UNITTEST + "correlation-skewed-disjoint-3-5d.ascii", 601); 66 Clustering<Model> result = new ELKIBuilder<ORCLUS<DoubleVector>>(ORCLUS.class) // 67 .with(ORCLUS.Parameterizer.K_ID, 3) // 68 .with(ORCLUS.Parameterizer.L_ID, 4) // 69 .with(ORCLUS.Parameterizer.SEED_ID, 0) // 70 .build().run(db); 71 testFMeasure(db, result, 0.848054); 72 testClusterSizes(result, new int[] { 189, 200, 212 }); 73 } 74 } 75