示例#1
0
文件: AUC.java 项目: Jrobinso09/h2o
 public void toASCII(StringBuilder sb) {
   aucdata.toASCII(sb);
 }
  protected ArrayList<AUCPoint> getAUCPointsFromData(List<AUCData> aucDataList) {
    double truePositives = 0;
    double trueNegatives = 0;
    double falsePositives = 0;
    double falseNegatives = 0;

    ArrayList<AUCPoint> aucPoints = new ArrayList<AUCPoint>();
    double threshold = 0.0;
    for (AUCData aucData : aucDataList) {
      if (aucData.getClassification().equals(positiveClassification)) {
        truePositives += aucData.getWeight();
      } else {
        falsePositives += aucData.getWeight();
      }
    }

    // iterate through each data point updating all points that are changed by the threshold
    for (AUCData aucData : aucDataList) {
      if (threshold != aucData.getProbability()) {
        aucPoints.add(getAUCPoint(truePositives, falsePositives, trueNegatives, falseNegatives));
        threshold = aucData.getProbability();
      }
      // we are positive but guessing negative
      if (aucData.getClassification().equals(positiveClassification)) {
        // add a false negative
        falseNegatives += aucData.getWeight();
        // remove true positive from previous threshold
        truePositives -= aucData.getWeight();
      } else { // we are negative and guessing negative
        // add a true negative
        trueNegatives += aucData.getWeight();
        // remove a false positive from previous threshold
        falsePositives -= aucData.getWeight();
      }
    }
    // add last point
    aucPoints.add(getAUCPoint(truePositives, falsePositives, trueNegatives, falseNegatives));
    return aucPoints;
  }
示例#3
0
文件: AUC.java 项目: Jrobinso09/h2o
 @Override
 public boolean toHTML(StringBuilder sb) {
   return aucdata.toHTML(sb);
 }