Package net.sf.collabreview.core.toolbox

Examples of net.sf.collabreview.core.toolbox.Correlation


    resultString += names + "\n" + scoreString + "\n";
  }

  private void computeGlobalCorrelation() {
    setStatusInfo("computing one-shot correlations");
    Correlation globalResults = correlateQualityPredictions(listArtifacts(), collabReview.getReputationMetricManager());
    globalResults.sortByX();
    resultString += String.format(Locale.US, "One-shot Pearson r=%.2f, one-shot Spearman rho=%.2f\n", globalResults.getPearsonCorrelation(), globalResults.getSpearmanCorrelation());
    String assessedValues = "";
    String predictedValues = "";
    for (Correlation.RowData data : globalResults.listRowData()) {
      assessedValues += String.format(Locale.US, "%6.2f,", data.getX());
      predictedValues += String.format(Locale.US, "%6.2f,", data.getY());
    }
    resultString += "Assessed values:  " + assessedValues + "\n";
    resultString += "Predicted values: " + predictedValues + "\n";
View Full Code Here


    double bad5Recall = 0;
    double bad5Precision = 0;
    for (int i = 0; i < partitionCount; i++) {
      setStatusInfo("validation iteration " + i);
      ReputationMetricManager rmm = computePartitionReputations(i);
      Correlation localResults = correlateQualityPredictions(filter.getPartitions().get(i), rmm);
      resultString += String.format(Locale.US, "Partition %d (%d artifacts): " +
          "Pearson r=%+.2f, Spearman r=%+.2f, " +
          "Top10Recall=%.2f, Top10Precision=%.2f, " +
          "Bad10Recall=%.2f, Bad10Precision=%.2f, " +
          "\n",
          i, filter.getPartitions().get(i).size(),
          localResults.getPearsonCorrelation(), localResults.getSpearmanCorrelation(),
          localResults.topPercentRecall(0.1), localResults.topPercentPrecision(0.1),
          localResults.badPercentRecall(0.1), localResults.badPercentPrecision(0.1)
      );
      spearman += localResults.getSpearmanCorrelation() / partitionCount;
      pearson += localResults.getPearsonCorrelation() / partitionCount;
      top20Recall += localResults.topPercentRecall(0.2) / partitionCount;
      top20Precision += localResults.topPercentRecall(0.2) / partitionCount;
      bad20Recall += localResults.badPercentRecall(0.2) / partitionCount;
      bad20Precision += localResults.badPercentPrecision(0.2) / partitionCount;
      top10Recall += localResults.topPercentRecall(0.1) / partitionCount;
      top10Precision += localResults.topPercentRecall(0.1) / partitionCount;
      bad10Recall += localResults.badPercentRecall(0.1) / partitionCount;
      bad10Precision += localResults.badPercentPrecision(0.1) / partitionCount;
      top5Recall += localResults.topPercentRecall(0.05) / partitionCount;
      top5Precision += localResults.topPercentRecall(0.05) / partitionCount;
      bad5Recall += localResults.badPercentRecall(0.05) / partitionCount;
      bad5Precision += localResults.badPercentPrecision(0.05) / partitionCount;
      // clean up
      rmm.shutdown();
    }
    resultString += String.format(Locale.US, "Average Pearson r=%.2f, average Spearman rho=%.2f\n", pearson, spearman);
    resultString += String.format(Locale.US, "20%%: Top Recall %.2f Top Precision %.2f  Bad Recall %.2f Bad Precision %.2f\n", top20Recall, top20Precision, bad20Recall, bad20Precision);
View Full Code Here

    filter.setInverted(true);
    return reputationMetricManagerFactory.create();
  }

  private Correlation correlateQualityPredictions(Collection<ArtifactIdentifier> partition, ReputationMetricManager rmm) {
    Correlation correlation = new Correlation();
    // predict the quality of the artifacts in the partition using the reputation results from rmm
    for (ArtifactIdentifier aid : partition) {
      Artifact artifact = collabReview.getRepository().getArtifact(aid);
      double predicted = predictQuality(artifact, rmm.findReputationMetric("quality"));
      Float assessedFloat = collabReview.getMeasurementsManager().getArtifactQualityAssessor().assessQuality(aid);
      assert assessedFloat != null;
      double assessed = assessedFloat;
      //correlation.addRow(assessed, predicted, collabReview.getMeasurementsManager().getArtifactWeight().measure(artifact));
      correlation.addRow(assessed, predicted, 1);
    }
    return correlation;
  }
View Full Code Here

TOP

Related Classes of net.sf.collabreview.core.toolbox.Correlation

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.