org.neuroph.eval.classification
Class ClassificationMetrics
- java.lang.Object
-
- org.neuroph.eval.classification.ClassificationMetrics
-
public final class ClassificationMetrics extends java.lang.ObjectContainer class for all metrics which use confusion matrix for their computation Based on: http://java-ml.sourceforge.net/api/0.1.7/net/sf/javaml/classification/evaluation/PerformanceMeasure.html http://sourceforge.net/p/java-ml/java-ml-code/ci/a25ddde7c3677da44e47a643f88e32e2c8bbc32f/tree/net/sf/javaml/classification/evaluation/PerformanceMeasure.java http://en.wikipedia.org/wiki/Matthews_correlation_coefficient
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classClassificationMetrics.Stats
-
Constructor Summary
Constructors Constructor and Description ClassificationMetrics(int truePositive, int trueNegative, int falsePositive, int falseNegative)Constructs a new measure using arguments TODO: add class to which measure corresponds?
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static ClassificationMetrics.Statsaverage(ClassificationMetrics[] results)static ClassificationMetrics[]createFromMatrix(ConfusionMatrix confusionMatrix)doublegetAccuracy()Calculate and return classification accuracy measure.doublegetBalancedClassificationRate()java.lang.StringgetClassLabel()Returns class label fordoublegetErrorRate()A number of wrong predictions made divided by the total number of predictions made.doublegetFalseDiscoveryRate()doublegetFalseNegativeRate()doublegetFalsePositiveRate()doublegetFMeasure()Calculates F-score for beta equal to 1.doublegetFMeasure(int beta)Returns the F-score.doublegetMatthewsCorrelationCoefficient()doublegetPrecision()Calculate and return classification precision measure.doublegetQ9()doublegetRecall()doublegetSensitivity()Calculate and return classification sensitivity (recall, true positive rate) number of correctly classified positive examples divided by the total number of actual positive examplesdoublegetSpecificity()Specifity , true negative ratedoublegetTotal()Returns total number of classifications.voidsetClassLabel(java.lang.String classLabel)java.lang.StringtoString()
-
-
-
Constructor Detail
-
ClassificationMetrics
public ClassificationMetrics(int truePositive, int trueNegative, int falsePositive, int falseNegative)Constructs a new measure using arguments TODO: add class to which measure corresponds?- Parameters:
truePositive-trueNegative-falsePositive-falseNegative-
-
-
Method Detail
-
getClassLabel
public java.lang.String getClassLabel()
Returns class label for- Returns:
- class labels
-
setClassLabel
public void setClassLabel(java.lang.String classLabel)
-
getAccuracy
public double getAccuracy()
Calculate and return classification accuracy measure. A number of correct predictions made divided by the total number of predictions made a = ( tp + tn ) / n- Returns:
- classification accuracy
-
getErrorRate
public double getErrorRate()
A number of wrong predictions made divided by the total number of predictions made. Also error = 1 - accuracy- Returns:
-
getPrecision
public double getPrecision()
Calculate and return classification precision measure. A number of correctly classified positive examples divided by the total number of examples that are classified as positive Also known as positive predictive value PPV- Returns:
- classification precision measure
-
getSensitivity
public double getSensitivity()
Calculate and return classification sensitivity (recall, true positive rate) number of correctly classified positive examples divided by the total number of actual positive examples- Returns:
-
getRecall
public double getRecall()
-
getSpecificity
public double getSpecificity()
Specifity , true negative rate
-
getTotal
public double getTotal()
Returns total number of classifications.- Returns:
- total number of classifications
-
getFalsePositiveRate
public double getFalsePositiveRate()
-
getFalseNegativeRate
public double getFalseNegativeRate()
-
getFalseDiscoveryRate
public double getFalseDiscoveryRate()
-
getMatthewsCorrelationCoefficient
public double getMatthewsCorrelationCoefficient()
-
getFMeasure
public double getFMeasure()
Calculates F-score for beta equal to 1.- Returns:
- f-score
-
getFMeasure
public double getFMeasure(int beta)
Returns the F-score. When recall and precision are zero, this method will return 0.- Parameters:
beta-- Returns:
- f-score
-
getQ9
public double getQ9()
-
getBalancedClassificationRate
public double getBalancedClassificationRate()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
createFromMatrix
public static ClassificationMetrics[] createFromMatrix(ConfusionMatrix confusionMatrix)
-
average
public static ClassificationMetrics.Stats average(ClassificationMetrics[] results)
- Parameters:
results- list of different metric results computed on different sets of data- Returns:
- average metrics computed different MetricResults
-
-
DMelt 3.0 © DataMelt by jWork.ORG