GitHub user bravo-zhang opened a pull request:
[SPARK-21245][ML] Resolve code duplication for classification/regression
## Why the change?
In several places (LogReg, LinReg, SVC) in Spark ML, we collect summary
information about training data using `MultivariateOnlineSummarizer` and
`MulticlassSummarizer`. We have the same code appearing in several places
(including test suites). We can eliminate this by creating a common
## What changes were proposed in this pull request?
1. A new class `ml.stat.Summarizers.scala` with `def
getRegressionSummarizers` and `def getClassificationSummarizers` that provides
a pair of feature and label summarizers.
This centralizes the duplicated code in: `LinearRegression`, `LinearSVC`,
`LogisticRegression` and `DifferentiableLossAggregatorSuite`.
2. Moves `MultiClassSummarizer.scala`(and testSuite) out of
`LogisticRegression.scala` to new file `ml.stat.MultiClassSummarizer.scala`,
because it is also used by `LinearSVC` and can be generalized.
## How was this patch tested?
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/bravo-zhang/spark spark-21245
Alternatively you can review and apply these changes as the patch at:
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #18898
Author: bravo-zhang <mzhang1...@gmail.com>
Resolve code duplication for classification/regression summarizers
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 infrastruct...@apache.org or file a JIRA ticket
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org