diff options
Diffstat (limited to 'test/de/lmu/ifi/dbs/elki/evaluation/TestComputeROC.java')
-rw-r--r-- | test/de/lmu/ifi/dbs/elki/evaluation/TestComputeROC.java | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/test/de/lmu/ifi/dbs/elki/evaluation/TestComputeROC.java b/test/de/lmu/ifi/dbs/elki/evaluation/TestComputeROC.java index 46adb1bb..2ad7c11f 100644 --- a/test/de/lmu/ifi/dbs/elki/evaluation/TestComputeROC.java +++ b/test/de/lmu/ifi/dbs/elki/evaluation/TestComputeROC.java @@ -1,5 +1,28 @@ package de.lmu.ifi.dbs.elki.evaluation; +/* + This file is part of ELKI: + Environment for Developing KDD-Applications Supported by Index-Structures + + Copyright (C) 2011 + 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 java.util.ArrayList; import java.util.List; @@ -19,7 +42,7 @@ import de.lmu.ifi.dbs.elki.utilities.pairs.Pair; * Test to validate ROC curve computation. * * @author Erich Schubert - * + * */ public class TestComputeROC implements JUnit4Test { /** @@ -33,7 +56,7 @@ public class TestComputeROC implements JUnit4Test { positive.add(DBIDUtil.importInteger(3)); positive.add(DBIDUtil.importInteger(4)); positive.add(DBIDUtil.importInteger(5)); - + ArrayList<Pair<Double, DBID>> distances = new ArrayList<Pair<Double, DBID>>(); distances.add(new Pair<Double, DBID>(0.0, DBIDUtil.importInteger(1))); distances.add(new Pair<Double, DBID>(1.0, DBIDUtil.importInteger(2))); @@ -44,11 +67,11 @@ public class TestComputeROC implements JUnit4Test { distances.add(new Pair<Double, DBID>(4.0, DBIDUtil.importInteger(4))); distances.add(new Pair<Double, DBID>(5.0, DBIDUtil.importInteger(9))); distances.add(new Pair<Double, DBID>(6.0, DBIDUtil.importInteger(5))); - + List<DoubleDoublePair> roccurve = ROC.materializeROC(9, positive, distances.iterator()); // System.out.println(roccurve); Assert.assertEquals("ROC curve too complex", 6, roccurve.size()); - + double auc = ROC.computeAUC(roccurve); Assert.assertEquals("ROC AUC not right.", 0.6, auc, 0.0001); } |