diff options
Diffstat (limited to 'test/de/lmu/ifi/dbs/elki/algorithm/clustering')
21 files changed, 0 insertions, 2143 deletions
diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestDBSCANResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestDBSCANResults.java deleted file mode 100644 index 34dd2e3d..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestDBSCANResults.java +++ /dev/null @@ -1,144 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.gdbscan.GeneralizedDBSCAN; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full DBSCAN run, and compares the result with a clustering derived - * from the data set labels. This test ensures that DBSCAN performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Elke Achtert - * @author Erich Schubert - * @author Katharina Rausch - */ -public class TestDBSCANResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run DBSCAN with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testDBSCANResults() { - Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330); - - // setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 0.04); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 20); - DBSCAN<DoubleVector, DoubleDistance> dbscan = ClassGenericsUtil.parameterizeOrAbort(DBSCAN.class, params); - testParameterizationOk(params); - - // run DBSCAN on database - Clustering<Model> result = dbscan.run(db); - - testFMeasure(db, result, 0.996413); - testClusterSizes(result, new int[] { 29, 50, 101, 150 }); - } - - /** - * Run DBSCAN with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testDBSCANOnSingleLinkDataset() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 11.5); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 120); - DBSCAN<DoubleVector, DoubleDistance> dbscan = ClassGenericsUtil.parameterizeOrAbort(DBSCAN.class, params); - testParameterizationOk(params); - - // run DBSCAN on database - Clustering<Model> result = dbscan.run(db); - testFMeasure(db, result, 0.954382); - testClusterSizes(result, new int[] { 11, 200, 203, 224 }); - } - - /** - * Run DBSCAN with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testGDBSCANResults() { - Database db = makeSimpleDatabase(UNITTEST + "3clusters-and-noise-2d.csv", 330); - - // setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 0.04); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 20); - GeneralizedDBSCAN dbscan = ClassGenericsUtil.parameterizeOrAbort(GeneralizedDBSCAN.class, params); - testParameterizationOk(params); - - // run DBSCAN on database - Clustering<Model> result = dbscan.run(db); - - testClusterSizes(result, new int[] { 29, 50, 101, 150 }); - testFMeasure(db, result, 0.996413); - } - - /** - * Run DBSCAN with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testGDBSCANOnSingleLinkDataset() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 11.5); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 120); - GeneralizedDBSCAN dbscan = ClassGenericsUtil.parameterizeOrAbort(GeneralizedDBSCAN.class, params); - testParameterizationOk(params); - - // run DBSCAN on database - Clustering<Model> result = dbscan.run(db); - testClusterSizes(result, new int[] { 11, 200, 203, 224 }); - testFMeasure(db, result, 0.954382); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestDeLiCluResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestDeLiCluResults.java deleted file mode 100644 index b70c0f67..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestDeLiCluResults.java +++ /dev/null @@ -1,90 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.trivial.ByLabelClustering; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.database.StaticArrayDatabase; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.evaluation.clustering.ClusterContingencyTable; -import de.lmu.ifi.dbs.elki.index.tree.spatial.rstarvariants.deliclu.DeLiCluTreeFactory; -import de.lmu.ifi.dbs.elki.persistent.AbstractPageFileFactory; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full DeLiClu run, and compares the result with a clustering - * derived from the data set labels. This test ensures that DeLiClu's - * performance doesn't unexpectedly drop on this data set (and also ensures that - * the algorithms work, as a side effect). - * - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestDeLiCluResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run DeLiClu with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testDeLiCluResults() { - ListParameterization indexparams = new ListParameterization(); - // We need a special index for this algorithm: - indexparams.addParameter(StaticArrayDatabase.Parameterizer.INDEX_ID, DeLiCluTreeFactory.class); - indexparams.addParameter(AbstractPageFileFactory.Parameterizer.PAGE_SIZE_ID, 1000); - Database db = makeSimpleDatabase(UNITTEST + "hierarchical-2d.ascii", 710, indexparams, null); - - // Setup actual algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(DeLiClu.MINPTS_ID, 18); - params.addParameter(OPTICSXi.XI_ID, 0.038); - params.addParameter(OPTICSXi.XIALG_ID, DeLiClu.class); - OPTICSXi<DoubleDistance> opticsxi = ClassGenericsUtil.parameterizeOrAbort(OPTICSXi.class, params); - testParameterizationOk(params); - - // run DeLiClu on database - Clustering<?> clustering = opticsxi.run(db); - - // Test F-Measure - ByLabelClustering bylabel = new ByLabelClustering(); - Clustering<Model> rbl = bylabel.run(db); - ClusterContingencyTable ct = new ClusterContingencyTable(true, false); - ct.process(clustering, rbl); - double score = ct.getPaircount().f1Measure(); - // We cannot test exactly - due to Hashing, DeLiClu sequence is not - // identical each time, the results will vary slightly. - assertEquals(this.getClass().getSimpleName() + ": Score does not match: " + score, score, 0.807415, 1E-5); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestEMResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestEMResults.java deleted file mode 100644 index 065307be..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestEMResults.java +++ /dev/null @@ -1,70 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.KMeans; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.EMModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full EM run, and compares the result with a clustering derived - * from the data set labels. This test ensures that EM's performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestEMResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run EM with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException - */ - @Test - public void testEMResults() { - Database db = makeSimpleDatabase(UNITTEST + "hierarchical-2d.ascii", 710); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.SEED_ID, 0); - params.addParameter(EM.Parameterizer.K_ID, 6); - EM<DoubleVector> em = ClassGenericsUtil.parameterizeOrAbort(EM.class, params); - testParameterizationOk(params); - - // run EM on database - Clustering<EMModel<DoubleVector>> result = em.run(db); - testFMeasure(db, result, 0.7551098); - testClusterSizes(result, new int[] { 50, 99, 102, 120, 141, 198 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestOPTICSResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestOPTICSResults.java deleted file mode 100644 index dde81a0f..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestOPTICSResults.java +++ /dev/null @@ -1,71 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full OPTICS run, and compares the result with a clustering derived - * from the data set labels. This test ensures that OPTICS's performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestOPTICSResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run OPTICS with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testOPTICSResults() { - Database db = makeSimpleDatabase(UNITTEST + "hierarchical-2d.ascii", 710); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(OPTICS.MINPTS_ID, 18); - params.addParameter(OPTICSXi.XI_ID, 0.038); - params.addParameter(OPTICSXi.XIALG_ID, OPTICS.class); - OPTICSXi<DoubleDistance> opticsxi = ClassGenericsUtil.parameterizeOrAbort(OPTICSXi.class, params); - testParameterizationOk(params); - - // run OPTICS on database - Clustering<?> clustering = opticsxi.run(db); - - testFMeasure(db, clustering, 0.874062); - testClusterSizes(clustering, new int[] { 109, 121, 210, 270 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestSNNClusteringResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestSNNClusteringResults.java deleted file mode 100644 index 302d5c0b..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/TestSNNClusteringResults.java +++ /dev/null @@ -1,72 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.index.preprocessed.snn.SharedNearestNeighborPreprocessor; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full SNNClustering run, and compares the result with a clustering - * derived from the data set labels. This test ensures that SNNClustering's - * performance doesn't unexpectedly drop on this data set (and also ensures that - * the algorithms work, as a side effect). - * - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestSNNClusteringResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run SNNClustering with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testSNNClusteringResults() { - Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d.ascii", 1200); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(SNNClustering.EPSILON_ID, 77); - params.addParameter(SNNClustering.MINPTS_ID, 28); - params.addParameter(SharedNearestNeighborPreprocessor.Factory.NUMBER_OF_NEIGHBORS_ID, 100); - SNNClustering<DoubleVector> snn = ClassGenericsUtil.parameterizeOrAbort(SNNClustering.class, params); - testParameterizationOk(params); - - // run SNN on database - Clustering<Model> result = snn.run(db); - testFMeasure(db, result, 0.832371422); - testClusterSizes(result, new int[] { 73, 228, 213, 219, 231, 236 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestCASHResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestCASHResults.java deleted file mode 100644 index 62791b68..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestCASHResults.java +++ /dev/null @@ -1,96 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.correlation; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Perform a full CASH run, and compare the result with a clustering derived - * from the data set labels. This test ensures that CASH performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Erich Schubert - * @author Katharina Rausch - */ -public class TestCASHResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run CASH with fixed parameters and compare the result to a golden standard. - */ - @Test - public void testCASHResults() { - // Input - Database db = makeSimpleDatabase(UNITTEST + "hierarchical-3d2d1d.csv", 600, new ListParameterization(), null); - - // CASH parameters - ListParameterization params = new ListParameterization(); - params.addParameter(CASH.JITTER_ID, 0.7); - params.addParameter(CASH.MINPTS_ID, 50); - params.addParameter(CASH.MAXLEVEL_ID, 25); - params.addFlag(CASH.ADJUST_ID); - - // setup algorithm - CASH<DoubleVector> cash = ClassGenericsUtil.parameterizeOrAbort(CASH.class, params); - testParameterizationOk(params); - - // run CASH on database - Clustering<Model> result = cash.run(db); - - testFMeasure(db, result, 0.490551); // with hierarchical pairs: 0.64102 - testClusterSizes(result, new int[] { 37, 71, 76, 442 }); - } - - /** - * Run CASH with fixed parameters and compare the result to a golden standard. - */ - @Test - public void testCASHEmbedded() { - // CASH input - Database db = makeSimpleDatabase(UNITTEST + "correlation-embedded-2-4d.ascii", 600, new ListParameterization(), null); - - // CASH parameters - ListParameterization params = new ListParameterization(); - params.addParameter(CASH.JITTER_ID, 0.7); - params.addParameter(CASH.MINPTS_ID, 160); - params.addParameter(CASH.MAXLEVEL_ID, 40); - - // setup algorithm - CASH<DoubleVector> cash = ClassGenericsUtil.parameterizeOrAbort(CASH.class, params); - testParameterizationOk(params); - - // run CASH on database - Clustering<Model> result = cash.run(db); - testFMeasure(db, result, 0.443246); - testClusterSizes(result, new int[] { 169, 196, 235 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestCOPACResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestCOPACResults.java deleted file mode 100644 index 94c59557..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestCOPACResults.java +++ /dev/null @@ -1,114 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.correlation; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.DBSCAN; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.index.preprocessed.localpca.KNNQueryFilteredPCAIndex; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCAFilteredRunner; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCARunner; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PercentageEigenPairFilter; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.WeightedCovarianceMatrixBuilder; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.weightfunctions.ErfcWeight; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Perform a full COPAC run, and compare the result with a clustering derived - * from the data set labels. This test ensures that COPAC performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Erich Schubert - * @author Katharina Rausch - */ -public class TestCOPACResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run COPAC with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testCOPACResults() { - Database db = makeSimpleDatabase(UNITTEST + "correlation-hierarchy.csv", 450); - - // these parameters are not picked too smartly - room for improvement. - ListParameterization params = new ListParameterization(); - params.addParameter(COPAC.PARTITION_ALGORITHM_ID, DBSCAN.class); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 0.02); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 50); - params.addParameter(COPAC.PREPROCESSOR_ID, KNNQueryFilteredPCAIndex.Factory.class); - params.addParameter(KNNQueryFilteredPCAIndex.Factory.K_ID, 15); - - COPAC<DoubleVector, DoubleDistance> copac = ClassGenericsUtil.parameterizeOrAbort(COPAC.class, params); - testParameterizationOk(params); - - // run COPAC on database - Clustering<Model> result = copac.run(db); - - testFMeasure(db, result, 0.842521); - testClusterSizes(result, new int[] { 6, 16, 32, 196, 200 }); - } - - /** - * Run COPAC with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testCOPACOverlap() { - Database db = makeSimpleDatabase(UNITTEST + "correlation-overlap-3-5d.ascii", 650); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(COPAC.PARTITION_ALGORITHM_ID, DBSCAN.class); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 0.5); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 20); - params.addParameter(COPAC.PREPROCESSOR_ID, KNNQueryFilteredPCAIndex.Factory.class); - params.addParameter(KNNQueryFilteredPCAIndex.Factory.K_ID, 45); - // PCA - params.addParameter(PCARunner.PCA_COVARIANCE_MATRIX, WeightedCovarianceMatrixBuilder.class); - params.addParameter(WeightedCovarianceMatrixBuilder.WEIGHT_ID, ErfcWeight.class); - params.addParameter(PCAFilteredRunner.PCA_EIGENPAIR_FILTER, PercentageEigenPairFilter.class); - params.addParameter(PercentageEigenPairFilter.ALPHA_ID, 0.8); - - COPAC<DoubleVector, DoubleDistance> copac = ClassGenericsUtil.parameterizeOrAbort(COPAC.class, params); - testParameterizationOk(params); - - Clustering<Model> result = copac.run(db); - testFMeasure(db, result, 0.84687864); - testClusterSizes(result, new int[] { 1, 22, 22, 29, 34, 158, 182, 202 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestERiCResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestERiCResults.java deleted file mode 100644 index 76e8cca2..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestERiCResults.java +++ /dev/null @@ -1,130 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.correlation; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.DBSCAN; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.CorrelationModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancefunction.correlation.ERiCDistanceFunction; -import de.lmu.ifi.dbs.elki.index.preprocessed.localpca.KNNQueryFilteredPCAIndex; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCAFilteredRunner; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PCARunner; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.PercentageEigenPairFilter; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.RelativeEigenPairFilter; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.WeightedCovarianceMatrixBuilder; -import de.lmu.ifi.dbs.elki.math.linearalgebra.pca.weightfunctions.ErfcWeight; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Perform a full ERiC run, and compare the result with a clustering derived - * from the data set labels. This test ensures that ERiC performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Erich Schubert - * @author Katharina Rausch - */ -public class TestERiCResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run ERiC with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testERiCResults() { - Database db = makeSimpleDatabase(UNITTEST + "hierarchical-3d2d1d.csv", 600); - - // ERiC - ListParameterization params = new ListParameterization(); - params.addParameter(COPAC.PARTITION_ALGORITHM_ID, DBSCAN.class); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 30); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 0); - // ERiC Distance function in DBSCAN: - params.addParameter(COPAC.PARTITION_DISTANCE_ID, ERiCDistanceFunction.class); - params.addParameter(ERiCDistanceFunction.DELTA_ID, 0.20); - params.addParameter(ERiCDistanceFunction.TAU_ID, 0.04); - // Preprocessing via Local PCA: - params.addParameter(COPAC.PREPROCESSOR_ID, KNNQueryFilteredPCAIndex.Factory.class); - params.addParameter(KNNQueryFilteredPCAIndex.Factory.K_ID, 50); - // PCA - params.addParameter(PCARunner.PCA_COVARIANCE_MATRIX, WeightedCovarianceMatrixBuilder.class); - params.addParameter(WeightedCovarianceMatrixBuilder.WEIGHT_ID, ErfcWeight.class); - params.addParameter(PCAFilteredRunner.PCA_EIGENPAIR_FILTER, RelativeEigenPairFilter.class); - params.addParameter(RelativeEigenPairFilter.EIGENPAIR_FILTER_RALPHA, 1.60); - - ERiC<DoubleVector> eric = ClassGenericsUtil.parameterizeOrAbort(ERiC.class, params); - testParameterizationOk(params); - - // run ERiC on database - Clustering<CorrelationModel<DoubleVector>> result = eric.run(db); - - testFMeasure(db, result, 0.714207); // Hierarchical pairs scored: 0.9204825 - testClusterSizes(result, new int[] { 109, 184, 307 }); - } - - /** - * Run ERiC with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testERiCOverlap() { - Database db = makeSimpleDatabase(UNITTEST + "correlation-overlap-3-5d.ascii", 650); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - // ERiC - params.addParameter(COPAC.PARTITION_ALGORITHM_ID, DBSCAN.class); - params.addParameter(DBSCAN.Parameterizer.MINPTS_ID, 15); - params.addParameter(DBSCAN.Parameterizer.EPSILON_ID, 0); - // ERiC Distance function in DBSCAN: - params.addParameter(COPAC.PARTITION_DISTANCE_ID, ERiCDistanceFunction.class); - params.addParameter(ERiCDistanceFunction.DELTA_ID, 1.0); - params.addParameter(ERiCDistanceFunction.TAU_ID, 1.0); - // Preprocessing via Local PCA: - params.addParameter(COPAC.PREPROCESSOR_ID, KNNQueryFilteredPCAIndex.Factory.class); - params.addParameter(KNNQueryFilteredPCAIndex.Factory.K_ID, 45); - // PCA - params.addParameter(PCARunner.PCA_COVARIANCE_MATRIX, WeightedCovarianceMatrixBuilder.class); - params.addParameter(WeightedCovarianceMatrixBuilder.WEIGHT_ID, ErfcWeight.class); - params.addParameter(PCAFilteredRunner.PCA_EIGENPAIR_FILTER, PercentageEigenPairFilter.class); - params.addParameter(PercentageEigenPairFilter.ALPHA_ID, 0.6); - - ERiC<DoubleVector> eric = ClassGenericsUtil.parameterizeOrAbort(ERiC.class, params); - testParameterizationOk(params); - - // run ERiC on database - Clustering<CorrelationModel<DoubleVector>> result = eric.run(db); - testFMeasure(db, result, 0.831136946); - testClusterSizes(result, new int[] { 29, 189, 207, 225 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestFourCResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestFourCResults.java deleted file mode 100644 index 8604a5f0..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestFourCResults.java +++ /dev/null @@ -1,98 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.correlation; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractProjectedDBSCAN; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Perform a full 4C run, and compare the result with a clustering derived from - * the data set labels. This test ensures that 4C performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Erich Schubert - * @author Katharina Rausch - */ -public class TestFourCResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run 4F with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testFourCResults() { - Database db = makeSimpleDatabase(UNITTEST + "hierarchical-3d2d1d.csv", 600); - - // Setup 4C - ListParameterization params = new ListParameterization(); - params.addParameter(AbstractProjectedDBSCAN.EPSILON_ID, 0.30); - params.addParameter(AbstractProjectedDBSCAN.MINPTS_ID, 20); - params.addParameter(AbstractProjectedDBSCAN.LAMBDA_ID, 5); - - FourC<DoubleVector> fourc = ClassGenericsUtil.parameterizeOrAbort(FourC.class, params); - testParameterizationOk(params); - - // run 4C on database - Clustering<Model> result = fourc.run(db); - - testFMeasure(db, result, 0.498048); // Hierarchical pairs scored: 0.79467 - testClusterSizes(result, new int[] { 5, 595 }); - } - - /** - * Run ERiC with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testFourCOverlap() { - Database db = makeSimpleDatabase(UNITTEST + "correlation-overlap-3-5d.ascii", 650); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - // 4C - params.addParameter(AbstractProjectedDBSCAN.EPSILON_ID, 1.2); - params.addParameter(AbstractProjectedDBSCAN.MINPTS_ID, 5); - params.addParameter(AbstractProjectedDBSCAN.LAMBDA_ID, 3); - - FourC<DoubleVector> fourc = ClassGenericsUtil.parameterizeOrAbort(FourC.class, params); - testParameterizationOk(params); - - // run 4C on database - Clustering<Model> result = fourc.run(db); - testFMeasure(db, result, 0.48305405); - testClusterSizes(result, new int[] { 65, 70, 515 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestORCLUSResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestORCLUSResults.java deleted file mode 100644 index 5cdb09c9..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/correlation/TestORCLUSResults.java +++ /dev/null @@ -1,98 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.correlation; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full ORCLUS run, and compares the result with a clustering derived - * from the data set labels. This test ensures that ORCLUS performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Elke Achtert - * @author Katharina Rausch - */ -public class TestORCLUSResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run ORCLUS with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testORCLUSResults() { - Database db = makeSimpleDatabase(UNITTEST + "correlation-hierarchy.csv", 450); - - ListParameterization params = new ListParameterization(); - params.addParameter(ORCLUS.Parameterizer.K_ID, 3); - params.addParameter(ORCLUS.Parameterizer.L_ID, 1); - params.addParameter(ORCLUS.Parameterizer.SEED_ID, 2); - - // setup algorithm - ORCLUS<DoubleVector> orclus = ClassGenericsUtil.parameterizeOrAbort(ORCLUS.class, params); - testParameterizationOk(params); - - // run ORCLUS on database - Clustering<Model> result = orclus.run(db); - - testFMeasure(db, result, 0.6361108); // Hierarchical pairs scored: 0.789113 - testClusterSizes(result, new int[] { 19, 33, 398 }); - } - - /** - * Run ORCLUS with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException on errors. - */ - @Test - public void testORCLUSSkewedDisjoint() { - Database db = makeSimpleDatabase(UNITTEST + "correlation-skewed-disjoint-3-5d.ascii", 601); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(ORCLUS.Parameterizer.K_ID, 3); - params.addParameter(ORCLUS.Parameterizer.L_ID, 4); - params.addParameter(ORCLUS.Parameterizer.SEED_ID, 9); - - ORCLUS<DoubleVector> orclus = ClassGenericsUtil.parameterizeOrAbort(ORCLUS.class, params); - testParameterizationOk(params); - - // run ORCLUS on database - Clustering<Model> result = orclus.run(db); - testFMeasure(db, result, 0.8687866); - testClusterSizes(result, new int[] { 170, 200, 231 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/TestNaiveAgglomerativeHierarchicalClustering.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/TestNaiveAgglomerativeHierarchicalClustering.java deleted file mode 100644 index 8ed18823..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/TestNaiveAgglomerativeHierarchicalClustering.java +++ /dev/null @@ -1,140 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.result.Result; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; -import de.lmu.ifi.dbs.elki.workflow.AlgorithmStep; - -/** - * Perform agglomerative hierarchical clustering, using the naive algorithm. - * - * @author Erich Schubert - */ -public class TestNaiveAgglomerativeHierarchicalClustering extends AbstractSimpleAlgorithmTest implements JUnit4Test { - // TODO: add more data sets. - - /** - * Run agglomerative hierarchical clustering with fixed parameters and compare - * the result to a golden standard. - */ - @Test - public void testSingleLink() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.OUTPUTMODE_ID, ExtractFlatClusteringFromHierarchy.OutputMode.STRICT_PARTITIONS); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.MINCLUSTERS_ID, 3); - params.addParameter(AlgorithmStep.Parameterizer.ALGORITHM_ID, NaiveAgglomerativeHierarchicalClustering.class); - params.addParameter(NaiveAgglomerativeHierarchicalClustering.Parameterizer.LINKAGE_ID, SingleLinkageMethod.class); - ExtractFlatClusteringFromHierarchy<DoubleDistance> c = ClassGenericsUtil.parameterizeOrAbort(ExtractFlatClusteringFromHierarchy.class, params); - testParameterizationOk(params); - - // run clustering algorithm on database - Result result = c.run(db); - Clustering<?> clustering = findSingleClustering(result); - testFMeasure(db, clustering, 0.6829722); - testClusterSizes(clustering, new int[] { 9, 200, 429 }); - } - - /** - * Run agglomerative hierarchical clustering with fixed parameters and compare - * the result to a golden standard. - */ - @Test - public void testWard() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.OUTPUTMODE_ID, ExtractFlatClusteringFromHierarchy.OutputMode.STRICT_PARTITIONS); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.MINCLUSTERS_ID, 3); - params.addParameter(AlgorithmStep.Parameterizer.ALGORITHM_ID, NaiveAgglomerativeHierarchicalClustering.class); - ExtractFlatClusteringFromHierarchy<DoubleDistance> c = ClassGenericsUtil.parameterizeOrAbort(ExtractFlatClusteringFromHierarchy.class, params); - testParameterizationOk(params); - - // run clustering algorithm on database - Result result = c.run(db); - Clustering<?> clustering = findSingleClustering(result); - testFMeasure(db, clustering, 0.93866265); - testClusterSizes(clustering, new int[] { 200, 211, 227 }); - } - - /** - * Run agglomerative hierarchical clustering with fixed parameters and compare - * the result to a golden standard. - */ - @Test - public void testGroupAverage() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.OUTPUTMODE_ID, ExtractFlatClusteringFromHierarchy.OutputMode.STRICT_PARTITIONS); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.MINCLUSTERS_ID, 3); - params.addParameter(AlgorithmStep.Parameterizer.ALGORITHM_ID, NaiveAgglomerativeHierarchicalClustering.class); - params.addParameter(NaiveAgglomerativeHierarchicalClustering.Parameterizer.LINKAGE_ID, GroupAverageLinkageMethod.class); - ExtractFlatClusteringFromHierarchy<DoubleDistance> c = ClassGenericsUtil.parameterizeOrAbort(ExtractFlatClusteringFromHierarchy.class, params); - testParameterizationOk(params); - - // run clustering algorithm on database - Result result = c.run(db); - Clustering<?> clustering = findSingleClustering(result); - testFMeasure(db, clustering, 0.93866265); - testClusterSizes(clustering, new int[] { 200, 211, 227 }); - } - - /** - * Run agglomerative hierarchical clustering with fixed parameters and compare - * the result to a golden standard. - */ - @Test - public void testCompleteLink() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.OUTPUTMODE_ID, ExtractFlatClusteringFromHierarchy.OutputMode.STRICT_PARTITIONS); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.MINCLUSTERS_ID, 3); - params.addParameter(AlgorithmStep.Parameterizer.ALGORITHM_ID, NaiveAgglomerativeHierarchicalClustering.class); - params.addParameter(NaiveAgglomerativeHierarchicalClustering.Parameterizer.LINKAGE_ID, CompleteLinkageMethod.class); - ExtractFlatClusteringFromHierarchy<DoubleDistance> c = ClassGenericsUtil.parameterizeOrAbort(ExtractFlatClusteringFromHierarchy.class, params); - testParameterizationOk(params); - - // run clustering algorithm on database - Result result = c.run(db); - Clustering<?> clustering = findSingleClustering(result); - testFMeasure(db, clustering, 0.938167802); - testClusterSizes(clustering, new int[] { 200, 217, 221 }); - } -} diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/TestSLINKResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/TestSLINKResults.java deleted file mode 100644 index 8b25cf9c..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/TestSLINKResults.java +++ /dev/null @@ -1,75 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.hierarchical; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.result.Result; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; -import de.lmu.ifi.dbs.elki.workflow.AlgorithmStep; - -/** - * Performs a full SLINK run, and compares the result with a clustering derived - * from the data set labels. This test ensures that SLINK's performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestSLINKResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - // TODO: add a test for a non-single-link dataset? - - /** - * Run SLINK with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testSLINKResults() { - Database db = makeSimpleDatabase(UNITTEST + "single-link-effect.ascii", 638); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.OUTPUTMODE_ID, ExtractFlatClusteringFromHierarchy.OutputMode.STRICT_PARTITIONS); - params.addParameter(ExtractFlatClusteringFromHierarchy.Parameterizer.MINCLUSTERS_ID, 3); - params.addParameter(AlgorithmStep.Parameterizer.ALGORITHM_ID, SLINK.class); - ExtractFlatClusteringFromHierarchy<DoubleDistance> slink = ClassGenericsUtil.parameterizeOrAbort(ExtractFlatClusteringFromHierarchy.class, params); - testParameterizationOk(params); - - // run SLINK on database - Result result = slink.run(db); - Clustering<?> clustering = findSingleClustering(result); - testFMeasure(db, clustering, 0.6829722); - testClusterSizes(clustering, new int[] { 9, 200, 429 }); - } -} diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansBisecting.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansBisecting.java deleted file mode 100644 index d678981d..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansBisecting.java +++ /dev/null @@ -1,90 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2013 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.quality.WithinClusterVarianceQualityMeasure; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.MeanModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Tests the KMeansBisecting - * - * @author Stephan Baier - */ -public class TestKMeansBisecting extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run KMeansBisecting with fixed parameters and compare cluster size to - * expected value. - */ - @Test - public void testKMeansBisectingClusterSize() { - Database db = makeSimpleDatabase(UNITTEST + "bisecting-test.csv", 300); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 3); - params.addParameter(BestOfMultipleKMeans.Parameterizer.TRIALS_ID, 5); - params.addParameter(BestOfMultipleKMeans.Parameterizer.KMEANS_ID, KMeansLloyd.class); - params.addParameter(BestOfMultipleKMeans.Parameterizer.QUALITYMEASURE_ID, WithinClusterVarianceQualityMeasure.class); - - KMeansBisecting<DoubleVector, DoubleDistance, MeanModel<DoubleVector>> kmeans = ClassGenericsUtil.parameterizeOrAbort(KMeansBisecting.class, params); - testParameterizationOk(params); - - // run KMedians on database - Clustering<MeanModel<DoubleVector>> result = kmeans.run(db); - testClusterSizes(result, new int[] { 103, 97, 100 }); - } - - /** - * Run KMeansBisecting with fixed parameters (k = 2) and compare f-measure to - * golden standard. - */ - @Test - public void testKMeansBisectingFMeasure() { - Database db = makeSimpleDatabase(UNITTEST + "bisecting-test.csv", 300); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 2); - params.addParameter(BestOfMultipleKMeans.Parameterizer.TRIALS_ID, 5); - params.addParameter(BestOfMultipleKMeans.Parameterizer.KMEANS_ID, KMeansLloyd.class); - params.addParameter(BestOfMultipleKMeans.Parameterizer.QUALITYMEASURE_ID, WithinClusterVarianceQualityMeasure.class); - - KMeansBisecting<DoubleVector, DoubleDistance, MeanModel<DoubleVector>> kmeans = ClassGenericsUtil.parameterizeOrAbort(KMeansBisecting.class, params); - testParameterizationOk(params); - - // run KMedians on database - Clustering<MeanModel<DoubleVector>> result = kmeans.run(db); - testFMeasure(db, result, 0.7408); - } -} diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansQualityMeasure.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansQualityMeasure.java deleted file mode 100644 index 44603617..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansQualityMeasure.java +++ /dev/null @@ -1,110 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans; - -/* - This file is part of ELKI: Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2013 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.quality.KMeansQualityMeasure; -import de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.quality.WithinClusterMeanDistanceQualityMeasure; -import de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.quality.WithinClusterVarianceQualityMeasure; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.NumberVector; -import de.lmu.ifi.dbs.elki.data.model.MeanModel; -import de.lmu.ifi.dbs.elki.data.type.TypeUtil; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.database.relation.Relation; -import de.lmu.ifi.dbs.elki.distance.distancefunction.PrimitiveDoubleDistanceFunction; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Test cluster quality measure computations. - * - * @author Stephan Baier - */ -public class TestKMeansQualityMeasure extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Test cluster variance. - */ - @Test - public void testVariance() { - Database db = makeSimpleDatabase(UNITTEST + "quality-measure-test.csv", 7); - Relation<DoubleVector> rel = db.getRelation(TypeUtil.DOUBLE_VECTOR_FIELD); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 2); - params.addParameter(KMeans.INIT_ID, FirstKInitialMeans.class); - AbstractKMeans<DoubleVector, DoubleDistance, ?> kmeans = ClassGenericsUtil.parameterizeOrAbort(KMeansLloyd.class, params); - testParameterizationOk(params); - - // run KMeans on database - @SuppressWarnings("unchecked") - Clustering<MeanModel<DoubleVector>> result2 = (Clustering<MeanModel<DoubleVector>>) kmeans.run(db); - - // Test Cluster Variance - KMeansQualityMeasure<? super DoubleVector, ? super DoubleDistance> variance = new WithinClusterVarianceQualityMeasure(); - @SuppressWarnings("unchecked") - final PrimitiveDoubleDistanceFunction<NumberVector<?>> dist = (PrimitiveDoubleDistanceFunction<NumberVector<?>>) kmeans.getDistanceFunction(); - - final double quality = variance.calculateCost(result2, dist, rel); - assertEquals("Within cluster variance incorrect", 3.16666666666, quality, 1e-10); - } - - /** - * Test cluster average overall distance. - */ - @Test - public void testOverallDistance() { - - Database db = makeSimpleDatabase(UNITTEST + "quality-measure-test.csv", 7); - Relation<DoubleVector> rel = db.getRelation(TypeUtil.DOUBLE_VECTOR_FIELD); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 2); - params.addParameter(KMeans.INIT_ID, FirstKInitialMeans.class); - AbstractKMeans<DoubleVector, DoubleDistance, ?> kmeans = ClassGenericsUtil.parameterizeOrAbort(KMeansLloyd.class, params); - testParameterizationOk(params); - - // run KMeans on database - @SuppressWarnings("unchecked") - Clustering<MeanModel<DoubleVector>> result = (Clustering<MeanModel<DoubleVector>>) kmeans.run(db); - @SuppressWarnings("unchecked") - final PrimitiveDoubleDistanceFunction<NumberVector<?>> dist = (PrimitiveDoubleDistanceFunction<NumberVector<?>>) kmeans.getDistanceFunction(); - - // Test Cluster Average Overall Distance - KMeansQualityMeasure<? super DoubleVector, ? super DoubleDistance> overall = new WithinClusterMeanDistanceQualityMeasure(); - final double quality = overall.calculateCost(result, dist, rel); - - assertEquals("Avarage overall distance not as expected.", 0.8888888888888888, quality, 1e-10); - } -} diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansResults.java deleted file mode 100644 index 3601b977..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/TestKMeansResults.java +++ /dev/null @@ -1,163 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.KMeansLloyd; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.MeanModel; -import de.lmu.ifi.dbs.elki.data.model.MedoidModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.distance.distancevalue.DoubleDistance; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full KMeans run, and compares the result with a clustering derived - * from the data set labels. This test ensures that KMeans's performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestKMeansResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run KMeans with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testKMeansLloyd() { - Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 5); - params.addParameter(KMeans.SEED_ID, 2); - AbstractKMeans<DoubleVector, DoubleDistance, ?> kmeans = ClassGenericsUtil.parameterizeOrAbort(KMeansLloyd.class, params); - testParameterizationOk(params); - - // run KMeans on database - Clustering<? extends MeanModel<DoubleVector>> result = kmeans.run(db); - testFMeasure(db, result, 0.998005); - testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 }); - } - - /** - * Run KMeans with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testKMeansMacQueen() { - Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 5); - params.addParameter(KMeans.SEED_ID, 2); - AbstractKMeans<DoubleVector, DoubleDistance, ?> kmeans = ClassGenericsUtil.parameterizeOrAbort(KMeansMacQueen.class, params); - testParameterizationOk(params); - - // run KMeans on database - Clustering<? extends MeanModel<DoubleVector>> result = kmeans.run(db); - testFMeasure(db, result, 0.998005); - testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 }); - } - - /** - * Run KMedians with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testKMediansLloyd() { - Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 5); - params.addParameter(KMeans.SEED_ID, 2); - AbstractKMeans<DoubleVector, DoubleDistance, ?> kmedians = ClassGenericsUtil.parameterizeOrAbort(KMediansLloyd.class, params); - testParameterizationOk(params); - - // run KMedians on database - Clustering<? extends MeanModel<DoubleVector>> result = kmedians.run(db); - testFMeasure(db, result, 0.998005); - testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 }); - } - - /** - * Run KMedians PAM with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testKMedoidsPAM() { - Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 5); - KMedoidsPAM<DoubleVector, DoubleDistance> kmedians = ClassGenericsUtil.parameterizeOrAbort(KMedoidsPAM.class, params); - testParameterizationOk(params); - - // run KMedians on database - Clustering<MedoidModel> result = kmedians.run(db); - testFMeasure(db, result, 0.998005); - testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 }); - } - - /** - * Run KMedoidsEM with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testKMedoidsEM() { - Database db = makeSimpleDatabase(UNITTEST + "different-densities-2d-no-noise.ascii", 1000); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(KMeans.K_ID, 5); - KMedoidsEM<DoubleVector, DoubleDistance> kmedians = ClassGenericsUtil.parameterizeOrAbort(KMedoidsEM.class, params); - testParameterizationOk(params); - - // run KMedians on database - Clustering<MedoidModel> result = kmedians.run(db); - testFMeasure(db, result, 0.998005); - testClusterSizes(result, new int[] { 199, 200, 200, 200, 201 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestCLIQUEResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestCLIQUEResults.java deleted file mode 100644 index 726efd76..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestCLIQUEResults.java +++ /dev/null @@ -1,98 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.subspace; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.SubspaceModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full CLIQUE run, and compares the result with a clustering derived - * from the data set labels. This test ensures that CLIQUE performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Elke Achtert - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestCLIQUEResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run CLIQUE with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testCLIQUEResults() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-simple.csv", 600); - - ListParameterization params = new ListParameterization(); - params.addParameter(CLIQUE.TAU_ID, "0.1"); - params.addParameter(CLIQUE.XSI_ID, 20); - - // setup algorithm - CLIQUE<DoubleVector> clique = ClassGenericsUtil.parameterizeOrAbort(CLIQUE.class, params); - testParameterizationOk(params); - - // run CLIQUE on database - Clustering<SubspaceModel<DoubleVector>> result = clique.run(db); - - // PairCounting is not appropriate here: overlapping clusterings! - // testFMeasure(db, result, 0.9882); - testClusterSizes(result, new int[] { 200, 200, 216, 400 }); - } - - /** - * Run CLIQUE with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testCLIQUESubspaceOverlapping() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-3-4d.ascii", 850); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(CLIQUE.TAU_ID, 0.2); - params.addParameter(CLIQUE.XSI_ID, 6); - CLIQUE<DoubleVector> clique = ClassGenericsUtil.parameterizeOrAbort(CLIQUE.class, params); - testParameterizationOk(params); - - // run CLIQUE on database - Clustering<SubspaceModel<DoubleVector>> result = clique.run(db); - // PairCounting is not appropriate here: overlapping clusterings! - // testFMeasure(db, result, 0.433661); - testClusterSizes(result, new int[] { 255, 409, 458, 458, 480 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestDiSHResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestDiSHResults.java deleted file mode 100644 index c7be9747..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestDiSHResults.java +++ /dev/null @@ -1,94 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.subspace; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.SubspaceModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full DiSH run, and compares the result with a clustering derived - * from the data set labels. This test ensures that DiSH performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Elke Achtert - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestDiSHResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run DiSH with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException - */ - @Test - public void testDiSHResults() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-hierarchy.csv", 450); - - ListParameterization params = new ListParameterization(); - params.addParameter(DiSH.EPSILON_ID, 0.005); - params.addParameter(DiSH.MU_ID, 50); - - // setup algorithm - DiSH<DoubleVector> dish = ClassGenericsUtil.parameterizeOrAbort(DiSH.class, params); - testParameterizationOk(params); - - // run DiSH on database - Clustering<SubspaceModel<DoubleVector>> result = dish.run(db); - - testFMeasure(db, result, 0.996976); // Hierarchical pairs scored: 0.9991258 - testClusterSizes(result, new int[] { 51, 199, 200 }); - } - - /** - * Run DiSH with fixed parameters and compare the result to a golden standard. - * - * @throws ParameterException - */ - @Test - public void testDiSHSubspaceOverlapping() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-4-5d.ascii", 1100); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(DiSH.EPSILON_ID, 0.1); - params.addParameter(DiSH.MU_ID, 30); - DiSH<DoubleVector> dish = ClassGenericsUtil.parameterizeOrAbort(DiSH.class, params); - testParameterizationOk(params); - - // run DiSH on database - Clustering<SubspaceModel<DoubleVector>> result = dish.run(db); - testFMeasure(db, result, 0.6376870); - testClusterSizes(result, new int[] { 33, 52, 72, 109, 172, 314, 348 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestP3C.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestP3C.java deleted file mode 100644 index 4d02351f..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestP3C.java +++ /dev/null @@ -1,84 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.subspace; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.SubspaceModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Test P3C on a simple test data set. - * - * Note: both data sets are really beneficial for P3C, and with reasonably - * chosen parameters, it works perfectly. - * - * @author Erich Schubert - */ -public class TestP3C extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run P3C with fixed parameters and compare the result to a golden standard. - */ - @Test - public void testP3CSimple() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-simple.csv", 600); - - ListParameterization params = new ListParameterization(); - - // setup algorithm - P3C<DoubleVector> p3c = ClassGenericsUtil.parameterizeOrAbort(P3C.class, params); - testParameterizationOk(params); - - // run P3C on database - Clustering<SubspaceModel<DoubleVector>> result = p3c.run(db); - - testFMeasure(db, result, 1.0); - testClusterSizes(result, new int[] { 200, 400 }); - } - - /** - * Run P3C with fixed parameters and compare the result to a golden standard. - */ - @Test - public void testP3COverlapping() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-3-4d.ascii", 850); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(P3C.Parameterizer.ALPHA_THRESHOLD_ID, 0.01); - P3C<DoubleVector> p3c = ClassGenericsUtil.parameterizeOrAbort(P3C.class, params); - testParameterizationOk(params); - - // run P3C on database - Clustering<SubspaceModel<DoubleVector>> result = p3c.run(db); - testFMeasure(db, result, 1.0); - testClusterSizes(result, new int[] { 150, 300, 400 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestPROCLUSResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestPROCLUSResults.java deleted file mode 100644 index bfb94ee3..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestPROCLUSResults.java +++ /dev/null @@ -1,99 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.subspace; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full PROCLUS run, and compares the result with a clustering - * derived from the data set labels. This test ensures that PROCLUS performance - * doesn't unexpectedly drop on this data set (and also ensures that the - * algorithms work, as a side effect). - * - * @author Elke Achtert - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestPROCLUSResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run PROCLUS with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testPROCLUSResults() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-simple.csv", 600); - - ListParameterization params = new ListParameterization(); - params.addParameter(PROCLUS.Parameterizer.L_ID, 1); - params.addParameter(PROCLUS.Parameterizer.K_ID, 4); - // NOTE: PROCLUS quality heavily depends on random... - params.addParameter(PROCLUS.Parameterizer.SEED_ID, 0); - - // setup algorithm - PROCLUS<DoubleVector> proclus = ClassGenericsUtil.parameterizeOrAbort(PROCLUS.class, params); - testParameterizationOk(params); - - // run PROCLUS on database - Clustering<?> result = proclus.run(db); - - testFMeasure(db, result, 0.6946958); - testClusterSizes(result, new int[] { 45, 151, 200, 204 }); - } - - /** - * Run PROCLUS with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testPROCLUSSubspaceOverlapping() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-3-4d.ascii", 850); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(PROCLUS.Parameterizer.L_ID, 2); - params.addParameter(PROCLUS.Parameterizer.K_ID, 3); - // NOTE: PROCLUS quality heavily depends on random... - params.addParameter(PROCLUS.Parameterizer.SEED_ID, 1); - PROCLUS<DoubleVector> proclus = ClassGenericsUtil.parameterizeOrAbort(PROCLUS.class, params); - testParameterizationOk(params); - - // run PROCLUS on database - Clustering<?> result = proclus.run(db); - testFMeasure(db, result, 0.7812455); - testClusterSizes(result, new int[] { 111, 269, 470 }); - } -}
\ No newline at end of file diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestPreDeConResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestPreDeConResults.java deleted file mode 100644 index d00a703f..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestPreDeConResults.java +++ /dev/null @@ -1,109 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.subspace; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.algorithm.clustering.AbstractProjectedDBSCAN; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.Model; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.datasource.filter.ClassLabelFilter; -import de.lmu.ifi.dbs.elki.index.preprocessed.subspaceproj.PreDeConSubspaceIndex.Factory; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Perform a full PreDeCon run, and compare the result with a clustering derived - * from the data set labels. This test ensures that PreDeCon performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Erich Schubert - * @author Katharina Rausch - */ -public class TestPreDeConResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run PreDeCon with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testPreDeConResults() { - // Additional input parameters - ListParameterization inp = new ListParameterization(); - inp.addParameter(ClassLabelFilter.Parameterizer.CLASS_LABEL_INDEX_ID, 1); - Class<?>[] filters = new Class<?>[] { ClassLabelFilter.class }; - Database db = makeSimpleDatabase(UNITTEST + "axis-parallel-subspace-clusters-6d.csv.gz", 2500, inp, filters); - - ListParameterization params = new ListParameterization(); - // PreDeCon - // FIXME: These parameters do NOT work... - params.addParameter(AbstractProjectedDBSCAN.EPSILON_ID, 50); - params.addParameter(AbstractProjectedDBSCAN.MINPTS_ID, 50); - params.addParameter(AbstractProjectedDBSCAN.LAMBDA_ID, 2); - - // setup algorithm - PreDeCon<DoubleVector> predecon = ClassGenericsUtil.parameterizeOrAbort(PreDeCon.class, params); - testParameterizationOk(params); - - // run PredeCon on database - Clustering<Model> result = predecon.run(db); - - // FIXME: find working parameters... - testFMeasure(db, result, 0.40153); - testClusterSizes(result, new int[] { 2500 }); - } - - /** - * Run PreDeCon with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testPreDeConSubspaceOverlapping() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-3-4d.ascii", 850); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - // PreDeCon - params.addParameter(AbstractProjectedDBSCAN.EPSILON_ID, 2.0); - params.addParameter(AbstractProjectedDBSCAN.MINPTS_ID, 7); - params.addParameter(AbstractProjectedDBSCAN.LAMBDA_ID, 4); - params.addParameter(Factory.DELTA_ID, 0.04); - PreDeCon<DoubleVector> predecon = ClassGenericsUtil.parameterizeOrAbort(PreDeCon.class, params); - testParameterizationOk(params); - - // run PredeCon on database - Clustering<Model> result = predecon.run(db); - testFMeasure(db, result, 0.6470817); - testClusterSizes(result, new int[] { 7, 10, 10, 13, 15, 16, 16, 18, 28, 131, 586 }); - } -} diff --git a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestSUBCLUResults.java b/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestSUBCLUResults.java deleted file mode 100644 index 817687c5..00000000 --- a/test/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/TestSUBCLUResults.java +++ /dev/null @@ -1,98 +0,0 @@ -package de.lmu.ifi.dbs.elki.algorithm.clustering.subspace; - -/* - This file is part of ELKI: - Environment for Developing KDD-Applications Supported by Index-Structures - - Copyright (C) 2012 - Ludwig-Maximilians-Universität München - Lehr- und Forschungseinheit für Datenbanksysteme - ELKI Development Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -import org.junit.Test; - -import de.lmu.ifi.dbs.elki.JUnit4Test; -import de.lmu.ifi.dbs.elki.algorithm.AbstractSimpleAlgorithmTest; -import de.lmu.ifi.dbs.elki.data.Clustering; -import de.lmu.ifi.dbs.elki.data.DoubleVector; -import de.lmu.ifi.dbs.elki.data.model.SubspaceModel; -import de.lmu.ifi.dbs.elki.database.Database; -import de.lmu.ifi.dbs.elki.utilities.ClassGenericsUtil; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.ParameterException; -import de.lmu.ifi.dbs.elki.utilities.optionhandling.parameterization.ListParameterization; - -/** - * Performs a full SUBCLU run, and compares the result with a clustering derived - * from the data set labels. This test ensures that SUBCLU performance doesn't - * unexpectedly drop on this data set (and also ensures that the algorithms - * work, as a side effect). - * - * @author Elke Achtert - * @author Katharina Rausch - * @author Erich Schubert - */ -public class TestSUBCLUResults extends AbstractSimpleAlgorithmTest implements JUnit4Test { - /** - * Run SUBCLU with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testSUBCLUResults() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-simple.csv", 600); - - ListParameterization params = new ListParameterization(); - params.addParameter(SUBCLU.EPSILON_ID, 0.001); - params.addParameter(SUBCLU.MINPTS_ID, 100); - - // setup algorithm - SUBCLU<DoubleVector> subclu = ClassGenericsUtil.parameterizeOrAbort(SUBCLU.class, params); - testParameterizationOk(params); - - // run SUBCLU on database - Clustering<SubspaceModel<DoubleVector>> result = subclu.run(db); - - // PairCounting is not appropriate here: overlapping clusterings! - // testFMeasure(db, result, 0.9090); - testClusterSizes(result, new int[] { 191, 194, 395 }); - } - - /** - * Run SUBCLU with fixed parameters and compare the result to a golden - * standard. - * - * @throws ParameterException - */ - @Test - public void testSUBCLUSubspaceOverlapping() { - Database db = makeSimpleDatabase(UNITTEST + "subspace-overlapping-3-4d.ascii", 850); - - // Setup algorithm - ListParameterization params = new ListParameterization(); - params.addParameter(SUBCLU.EPSILON_ID, 0.04); - params.addParameter(SUBCLU.MINPTS_ID, 70); - SUBCLU<DoubleVector> subclu = ClassGenericsUtil.parameterizeOrAbort(SUBCLU.class, params); - testParameterizationOk(params); - - // run SUBCLU on database - Clustering<SubspaceModel<DoubleVector>> result = subclu.run(db); - // PairCounting is not appropriate here: overlapping clusterings! - // testFMeasure(db, result, 0.49279033); - testClusterSizes(result, new int[] { 99, 247, 303, 323, 437, 459 }); - } -}
\ No newline at end of file |