Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/15435#discussion_r106726296
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/classification/LogisticRegression.scala
---
@@ -780,19 +788,33 @@ class LogisticRegressionModel private[spark] (
throw new SparkException("No training summary available for this
LogisticRegressionModel")
}
+ @Since("2.2.0")
+ def binarySummary: BinaryLogisticRegressionTrainingSummary = summary
match {
--- End diff --
The behavior we are implementing is non-trivial. We need to add tests to
ensure that everything happens as expected. This is an example:
````scala
test("binary and multiclass summary") {
val lr = new LogisticRegression()
.setFamily("binomial")
val blorModel = lr.fit(smallBinaryDataset)
assert(blorModel.summary.isInstanceOf[BinaryLogisticRegressionTrainingSummaryImpl])
assert(blorModel.binarySummary.isInstanceOf[BinaryLogisticRegressionTrainingSummaryImpl])
val mlorModel = lr.setFamily("multinomial").fit(smallMultinomialDataset)
assert(mlorModel.summary.isInstanceOf[LogisticRegressionTrainingSummaryImpl])
withClue("cannot get binary summary for multiclass model") {
intercept[RuntimeException] {
mlorModel.binarySummary
}
}
val blorSummary = blorModel.evaluate(smallBinaryDataset)
val mlorSummary = mlorModel.evaluate(smallMultinomialDataset)
assert(blorSummary.isInstanceOf[BinaryLogisticRegressionSummaryImpl])
assert(mlorSummary.isInstanceOf[LogisticRegressionSummaryImpl])
}
````
---
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]