Class MulticlassMetrics
Object
org.apache.spark.mllib.evaluation.MulticlassMetrics
Evaluator for multiclass classification.
param: predictionAndLabels an RDD of (prediction, label, weight, probability) or (prediction, label, weight) or (prediction, label) tuples.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleaccuracy()Returns confusion matrix: predicted classes are in columns, they are ordered by class label ascending, as in "labels"doublefalsePositiveRate(double label) Returns false positive rate for a given label (category)doublefMeasure(double label) Returns f1-measure for a given label (category)doublefMeasure(double label, double beta) Returns f-measure for a given label (category)doubledouble[]labels()doublelogLoss(double eps) Returns the log-loss, aka logistic loss or cross-entropy loss.doubleprecision(double label) Returns precision for a given label (category)doublerecall(double label) Returns recall for a given label (category)doubletruePositiveRate(double label) Returns true positive rate for a given label (category)doubledoubledoubleweightedFMeasure(double beta) Returns weighted averaged f-measuredoubledoubledouble
-
Constructor Details
-
MulticlassMetrics
-
-
Method Details
-
accuracy
public double accuracy() -
confusionMatrix
Returns confusion matrix: predicted classes are in columns, they are ordered by class label ascending, as in "labels"- Returns:
- (undocumented)
-
fMeasure
public double fMeasure(double label, double beta) Returns f-measure for a given label (category)- Parameters:
label- the label.beta- the beta parameter.- Returns:
- (undocumented)
-
fMeasure
public double fMeasure(double label) Returns f1-measure for a given label (category)- Parameters:
label- the label.- Returns:
- (undocumented)
-
falsePositiveRate
public double falsePositiveRate(double label) Returns false positive rate for a given label (category)- Parameters:
label- the label.- Returns:
- (undocumented)
-
hammingLoss
public double hammingLoss() -
labels
public double[] labels() -
logLoss
public double logLoss(double eps) Returns the log-loss, aka logistic loss or cross-entropy loss.- Parameters:
eps- log-loss is undefined for p=0 or p=1, so probabilities are clipped to max(eps, min(1 - eps, p)).- Returns:
- (undocumented)
-
precision
public double precision(double label) Returns precision for a given label (category)- Parameters:
label- the label.- Returns:
- (undocumented)
-
recall
public double recall(double label) Returns recall for a given label (category)- Parameters:
label- the label.- Returns:
- (undocumented)
-
truePositiveRate
public double truePositiveRate(double label) Returns true positive rate for a given label (category)- Parameters:
label- the label.- Returns:
- (undocumented)
-
weightedFMeasure
public double weightedFMeasure(double beta) Returns weighted averaged f-measure- Parameters:
beta- the beta parameter.- Returns:
- (undocumented)
-
weightedFMeasure
public double weightedFMeasure() -
weightedFalsePositiveRate
public double weightedFalsePositiveRate() -
weightedPrecision
public double weightedPrecision() -
weightedRecall
public double weightedRecall() -
weightedTruePositiveRate
public double weightedTruePositiveRate()
-