Skip to content

Commit bbdeaf3

Browse files
committed
fixed syntax for init udf in OneVsRest
1 parent fe2a10b commit bbdeaf3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ final class OneVsRestModel private[ml] (
8888

8989
// add an accumulator column to store predictions of all the models
9090
val accColName = "mbc$acc" + UUID.randomUUID().toString
91-
val init: () => Map[Int, Double] = () => {Map()}
91+
val init = udf { () => Map[Int, Double]() }
9292
val mapType = MapType(IntegerType, DoubleType, valueContainsNull = false)
93-
val newDataset = dataset.withColumn(accColName, udf(init).apply())
93+
val newDataset = dataset.withColumn(accColName, init())
9494

9595
// persist if underlying dataset is not persistent.
9696
val handlePersistence = dataset.rdd.getStorageLevel == StorageLevel.NONE

0 commit comments

Comments
 (0)