Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/6993#discussion_r33198443
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala ---
@@ -108,7 +108,7 @@ abstract class ClassificationModel[FeaturesType, M <:
ClassificationModel[Featur
}
if (getPredictionCol != "") {
val predUDF = if (getRawPredictionCol != "") {
- callUDF(raw2prediction _, DoubleType, col(getRawPredictionCol))
+ udf[Double, Vector](raw2prediction).apply(col(getRawPredictionCol))
--- End diff --
The type info is not necessary. Try
~~~scala
udf(raw2prediction _).apply(col(getRawPredictionCol))
~~~
The `callUDF` on line 106 needs some explicit type info since
`FeaturesType` doesn't have type tag. We can write this:
~~~scala
val predictRawUDF = udf { (features: Any) =>
predictRaw(features.asInstanceOf[FeaturesType])
}
outputData = outputData.withColumn(getRawPredictionCol,
predictRawUDF(col(getFeaturesCol)))
~~~
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]