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 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
commit 1f5209f7e40c520e1c6b6b5943ef87fde7d5b254
Author: bravo-zhang <>
Date:   2017-08-09T16:05:23Z

    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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to