Skip to content

Commit d54cc55

Browse files
committed
reverted version back, added constraint and validation
1 parent 07382f0 commit d54cc55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mllib/src/main/scala/org/apache/spark/mllib/evaluation/MulticlassMetrics.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ import org.apache.spark.sql.DataFrame
3131
* (prediction, label) pairs.
3232
*/
3333
@Since("1.1.0")
34-
class MulticlassMetrics @Since("3.0.0") (predAndLabelsWithOptWeight: RDD[_]) {
34+
class MulticlassMetrics @Since("1.1.0") (predAndLabelsWithOptWeight: RDD[_ <: Product]) {
3535
val predLabelsWeight: RDD[(Double, Double, Double)] = predAndLabelsWithOptWeight.map {
3636
case (prediction: Double, label: Double, weight: Double) =>
3737
(prediction, label, weight)
3838
case (prediction: Double, label: Double) =>
3939
(prediction, label, 1.0)
40+
case other =>
41+
throw new IllegalArgumentException(s"Expected tuples, got $other")
4042
}
4143

4244
/**

0 commit comments

Comments
 (0)