Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/15435#discussion_r94615848
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
---
@@ -1095,6 +1131,89 @@ private[classification] class MultiClassSummarizer
extends Serializable {
}
/**
+ * :: Experimental ::
+ * Summary of multi-classification algorithms.
+ *
+ * @param predictions [[DataFrame]] produced by model.transform().
+ * @param predictionCol Name for column of prediction in `predictions`.
+ * @param labelCol Name for column of label in `predictions`.
+ */
+@Experimental
+@Since("2.1.0")
+class MulticlassSummary private[ml] (
+ @transient val predictions: DataFrame,
+ val predictionCol: String,
+ val labelCol: String) extends Serializable {
+
+ @transient private val multinomialMetrics = {
+ new MulticlassMetrics(
+ predictions.select(
+ col(predictionCol),
+ col(labelCol).cast(DoubleType))
+ .rdd.map { case Row(prediction: Double, label: Double) =>
(prediction, label) })
+ }
+
+ /** Returns false positive rate for each label. */
+ @Since("2.1.0")
+ @transient lazy val falsePositiveRateByLabel: Array[Double] = {
+ multinomialMetrics.labels.map(label =>
multinomialMetrics.falsePositiveRate(label))
+ }
+
+ /** Returns precision for each label. */
+ @Since("2.1.0")
--- End diff --
Update all since tags
---
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]