Package org.nd4j.evaluation
Class EvaluationUtils
- java.lang.Object
-
- org.nd4j.evaluation.EvaluationUtils
-
public class EvaluationUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description EvaluationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Pair<INDArray,INDArray>
extractNonMaskedTimeSteps(INDArray labels, INDArray predicted, INDArray outputMask)
static double
falseNegativeRate(long fnCount, long tpCount, double edgeCase)
Calculate the false negative rate from the false negative counts and true positive countstatic double
falsePositiveRate(long fpCount, long tnCount, double edgeCase)
Calculate the false positive rate from the false positive count and true negative countstatic double
fBeta(double beta, double precision, double recall)
Calculate the F-beta value from precision and recallstatic double
fBeta(double beta, long tp, long fp, long fn)
Calculate the F beta value from countsstatic double
gMeasure(double precision, double recall)
Calculate the G-measure from precision and recallstatic double
matthewsCorrelation(long tp, long fp, long fn, long tn)
Calculate the binary Matthews correlation coefficient from countsstatic double
precision(long tpCount, long fpCount, double edgeCase)
Calculate the precision from true positive and false positive countsstatic double
recall(long tpCount, long fnCount, double edgeCase)
Calculate the recall from true positive and false negative countsstatic INDArray
reshapeTimeSeriesMaskToVector(INDArray timeSeriesMask)
Reshape time series mask arrays.static INDArray
reshapeTimeSeriesTo2d(INDArray labels)
-
-
-
Method Detail
-
precision
public static double precision(long tpCount, long fpCount, double edgeCase)
Calculate the precision from true positive and false positive counts- Parameters:
tpCount
- True positive countfpCount
- False positive countedgeCase
- Edge case value use to avoid 0/0- Returns:
- Precision
-
recall
public static double recall(long tpCount, long fnCount, double edgeCase)
Calculate the recall from true positive and false negative counts- Parameters:
tpCount
- True positive countfnCount
- False negative countedgeCase
- Edge case values used to avoid 0/0- Returns:
- Recall
-
falsePositiveRate
public static double falsePositiveRate(long fpCount, long tnCount, double edgeCase)
Calculate the false positive rate from the false positive count and true negative count- Parameters:
fpCount
- False positive counttnCount
- True negative countedgeCase
- Edge case values are used to avoid 0/0- Returns:
- False positive rate
-
falseNegativeRate
public static double falseNegativeRate(long fnCount, long tpCount, double edgeCase)
Calculate the false negative rate from the false negative counts and true positive count- Parameters:
fnCount
- False negative counttpCount
- True positive countedgeCase
- Edge case value to use to avoid 0/0- Returns:
- False negative rate
-
fBeta
public static double fBeta(double beta, long tp, long fp, long fn)
Calculate the F beta value from counts- Parameters:
beta
- Beta of value to usetp
- True positive countfp
- False positive countfn
- False negative count- Returns:
- F beta
-
fBeta
public static double fBeta(double beta, double precision, double recall)
Calculate the F-beta value from precision and recall- Parameters:
beta
- Beta value to useprecision
- Precisionrecall
- Recall- Returns:
- F-beta value
-
gMeasure
public static double gMeasure(double precision, double recall)
Calculate the G-measure from precision and recall- Parameters:
precision
- Precision valuerecall
- Recall value- Returns:
- G-measure
-
matthewsCorrelation
public static double matthewsCorrelation(long tp, long fp, long fn, long tn)
Calculate the binary Matthews correlation coefficient from counts- Parameters:
tp
- True positive countfp
- False positive countsfn
- False negative countstn
- True negative count- Returns:
- Matthews correlation coefficient
-
extractNonMaskedTimeSteps
public static Pair<INDArray,INDArray> extractNonMaskedTimeSteps(INDArray labels, INDArray predicted, INDArray outputMask)
-
reshapeTimeSeriesMaskToVector
public static INDArray reshapeTimeSeriesMaskToVector(INDArray timeSeriesMask)
Reshape time series mask arrays. This should match the assumptions (f order, etc) in RnnOutputLayer- Parameters:
timeSeriesMask
- Mask array to reshape to a column vector- Returns:
- Mask array as a column vector
-
-