Package de.lmu.ifi.dbs.elki.evaluation.clustering

Examples of de.lmu.ifi.dbs.elki.evaluation.clustering.ClusterContingencyTable


    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.
    org.junit.Assert.assertTrue(this.getClass().getSimpleName() + ": Score does not match: " + score, score > 0.85);
  }
View Full Code Here


    assertEquals(0.5 /* 0.3834296724470135 */, computeFMeasure(rai, rbl, false), Double.MIN_VALUE);
  }

  private double computeFMeasure(Clustering<?> c1, Clustering<?> c2, boolean noise) {
    ClusterContingencyTable ct = new ClusterContingencyTable(true, noise);
    ct.process(c1, c2);
    return ct.getPaircount().f1Measure();
  }
View Full Code Here

  protected <O> void testFMeasure(Database database, Clustering<?> clustering, double expected) {
    // Run by-label as reference
    ByLabelClustering bylabel = new ByLabelClustering();
    Clustering<Model> rbl = bylabel.run(database);

    ClusterContingencyTable ct = new ClusterContingencyTable(true, false);
    ct.process(clustering, rbl);
    double score = ct.getPaircount().f1Measure();
    if(logger.isVerbose()) {
      logger.verbose(this.getClass().getSimpleName() + " score: " + score + " expect: " + expected);
    }
    org.junit.Assert.assertEquals(this.getClass().getSimpleName() + ": Score does not match.", expected, score, 0.0001);
  }
View Full Code Here

   
    double ypos = -.5; // Skip space before first header
    SVGPlot svgp = task.getPlot();
    Element parent = svgp.svgElement(SVGConstants.SVG_G_TAG);
    EvaluateClustering.ScoreResult sr = task.getResult();
    ClusterContingencyTable cont = sr.getContingencyTable();

    List<Result> parents = task.getContext().getHierarchy().getParents(sr);

    for(Result r : parents) {
      if(r instanceof Clustering) {
        ypos = addHeader(svgp, parent, ypos, r.getLongName());
      }
    }
    // TODO: use CSSClass and StyleLibrary

    ypos = addHeader(svgp, parent, ypos, "Pair counting measures");

    PairCounting paircount = cont.getPaircount();
    ypos = addBarChart(svgp, parent, ypos, "Jaccard", 1, paircount.jaccard());
    ypos = addBarChart(svgp, parent, ypos, "F1-Measure", 1, paircount.f1Measure());
    ypos = addBarChart(svgp, parent, ypos, "Precision", 1, paircount.precision());
    ypos = addBarChart(svgp, parent, ypos, "Recall", 1, paircount.recall());
    ypos = addBarChart(svgp, parent, ypos, "Rand", 1, paircount.randIndex());
    ypos = addBarChart(svgp, parent, ypos, "ARI", 1, paircount.adjustedRandIndex());
    ypos = addBarChart(svgp, parent, ypos, "FowlkesMallows", 1, paircount.fowlkesMallows());

    ypos = addHeader(svgp, parent, ypos, "Entropy based measures");

    Entropy entropy = cont.getEntropy();
    ypos = addBarChart(svgp, parent, ypos, "NMI Joint", 1, entropy.entropyNMIJoint());
    ypos = addBarChart(svgp, parent, ypos, "NMI Sqrt", 1, entropy.entropyNMISqrt());

    ypos = addHeader(svgp, parent, ypos, "BCubed-based measures");

    BCubed bcubed = cont.getBCubed();
    ypos = addBarChart(svgp, parent, ypos, "F1-Measure", 1, bcubed.f1Measure());
    ypos = addBarChart(svgp, parent, ypos, "Recall", 1, bcubed.recall());
    ypos = addBarChart(svgp, parent, ypos, "Precision", 1, bcubed.precision());

    ypos = addHeader(svgp, parent, ypos, "Set-Matching-based measures");

    SetMatchingPurity setm = cont.getSetMatching();
    ypos = addBarChart(svgp, parent, ypos, "F1-Measure", 1, setm.f1Measure());
    ypos = addBarChart(svgp, parent, ypos, "Purity", 1, setm.purity());
    ypos = addBarChart(svgp, parent, ypos, "Inverse Purity", 1, setm.inversePurity());

    ypos = addHeader(svgp, parent, ypos, "Editing-distance measures");

    EditDistance edit = cont.getEdit();
    ypos = addBarChart(svgp, parent, ypos, "F1-Measure", 1, edit.f1Measure());
    ypos = addBarChart(svgp, parent, ypos, "Precision", 1, edit.editDistanceFirst());
    ypos = addBarChart(svgp, parent, ypos, "Recall", 1, edit.editDistanceSecond());

    ypos = addHeader(svgp, parent, ypos, "Gini measures");

    final MeanVariance gini = cont.averageSymmetricGini();
    ypos = addBarChart(svgp, parent, ypos, "Mean +-" + FormatUtil.format(gini.getSampleStddev(), FormatUtil.NF4), 1, gini.getMean());

    // scale vis
    double cols = 10; // Math.max(10, (int) (i * task.getHeight() /
    // task.getWidth()));
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.evaluation.clustering.ClusterContingencyTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.