public class MulticlassMetrics
extends Object
param: predictionAndLabels an RDD of (prediction, label, weight, probability) or (prediction, label, weight) or (prediction, label) tuples.
Constructor and Description |
---|
MulticlassMetrics(RDD<? extends scala.Product> predictionAndLabels) |
Modifier and Type | Method and Description |
---|---|
double |
accuracy() |
Matrix |
confusionMatrix()
Returns confusion matrix:
predicted classes are in columns,
they are ordered by class label ascending,
as in "labels"
|
double |
falsePositiveRate(double label)
Returns false positive rate for a given label (category)
|
double |
fMeasure(double label)
Returns f1-measure for a given label (category)
|
double |
fMeasure(double label,
double beta)
Returns f-measure for a given label (category)
|
double |
hammingLoss() |
double[] |
labels() |
double |
logLoss(double eps)
Returns the log-loss, aka logistic loss or cross-entropy loss.
|
double |
precision(double label)
Returns precision for a given label (category)
|
double |
recall(double label)
Returns recall for a given label (category)
|
double |
truePositiveRate(double label)
Returns true positive rate for a given label (category)
|
double |
weightedFalsePositiveRate() |
double |
weightedFMeasure() |
double |
weightedFMeasure(double beta)
Returns weighted averaged f-measure
|
double |
weightedPrecision() |
double |
weightedRecall() |
double |
weightedTruePositiveRate() |
public MulticlassMetrics(RDD<? extends scala.Product> predictionAndLabels)
public double accuracy()
public Matrix confusionMatrix()
public double fMeasure(double label, double beta)
label
- the label.beta
- the beta parameter.public double fMeasure(double label)
label
- the label.public double falsePositiveRate(double label)
label
- the label.public double hammingLoss()
public double[] labels()
public double logLoss(double eps)
eps
- log-loss is undefined for p=0 or p=1, so probabilities are
clipped to max(eps, min(1 - eps, p)).public double precision(double label)
label
- the label.public double recall(double label)
label
- the label.public double truePositiveRate(double label)
label
- the label.public double weightedFMeasure(double beta)
beta
- the beta parameter.public double weightedFMeasure()
public double weightedFalsePositiveRate()
public double weightedPrecision()
public double weightedRecall()
public double weightedTruePositiveRate()