File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
mllib/src/main/scala/org/apache/spark/mllib/evaluation Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -54,17 +54,15 @@ class MulticlassMetrics @Since("3.0.0") (predAndLabelsWithOptWeight: RDD[_]) {
5454 .collectAsMap()
5555 private lazy val labelCount : Double = labelCountByClass.values.sum
5656 private lazy val tpByClass : Map [Double , Double ] = predLabelsWeight
57- .filter(predLabelWeight => predLabelWeight._1 == predLabelWeight._2)
5857 .map {
59- case (_ : Double , label : Double , weight : Double ) =>
60- (label, weight)
58+ case (prediction : Double , label : Double , weight : Double ) =>
59+ (label, if (label == prediction) weight else 0.0 )
6160 }.reduceByKey(_ + _)
6261 .collectAsMap()
6362 private lazy val fpByClass : Map [Double , Double ] = predLabelsWeight
64- .filter(predLabelWeight => predLabelWeight._1 != predLabelWeight._2)
6563 .map {
66- case (prediction : Double , _ : Double , weight : Double ) =>
67- (prediction, weight)
64+ case (prediction : Double , label : Double , weight : Double ) =>
65+ (prediction, if (prediction != label) weight else 0.0 )
6866 }.reduceByKey(_ + _)
6967 .collectAsMap()
7068 private lazy val confusions = predLabelsWeight
You can’t perform that action at this time.
0 commit comments