return null; return getCurve(predictions, ((NominalPrediction) predictions.get(0)).distribution().length - 1);
return null; return getCurve(predictions, ((NominalPrediction) predictions.get(0)).distribution().length - 1);
public double getValue() { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(all_Predictions, 1); return ThresholdCurve.getROCArea(result); } }
/** * Returns the AUC for a particular label * * @param labelIndex the index of the label * @return the AUC for that label */ public double getValue(int labelIndex) { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(m_Predictions[labelIndex], 1); return ThresholdCurve.getROCArea(result); }
public double getValue() { double[] labelAUC = new double[numOfLabels]; for (int i = 0; i < numOfLabels; i++) { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(m_Predictions[i], 1); labelAUC[i] = ThresholdCurve.getROCArea(result); } return Utils.mean(labelAUC); }
/** * Returns the area under ROC for those predictions that have been collected * in the evaluateClassifier(Classifier, Instances) method. Returns * Utils.missingValue() if the area is not available. * * @param classIndex the index of the class to consider as "positive" * @return the area under the ROC curve or not a number */ public double areaUnderROC(int classIndex) { // Check if any predictions have been collected if (m_Predictions == null) { return Utils.missingValue(); } else { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(m_Predictions, classIndex); return ThresholdCurve.getROCArea(result); } }
/** * Returns the area under precision-recall curve (AUPRC) for those predictions * that have been collected in the evaluateClassifier(Classifier, Instances) * method. Returns Utils.missingValue() if the area is not available. * * @param classIndex the index of the class to consider as "positive" * @return the area under the precision-recall curve or not a number */ public double areaUnderPRC(int classIndex) { // Check if any predictions have been collected if (m_Predictions == null) { return Utils.missingValue(); } else { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(m_Predictions, classIndex); return ThresholdCurve.getPRCArea(result); } }
/** * Returns the area under ROC for those predictions that have been collected * in the evaluateClassifier(Classifier, Instances) method. Returns * Utils.missingValue() if the area is not available. * * @param classIndex the index of the class to consider as "positive" * @return the area under the ROC curve or not a number */ public double areaUnderROC(int classIndex) { // Check if any predictions have been collected if (m_Predictions == null) { return Utils.missingValue(); } else { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(m_Predictions, classIndex); return ThresholdCurve.getROCArea(result); } }
/** * Returns the area under precision-recall curve (AUPRC) for those predictions * that have been collected in the evaluateClassifier(Classifier, Instances) * method. Returns Utils.missingValue() if the area is not available. * * @param classIndex the index of the class to consider as "positive" * @return the area under the precision-recall curve or not a number */ public double areaUnderPRC(int classIndex) { // Check if any predictions have been collected if (m_Predictions == null) { return Utils.missingValue(); } else { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(m_Predictions, classIndex); return ThresholdCurve.getPRCArea(result); } }
/** Get Data for Plotting PR and ROC curves. */ public static Instances curveData(int y[], double p[]) { // works with missing double[][] aligned = align(y, p); y = toIntArray(aligned[0]); p = aligned[1]; ThresholdCurve curve = new ThresholdCurve(); return curve.getCurve(MLUtils.toWekaPredictions(y,p)); }
Instances result = tc.getCurve(predictions); System.out.println(result);
/** Get Data for Plotting PR and ROC curves. */ public static Instances curveData(int y[], double p[]) { // works with missing double[][] aligned = align(y, p); y = toIntArray(aligned[0]); p = aligned[1]; ThresholdCurve curve = new ThresholdCurve(); return curve.getCurve(MLUtils.toWekaPredictions(y,p)); }
Instances result = tc.getCurve(predictions); System.out.println(result);
/** Get Data for Plotting PR and ROC curves. */ public static Instances curveDataMicroAveraged(int Y[][], double P[][]) { //works with missing int y[] = MatrixUtils.flatten(Y); double p[] = MatrixUtils.flatten(P); double[][] aligned = align(y, p); y = toIntArray(aligned[0]); p = aligned[1]; ThresholdCurve curve = new ThresholdCurve(); return curve.getCurve(MLUtils.toWekaPredictions(y,p)); }
/** Get Data for Plotting PR and ROC curves. */ public static Instances curveDataMicroAveraged(int Y[][], double P[][]) { //works with missing int y[] = MatrixUtils.flatten(Y); double p[] = MatrixUtils.flatten(P); double[][] aligned = align(y, p); y = toIntArray(aligned[0]); p = aligned[1]; ThresholdCurve curve = new ThresholdCurve(); return curve.getCurve(MLUtils.toWekaPredictions(y,p)); }
curve.getCurve(MLUtils.toWekaPredictions(toIntArray(aligned[0]), aligned[1])); if (roc) {
Instances threshInst = tc.getCurve(predictions, classIndex);
curve.getCurve(MLUtils.toWekaPredictions(toIntArray(aligned[0]), aligned[1])); if (roc) {
@Override public void actionPerformed(ActionEvent e) { try { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(preds, classValue); // VisualizePanel vmc = new VisualizePanel(); ThresholdVisualizePanel vmc = new ThresholdVisualizePanel(); vmc.setROCString("(Area under ROC = " + Utils.doubleToString(ThresholdCurve.getROCArea(result), 4) + ")"); vmc.setLog(m_Log); vmc.setName(result.relationName() + ". (Class value " + classAtt.value(classValue) + ")"); PlotData2D tempd = new PlotData2D(result); tempd.setPlotName(result.relationName()); tempd.addInstanceNumberAttribute(); // specify which points are connected boolean[] cp = new boolean[result.numInstances()]; for (int n = 1; n < cp.length; n++) { cp[n] = true; } tempd.setConnectPoints(cp); // add plot vmc.addPlot(tempd); visualizeClassifierErrors(vmc); } catch (Exception ex) { ex.printStackTrace(); } } });
@Override public void actionPerformed(ActionEvent e) { try { ThresholdCurve tc = new ThresholdCurve(); Instances result = tc.getCurve(preds, classValue); // VisualizePanel vmc = new VisualizePanel(); ThresholdVisualizePanel vmc = new ThresholdVisualizePanel(); vmc.setROCString("(Area under ROC = " + Utils.doubleToString(ThresholdCurve.getROCArea(result), 4) + ")"); vmc.setLog(m_Log); vmc.setName(result.relationName() + ". (Class value " + classAtt.value(classValue) + ")"); PlotData2D tempd = new PlotData2D(result); tempd.setPlotName(result.relationName()); tempd.addInstanceNumberAttribute(); // specify which points are connected boolean[] cp = new boolean[result.numInstances()]; for (int n = 1; n < cp.length; n++) { cp[n] = true; } tempd.setConnectPoints(cp); // add plot vmc.addPlot(tempd); visualizeClassifierErrors(vmc); } catch (Exception ex) { ex.printStackTrace(); } } });