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

    https://github.com/apache/spark/pull/8013#discussion_r36719346
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala ---
    @@ -645,3 +658,80 @@ private class LeastSquaresCostFun(
         (leastSquaresAggregator.loss + regVal, new BDV(totalGradientArray))
       }
     }
    +
    +/**
    + * HuberCostFun implements Breeze's DiffFunction[T] for Huber cost as used 
in Robust regression.
    + * The Huber M-estimator corresponds to a probability distribution for the 
errors which is normal
    + * in the centre but like a double exponential distribution in the tails 
(Hogg 1979: 109).
    + * L = 1/2 ||A weights-y||^2 if |A weights-y| <= k
    + * L = k |A weights-y| - 1/2 K^2 if |A weights-y| > k
    + * where k = 1.345 which produce 95% efficiency when the errors are normal 
and
    + * substantial resistance to outliers otherwise.
    + * See also the documentation for the precise formulation.
    + * It's used in Breeze's convex optimization routines.
    + */
    +private class HuberCostFun(
    +    data: RDD[(Double, Vector)],
    +    labelStd: Double,
    +    labelMean: Double,
    +    fitIntercept: Boolean,
    +    standardization: Boolean,
    +    featuresStd: Array[Double],
    +    featuresMean: Array[Double],
    +    effectiveL2regParam: Double) extends DiffFunction[BDV[Double]] {
    +
    +  override def calculate(weights: BDV[Double]): (Double, BDV[Double]) = {
    +    val w = Vectors.fromBreeze(weights)
    +
    +    val leastSquaresAggregator = data.treeAggregate(new 
LeastSquaresAggregator(w, labelStd,
    +      labelMean, fitIntercept, featuresStd, featuresMean))(
    --- End diff --
    
    Do you have reference paper of the objective function of robust regression? 
My gut feeling is that the condition is per instance, which means if the one 
particular sample has high error, we make the impact smaller. But you are still 
using `LeastSquaresAggregator`, and have the condition applied in the whole 
objective function. I may be wrong. Thanks.


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