GitHub user bravo-zhang opened a pull request: https://github.com/apache/spark/pull/18898
[SPARK-21245][ML] Resolve code duplication for classification/regression summarizers ## 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 implementation. ## 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? `ml.stat.SummarizersSuite.scala` 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: https://github.com/apache/spark/pull/18898.patch 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 <mzhang1...@gmail.com> 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org