Example usage for weka.classifiers.evaluation ThresholdCurve getNPointPrecision

List of usage examples for weka.classifiers.evaluation ThresholdCurve getNPointPrecision

Introduction

In this page you can find the example usage for weka.classifiers.evaluation ThresholdCurve getNPointPrecision.

Prototype

public static double getNPointPrecision(Instances tcurve, int n) 

Source Link

Document

Calculates the n point precision result, which is the precision averaged over n evenly spaced (w.r.t recall) samples of the curve.

Usage

From source file:cotraining.copy.Evaluation_D.java

License:Open Source License

/**
 * Returns the area under PRC for those predictions that have been collected
 * in the evaluateClassifier(Classifier, Instances) method. Returns 
 * Instance.missingValue() if the area is not available.
 *
 * @param classIndex the index of the class to consider as "positive"
 * @return the area under the PRC curve or not a number
 * @author doina/*from ww w  .  j a v  a  2s.co  m*/
 */
public double areaUnderPRC(int classIndex) {

    // Check if any predictions have been collected
    if (m_Predictions == null) {
        return Instance.missingValue();
    } else {
        ThresholdCurve tc = new ThresholdCurve();
        Instances result = tc.getCurve(m_Predictions, classIndex);
        return ThresholdCurve.getNPointPrecision(result, 11);
    }
}