Github user sethah commented on the issue:
https://github.com/apache/spark/pull/15435
So, based on my interpretation of this and how this can actually work, we
need to have:
````scala
sealed trait LogisticRegressionSummary
sealed trait LogisticRegressionTrainingSummary
class MulticlassLogisticRegressionSummary extends LogisticRegressionSummary
class MulticlassLogisticRegressionTrainingSummary extends
MulticlassLogisticRegressionSummary with LogisticRegressionTrainingSummary
class BinaryLogisticRegressionSummary extends
MulticlassLogisticRegressionSummary
class BinaryLogisticRegressionTrainingSummary extends
BinaryLogisticRegressionSummary with LogisticRegressionTrainingSummary
````
Then, in `LogisticRegressionModel` we have:
````scala
def summary: LogisticRegressionTrainingSummary
def binarySummary: BinaryLogisticRegressionTrainingSummary = summary match {
case b: BinaryLogisticRegressionTrainingSummary => b
case _ => throw new Exception()
}
````
And we avoid downcasting in the summary case since
`MulticlassLogisticRegressionSummary` only implements the methods defined in
the trait. Otherwise, we would have to downcast to get access to those methods.
Then if the summary is binary, you can just call binary summary. Anyway, I got
this to compile, and if there is some other way, I'm not seeing it. Would
really like to get some clarification from @jkbradley. Not sure if
@feynmanliang is still involved with Spark.
---
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]