Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/15435#discussion_r106726431
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
---
@@ -1242,11 +1312,122 @@ class BinaryLogisticRegressionSummary
private[classification] (
* This will change in later Spark versions.
*/
@Since("1.5.0")
- @transient lazy val recallByThreshold: DataFrame = {
+ def recallByThreshold: DataFrame = {
binaryMetrics.recallByThreshold().toDF("threshold", "recall")
}
}
+sealed trait BinaryLogisticRegressionTrainingSummary extends
BinaryLogisticRegressionSummary
+ with LogisticRegressionTrainingSummary {
+
+}
+
+/**
+ * :: Experimental ::
+ * Multinomial logistic regression training results.
+ *
+ * @param predictions dataframe output by the model's `transform` method.
+ * @param probabilityCol field in "predictions" which gives the
probability of
+ * each class as a vector.
+ * @param predictionCol field in "predictions" which gives the prediction
for a data instance as a
+ * double.
+ * @param labelCol field in "predictions" which gives the true label of
each instance.
+ * @param featuresCol field in "predictions" which gives the features of
each instance as a vector.
+ * @param objectiveHistory objective function (scaled loss +
regularization) at each iteration.
+ */
+@Experimental
+@Since("1.5.0")
+class LogisticRegressionTrainingSummaryImpl private[classification](
+ predictions: DataFrame,
+ probabilityCol: String,
+ predictionCol: String,
+ labelCol: String,
+ featuresCol: String,
+ @Since("1.5.0") val objectiveHistory: Array[Double])
+ extends LogisticRegressionSummaryImpl(
+ predictions, probabilityCol, predictionCol, labelCol, featuresCol)
+ with LogisticRegressionTrainingSummary {
+
+}
+
+/**
+ * :: Experimental ::
+ * Multinomial Logistic regression results for a given model.
+ *
+ * @param predictions dataframe output by the model's `transform` method.
+ * @param probabilityCol field in "predictions" which gives the
probability of
+ * each class as a vector.
+ * @param predictionCol field in "predictions" which gives the prediction
for a data instance as a
+ * double.
+ * @param labelCol field in "predictions" which gives the true label of
each instance.
+ * @param featuresCol field in "predictions" which gives the features of
each instance as a vector.
+ */
+@Experimental
+@Since("2.2.0")
+class LogisticRegressionSummaryImpl private[classification](
+ @Since("2.2.0") @transient override val predictions: DataFrame,
+ @Since("2.2.0") override val probabilityCol: String,
+ @Since("2.2.0") override val predictionCol: String,
+ @Since("2.2.0") override val labelCol: String,
+ @Since("2.2.0") override val featuresCol: String)
+ extends LogisticRegressionSummary {
+
+}
+
+/**
+ * :: Experimental ::
+ * Binary Logistic regression training results.
+ *
+ * @param predictions dataframe output by the model's `transform` method.
+ * @param probabilityCol field in "predictions" which gives the
probability of
+ * each class as a vector.
+ * @param predictionCol field in "predictions" which gives the prediction
for a data instance as a
+ * double.
+ * @param labelCol field in "predictions" which gives the true label of
each instance.
+ * @param featuresCol field in "predictions" which gives the features of
each instance as a vector.
+ * @param objectiveHistory objective function (scaled loss +
regularization) at each iteration.
+ */
+@Experimental
+@Since("2.2.0")
+class BinaryLogisticRegressionTrainingSummaryImpl private[classification] (
+ predictions: DataFrame,
+ probabilityCol: String,
+ predictionCol: String,
+ labelCol: String,
+ featuresCol: String,
+ @Since("1.5.0") override val objectiveHistory: Array[Double])
+ extends BinaryLogisticRegressionSummaryImpl(
+ predictions, probabilityCol, predictionCol, labelCol, featuresCol)
+ with BinaryLogisticRegressionTrainingSummary {
+
+}
+
+/**
+ * :: Experimental ::
+ * Binary Logistic regression results for a given model.
+ *
+ * @param predictions dataframe output by the model's `transform` method.
+ * @param probabilityCol field in "predictions" which gives the
probability of
+ * each class as a vector.
+ * @param predictionCol field in "predictions" which gives the prediction
of
+ * each class as a vector.
+ * @param labelCol field in "predictions" which gives the true label of
each instance.
+ * @param featuresCol field in "predictions" which gives the features of
each instance as a vector.
+ */
+@Experimental
+@Since("1.5.0")
--- End diff --
Please review all since tags for correctness.
---
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]