List of usage examples for weka.classifiers Evaluation weightedAreaUnderPRC
public double weightedAreaUnderPRC()
From source file:adams.flow.core.EvaluationHelper.java
License:Open Source License
/** * Returns a statistical value from the evaluation object. * * @param eval the evaluation object to get the value from * @param statistic the type of value to return * @param classIndex the class label index, for statistics like AUC * @return the determined value, Double.NaN if not found * @throws Exception if evaluation fails *//*from www . j a v a 2 s . c o m*/ public static double getValue(Evaluation eval, EvaluationStatistic statistic, int classIndex) throws Exception { switch (statistic) { case NUMBER_CORRECT: return eval.correct(); case NUMBER_INCORRECT: return eval.incorrect(); case NUMBER_UNCLASSIFIED: return eval.unclassified(); case PERCENT_CORRECT: return eval.pctCorrect(); case PERCENT_INCORRECT: return eval.pctIncorrect(); case PERCENT_UNCLASSIFIED: return eval.pctUnclassified(); case KAPPA_STATISTIC: return eval.kappa(); case MEAN_ABSOLUTE_ERROR: return eval.meanAbsoluteError(); case ROOT_MEAN_SQUARED_ERROR: return eval.rootMeanSquaredError(); case RELATIVE_ABSOLUTE_ERROR: return eval.relativeAbsoluteError(); case ROOT_RELATIVE_SQUARED_ERROR: return eval.rootRelativeSquaredError(); case CORRELATION_COEFFICIENT: return eval.correlationCoefficient(); case SF_PRIOR_ENTROPY: return eval.SFPriorEntropy(); case SF_SCHEME_ENTROPY: return eval.SFSchemeEntropy(); case SF_ENTROPY_GAIN: return eval.SFEntropyGain(); case SF_MEAN_PRIOR_ENTROPY: return eval.SFMeanPriorEntropy(); case SF_MEAN_SCHEME_ENTROPY: return eval.SFMeanSchemeEntropy(); case SF_MEAN_ENTROPY_GAIN: return eval.SFMeanEntropyGain(); case KB_INFORMATION: return eval.KBInformation(); case KB_MEAN_INFORMATION: return eval.KBMeanInformation(); case KB_RELATIVE_INFORMATION: return eval.KBRelativeInformation(); case TRUE_POSITIVE_RATE: return eval.truePositiveRate(classIndex); case NUM_TRUE_POSITIVES: return eval.numTruePositives(classIndex); case FALSE_POSITIVE_RATE: return eval.falsePositiveRate(classIndex); case NUM_FALSE_POSITIVES: return eval.numFalsePositives(classIndex); case TRUE_NEGATIVE_RATE: return eval.trueNegativeRate(classIndex); case NUM_TRUE_NEGATIVES: return eval.numTrueNegatives(classIndex); case FALSE_NEGATIVE_RATE: return eval.falseNegativeRate(classIndex); case NUM_FALSE_NEGATIVES: return eval.numFalseNegatives(classIndex); case IR_PRECISION: return eval.precision(classIndex); case IR_RECALL: return eval.recall(classIndex); case F_MEASURE: return eval.fMeasure(classIndex); case MATTHEWS_CORRELATION_COEFFICIENT: return eval.matthewsCorrelationCoefficient(classIndex); case AREA_UNDER_ROC: return eval.areaUnderROC(classIndex); case AREA_UNDER_PRC: return eval.areaUnderPRC(classIndex); case WEIGHTED_TRUE_POSITIVE_RATE: return eval.weightedTruePositiveRate(); case WEIGHTED_FALSE_POSITIVE_RATE: return eval.weightedFalsePositiveRate(); case WEIGHTED_TRUE_NEGATIVE_RATE: return eval.weightedTrueNegativeRate(); case WEIGHTED_FALSE_NEGATIVE_RATE: return eval.weightedFalseNegativeRate(); case WEIGHTED_IR_PRECISION: return eval.weightedPrecision(); case WEIGHTED_IR_RECALL: return eval.weightedRecall(); case WEIGHTED_F_MEASURE: return eval.weightedFMeasure(); case WEIGHTED_MATTHEWS_CORRELATION_COEFFICIENT: return eval.weightedMatthewsCorrelation(); case WEIGHTED_AREA_UNDER_ROC: return eval.weightedAreaUnderROC(); case WEIGHTED_AREA_UNDER_PRC: return eval.weightedAreaUnderPRC(); case UNWEIGHTED_MACRO_F_MEASURE: return eval.unweightedMacroFmeasure(); case UNWEIGHTED_MICRO_F_MEASURE: return eval.unweightedMicroFmeasure(); case BIAS: return eval.getPluginMetric(Bias.class.getName()).getStatistic(Bias.NAME); case RSQUARED: return eval.getPluginMetric(RSquared.class.getName()).getStatistic(RSquared.NAME); case SDR: return eval.getPluginMetric(SDR.class.getName()).getStatistic(SDR.NAME); case RPD: return eval.getPluginMetric(RPD.class.getName()).getStatistic(RPD.NAME); default: throw new IllegalArgumentException("Unhandled statistic field: " + statistic); } }
From source file:net.sf.jclal.evaluation.measure.SingleLabelEvaluation.java
License:Open Source License
/** * * @param evaluation The evaluation/*w ww. jav a 2 s.co m*/ */ public void setEvaluation(Evaluation evaluation) { try { this.evaluation = evaluation; StringBuilder st = new StringBuilder(); st.append("Iteration: ").append(getIteration()).append("\n"); st.append("Labeled set size: ").append(getLabeledSetSize()).append("\n"); st.append("Unlabelled set size: ").append(getUnlabeledSetSize()).append("\n"); st.append("\t\n"); st.append("Correctly Classified Instances: ").append(evaluation.pctCorrect()).append("\n"); st.append("Incorrectly Classified Instances: ").append(evaluation.pctIncorrect()).append("\n"); st.append("Kappa statistic: ").append(evaluation.kappa()).append("\n"); st.append("Mean absolute error: ").append(evaluation.meanAbsoluteError()).append("\n"); st.append("Root mean squared error: ").append(evaluation.rootMeanSquaredError()).append("\n"); st.append("Relative absolute error: ").append(evaluation.relativeAbsoluteError()).append("\n"); st.append("Root relative squared error: ").append(evaluation.rootRelativeSquaredError()).append("\n"); st.append("Coverage of cases: ").append(evaluation.coverageOfTestCasesByPredictedRegions()) .append("\n"); st.append("Mean region size: ").append(evaluation.sizeOfPredictedRegions()).append("\n"); st.append("Weighted Precision: ").append(evaluation.weightedPrecision()).append("\n"); st.append("Weighted Recall: ").append(evaluation.weightedRecall()).append("\n"); st.append("Weighted FMeasure: ").append(evaluation.weightedFMeasure()).append("\n"); st.append("Weighted TruePositiveRate: ").append(evaluation.weightedTruePositiveRate()).append("\n"); st.append("Weighted FalsePositiveRate: ").append(evaluation.weightedFalsePositiveRate()).append("\n"); st.append("Weighted MatthewsCorrelation: ").append(evaluation.weightedMatthewsCorrelation()) .append("\n"); st.append("Weighted AreaUnderROC: ").append(evaluation.weightedAreaUnderROC()).append("\n"); st.append("Weighted AreaUnderPRC: ").append(evaluation.weightedAreaUnderPRC()).append("\n"); st.append("\t\t\n"); loadMetrics(st.toString()); } catch (Exception e) { Logger.getLogger(SingleLabelEvaluation.class.getName()).log(Level.SEVERE, null, e); } }