Github user yanboliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19020#discussion_r134476397
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
    @@ -344,33 +408,58 @@ class LinearRegression @Since("1.3.0") 
(@Since("1.3.0") override val uid: String
         } else {
           None
         }
    -    val costFun = new RDDLossFunction(instances, getAggregatorFunc, 
regularization,
    -      $(aggregationDepth))
     
    -    val optimizer = if ($(elasticNetParam) == 0.0 || effectiveRegParam == 
0.0) {
    -      new BreezeLBFGS[BDV[Double]]($(maxIter), 10, $(tol))
    -    } else {
    -      val standardizationParam = $(standardization)
    -      def effectiveL1RegFun = (index: Int) => {
    -        if (standardizationParam) {
    -          effectiveL1RegParam
    +    val costFun = $(loss) match {
    +      case LeastSquares =>
    +        val getAggregatorFunc = new LeastSquaresAggregator(yStd, yMean, 
$(fitIntercept),
    +          bcFeaturesStd, bcFeaturesMean)(_)
    +        new RDDLossFunction(instances, getAggregatorFunc, regularization, 
$(aggregationDepth))
    +      case Huber =>
    +        val getAggregatorFunc = new HuberAggregator($(fitIntercept), $(m), 
bcFeaturesStd)(_)
    +        new RDDLossFunction(instances, getAggregatorFunc, regularization, 
$(aggregationDepth))
    --- End diff --
    
    I think no. I was trying to factored it out, but because 
```LeastSquaresAggregator``` and ```HuberAggregator``` pass in the type of 
itself, so the compile will complain. Maybe @sethah can give some suggestion?


---
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]

Reply via email to