public abstract class Metrics extends Object
L_ are loss/error measures (less is better)
P_ are payoff/accuracy measures (higher is better).
For more on the evaluation and threshold selection implemented here, seeConstructor and Description |
---|
Metrics() |
Modifier and Type | Method and Description |
---|---|
static double[][] |
align(int[] real,
double[] pred)
Helper function for missing values in the labels and missing predictions
(i.e., from abstaining classifiers).
|
static int[][] |
align(int[] real,
int[] pred)
Helper function for missing values in the labels and missing predictions
(i.e., from abstaining classifiers).
|
static boolean |
allMissing(int[] real)
Helper function for missing values in the labels.
|
static weka.core.Instances[] |
curveData(int[][] Y,
double[][] P)
Get Data for Plotting PR and ROC curves.
|
static weka.core.Instances |
curveData(int[] y,
double[] p)
Get Data for Plotting PR and ROC curves.
|
static weka.core.Instances |
curveDataMacroAveraged(int[][] Y,
double[][] P)
Get Data for Plotting PR and ROC curves.
|
static weka.core.Instances |
curveDataMicroAveraged(int[][] Y,
double[][] P)
Get Data for Plotting PR and ROC curves.
|
static double |
F1(int[] s1,
int[] s2)
F1 - the F1 measure for two sets.
|
static double |
L_Hamming(int[][] Y,
int[][] Ypred)
Hamming loss.
|
static double |
L_Hamming(int[] y,
int[] ypred)
Hamming loss.
|
static double |
L_JaccardDist(int[][] Y,
int[][] Ypred)
Jaccard Distance -- the loss version of Jaccard Index
|
static double |
L_LevenshteinDistance(int[][] Y,
int[][] P)
Levenshtein Distance.
|
static double |
L_LevenshteinDistance(int[] y,
int[] p)
Levenshtein Distance divided by the number of labels.
|
static double |
L_LogLoss(double y,
double rpred,
double C)
L_LogLoss - the log loss between real-valued confidence rpred and true prediction y.
|
static double |
L_LogLoss(int[][] Y,
double[][] Rpred,
double C)
L_LogLoss - the log loss between real-valued confidences Rpred and true predictions Y with a maximum penalty C [Important Note: Earlier versions of Meka only normalised by N, and not N*L as here].
|
static double |
L_LogLossD(int[][] Y,
double[][] Rpred)
L_LogLoss - the log loss between real-valued confidences Rpred and true predictions
Y with a maximum penalty based on the number of examples D [Important Note: Earlier
versions of Meka only normalised by N, and not N*L as here].
|
static double |
L_LogLossL(int[][] Y,
double[][] Rpred)
L_LogLoss - the log loss between real-valued confidences Rpred and true predictions
Y with a maximum penalty based on the number of labels L [Important Note: Earlier
versions of Meka only normalised by N, and not N*L as here].
|
double |
L_MAE(int[] y,
double[] p)
MAE
|
double |
L_MSE(int[] y,
double[] p)
MSE
|
static double |
L_OneError(int[][] Y,
double[][] Rpred)
OneError -
|
static double |
L_RankLoss(int[][] Y,
double[][] Rpred) |
static double |
L_RankLoss(int[] y,
double[] rpred) |
static double |
L_RankLoss(int[] y,
int[] r)
Rank Loss - the average fraction of labels which are not correctly ordered.
|
static double |
L_ZeroOne(int[][] Y,
int[][] Ypred)
0/1 Loss.
|
static double |
L_ZeroOne(int[] y,
int[] ypred)
0/1 Loss.
|
static void |
main(String[] args)
Do some tests.
|
static int |
numberOfMissingLabels(int[] real)
Helper function for missing values in the labels.
|
static double |
P_Accuracy(int[][] Y,
int[][] Ypred)
Jaccard Index -- often simply called multi-label 'accuracy'.
|
static double |
P_Accuracy(int[] y,
int[] ypred)
Jaccard Index -- often simply called multi-label 'accuracy'.
|
static double |
P_AveragePrecision(int[][] Y,
double[][] Rpred) |
static double |
P_AveragePrecision(int[] y,
double[] rpred)
Converts confidences in prediction array to ranking array, and continues
with
P_AveragePrecision(using ranking array) . |
static double |
P_AveragePrecision(int[] y,
int[] r)
Average Precision - computes for each relevant label the percentage
of relevant labels among all labels that are ranked before it.
|
static double |
P_ExactMatch(int[][] Y,
int[][] Ypred)
Exact Match, i.e., 1 - [0/1 Loss].
|
static double |
P_FalseNegatives(int[] y,
int[] ypred)
P_FalseNegatives - 0 but supposed to be 1 (the length of ypred \ y).
|
static double |
P_FalsePositives(int[] y,
int[] ypred)
P_FalsePositives - 1 but supposed to be 0 (the length of y \ ypred).
|
static double |
P_FmacroAvgD(int[][] Y,
int[][] Ypred)
F-Measure Averaged by D - The F-measure macro averaged by example.
|
static double |
P_FmacroAvgL(int[][] Y,
int[][] Ypred)
F-Measure Macro Averaged by L - The 'standard' macro average.
|
static double |
P_FmicroAvg(int[][] Y,
int[][] Ypred)
P_FmicroAvg - Micro Averaged F-measure (F1, as if all labels in the dataset formed a single vector)
|
static double |
P_Hamming(int[][] Y,
int[][] Ypred)
Hamming score aka label accuracy.
|
static double |
P_Hamming(int[][] Y,
int[][] Ypred,
int j)
Hamming score aka label accuracy.
|
static double |
P_Harmonic(int[][] Y,
int[][] Ypred)
Harmonic Accuracy -- average over all labels.
|
static double |
P_Harmonic(int[][] Y,
int[][] Ypred,
int j)
Harmonic Accuracy -- for the j-th label.
|
static double |
P_Harmonic(int[] y,
int[] ypred)
Harmonic Accuracy.
|
static double |
P_JaccardIndex(int[][] Y,
int[][] Ypred)
Jaccard Index -- often simply called multi-label 'accuracy'.
|
double |
P_LogLikelihood(int[] y,
double[] p)
Log Likelihood
|
static double |
P_macroAUPRC(int[][] Y,
double[][] P)
Calculate AUPRC: Area Under the Precision-Recall curve.
|
static double |
P_macroAUROC(int[][] Y,
double[][] P)
Calculate AUROC: Area Under the ROC curve.
|
static double |
P_Precision(int[][] Y,
int[][] Ypred,
int j)
P_Precision - (retrieved AND relevant) / retrieved
|
static double |
P_Precision(int[] y,
int[] ypred)
P_Precision - (retrieved AND relevant) / retrieved
|
static double |
P_PrecisionMacro(int[][] Y,
int[][] Ypred)
P_Precision - (retrieved AND relevant) / retrieved
|
static double |
P_PrecisionMicro(int[][] Y,
int[][] Ypred)
P_Precision - (retrieved AND relevant) / retrieved
|
static double |
P_Recall(int[][] Y,
int[][] Ypred,
int j)
P_Recall - (retrieved AND relevant) / relevant
|
static double |
P_Recall(int[] y,
int[] ypred)
P_Recall - (retrieved AND relevant) / relevant
|
static double |
P_RecallMacro(int[][] Y,
int[][] Ypred)
P_Recall - (retrieved AND relevant) / relevant
|
static double |
P_RecallMicro(int[][] Y,
int[][] Ypred)
P_Recall - (retrieved AND relevant) / relevant
|
static double |
P_TrueNegatives(int[] y,
int[] ypred)
P_TrueNegatives - 0 and supposed to be 0.
|
static double |
P_TruePositives(int[] y,
int[] ypred)
P_TruePositives - 1 and supposed to be 1 (the intersection, i.e., logical AND).
|
static int[] |
toIntArray(double[] doubles)
Helper function for missing values in the labels.
|
public static int[] toIntArray(double[] doubles)
public static boolean allMissing(int[] real)
public static int numberOfMissingLabels(int[] real)
public static int[][] align(int[] real, int[] pred)
real
- The real values from the datapred
- The predicted values from the classifierspublic static double[][] align(int[] real, double[] pred)
real
- The real values from the datapred
- The predicted values from the classifierspublic static double P_ExactMatch(int[][] Y, int[][] Ypred)
public static double L_ZeroOne(int[] y, int[] ypred)
public static double L_ZeroOne(int[][] Y, int[][] Ypred)
public static double L_Hamming(int[] y, int[] ypred)
public static double L_Hamming(int[][] Y, int[][] Ypred)
public static double P_Hamming(int[][] Y, int[][] Ypred)
public static double P_Hamming(int[][] Y, int[][] Ypred, int j)
public static double P_Harmonic(int[] y, int[] ypred)
public static double P_Harmonic(int[][] Y, int[][] Ypred, int j)
public static double P_Harmonic(int[][] Y, int[][] Ypred)
public static double P_Accuracy(int[] y, int[] ypred)
public static double P_Accuracy(int[][] Y, int[][] Ypred)
public static double P_JaccardIndex(int[][] Y, int[][] Ypred)
public static double L_JaccardDist(int[][] Y, int[][] Ypred)
public static double L_LogLoss(double y, double rpred, double C)
y
- labelrpred
- prediction (confidence)C
- limit (maximum loss of log(C))public static double L_LogLossL(int[][] Y, double[][] Rpred)
public static double L_LogLossD(int[][] Y, double[][] Rpred)
public static double L_LogLoss(int[][] Y, double[][] Rpred, double C)
public static double P_TruePositives(int[] y, int[] ypred)
public static double P_FalsePositives(int[] y, int[] ypred)
public static double P_TrueNegatives(int[] y, int[] ypred)
public static double P_FalseNegatives(int[] y, int[] ypred)
public static double P_Precision(int[] y, int[] ypred)
public static double P_Recall(int[] y, int[] ypred)
public static double F1(int[] s1, int[] s2)
public static double P_PrecisionMacro(int[][] Y, int[][] Ypred)
public static double P_RecallMacro(int[][] Y, int[][] Ypred)
public static double P_PrecisionMicro(int[][] Y, int[][] Ypred)
public static double P_RecallMicro(int[][] Y, int[][] Ypred)
public static double P_Precision(int[][] Y, int[][] Ypred, int j)
public static double P_Recall(int[][] Y, int[][] Ypred, int j)
public static double P_FmicroAvg(int[][] Y, int[][] Ypred)
public static double P_FmacroAvgL(int[][] Y, int[][] Ypred)
public static double P_FmacroAvgD(int[][] Y, int[][] Ypred)
public static double L_OneError(int[][] Y, double[][] Rpred)
public static double P_AveragePrecision(int[][] Y, double[][] Rpred)
public static double P_AveragePrecision(int[] y, double[] rpred)
P_AveragePrecision(using ranking array)
.y
- The real label values of an instance.rpred
- The predicted confidences for the labels.public static double P_AveragePrecision(int[] y, int[] r)
y
- 0/1 labels [0, 0, 1 ] (true labels)r
- ranking position [1, 2, 0 ]public static double L_RankLoss(int[][] Y, double[][] Rpred)
public static double L_RankLoss(int[] y, double[] rpred)
public static double L_RankLoss(int[] y, int[] r)
y
- 0/1 labels [0, 0, 1 ]r
- ranking position [1, 2, 0 ]public static double P_macroAUPRC(int[][] Y, double[][] P)
public static double P_macroAUROC(int[][] Y, double[][] P)
public static weka.core.Instances curveDataMicroAveraged(int[][] Y, double[][] P)
public static weka.core.Instances curveDataMacroAveraged(int[][] Y, double[][] P)
public static weka.core.Instances curveData(int[] y, double[] p)
public static weka.core.Instances[] curveData(int[][] Y, double[][] P)
public static double L_LevenshteinDistance(int[][] Y, int[][] P)
public static double L_LevenshteinDistance(int[] y, int[] p)
public double P_LogLikelihood(int[] y, double[] p)
public double L_MSE(int[] y, double[] p)
public double L_MAE(int[] y, double[] p)
public static void main(String[] args)
Copyright © 2017. All Rights Reserved.