org.apache.spark.mllib.evaluation
Class MulticlassMetrics

Object
  extended by org.apache.spark.mllib.evaluation.MulticlassMetrics

public class MulticlassMetrics
extends Object

::Experimental:: Evaluator for multiclass classification.

param: predictionAndLabels an RDD of (prediction, label) pairs.


Constructor Summary
MulticlassMetrics(RDD<scala.Tuple2<Object,Object>> predictionAndLabels)
           
 
Method Summary
 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()
          Returns f-measure (equals to precision and recall because precision equals recall)
 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[] labels()
          Returns the sequence of labels in ascending order
 double precision()
          Returns precision
 double precision(double label)
          Returns precision for a given label (category)
 double recall()
          Returns recall (equals to precision for multiclass classifier because sum of all false positives is equal to sum of all false negatives)
 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()
          Returns weighted false positive rate
 double weightedFMeasure()
          Returns weighted averaged f1-measure
 double weightedFMeasure(double beta)
          Returns weighted averaged f-measure
 double weightedPrecision()
          Returns weighted averaged precision
 double weightedRecall()
          Returns weighted averaged recall (equals to precision, recall and f-measure)
 double weightedTruePositiveRate()
          Returns weighted true positive rate (equals to precision, recall and f-measure)
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MulticlassMetrics

public MulticlassMetrics(RDD<scala.Tuple2<Object,Object>> predictionAndLabels)
Method Detail

confusionMatrix

public Matrix confusionMatrix()
Returns confusion matrix: predicted classes are in columns, they are ordered by class label ascending, as in "labels"

Returns:
(undocumented)

truePositiveRate

public double truePositiveRate(double label)
Returns true positive rate 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)

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)

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)

precision

public double precision()
Returns precision

Returns:
(undocumented)

recall

public double recall()
Returns recall (equals to precision for multiclass classifier because sum of all false positives is equal to sum of all false negatives)

Returns:
(undocumented)

fMeasure

public double fMeasure()
Returns f-measure (equals to precision and recall because precision equals recall)

Returns:
(undocumented)

weightedTruePositiveRate

public double weightedTruePositiveRate()
Returns weighted true positive rate (equals to precision, recall and f-measure)

Returns:
(undocumented)

weightedFalsePositiveRate

public double weightedFalsePositiveRate()
Returns weighted false positive rate

Returns:
(undocumented)

weightedRecall

public double weightedRecall()
Returns weighted averaged recall (equals to precision, recall and f-measure)

Returns:
(undocumented)

weightedPrecision

public double weightedPrecision()
Returns weighted averaged precision

Returns:
(undocumented)

weightedFMeasure

public double weightedFMeasure(double beta)
Returns weighted averaged f-measure

Parameters:
beta - the beta parameter.
Returns:
(undocumented)

weightedFMeasure

public double weightedFMeasure()
Returns weighted averaged f1-measure

Returns:
(undocumented)

labels

public double[] labels()
Returns the sequence of labels in ascending order

Returns:
(undocumented)