Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/15435#discussion_r85220375
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
---
@@ -1243,6 +1291,73 @@ class BinaryLogisticRegressionSummary
private[classification] (
}
}
+@Experimental
+@Since("2.1.0")
+class MultinomialLogisticRegressionSummary private[classification] (
+ @Since("1.5.0") @transient override val predictions: DataFrame,
+ @Since("2.1.0") override val probabilityCol: String,
+ @Since("1.5.0") override val labelCol: String,
+ @Since("1.6.0") override val featuresCol: String,
+ private val probability2PredictionUdf: UserDefinedFunction) extends
LogisticRegressionSummary {
+
+ private val sparkSession = predictions.sparkSession
+ import sparkSession.implicits._
+
+ @transient private val multinomialMetrics = {
+ new MulticlassMetrics(
+ predictions.select(
+ probability2PredictionUdf(col(probabilityCol)),
--- End diff --
This is the only place where you need the probability2predictionUDF.
Rather than passing a UDF or the model, I'd like us to modify
findSummaryModelAndProbabilityCol to also set predictionCol if needed.
---
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]