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

    https://github.com/apache/spark/pull/14326#discussion_r71992352
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/regression/RobustRegression.scala ---
    @@ -0,0 +1,466 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.ml.regression
    +
    +import scala.collection.mutable
    +
    +import breeze.linalg.{DenseVector => BDV}
    +import breeze.optimize.{CachedDiffFunction, DiffFunction, LBFGS => 
BreezeLBFGS, LBFGSB => BreezeLBFGSB}
    +
    +import org.apache.spark.SparkException
    +import org.apache.spark.annotation.Since
    +import org.apache.spark.internal.Logging
    +import org.apache.spark.ml.PredictorParams
    +import org.apache.spark.ml.feature.Instance
    +import org.apache.spark.ml.linalg.{Vector, Vectors}
    +import org.apache.spark.ml.linalg.BLAS._
    +import org.apache.spark.ml.param.{DoubleParam, ParamMap, ParamValidators}
    +import org.apache.spark.ml.param.shared._
    +import org.apache.spark.ml.util._
    +import org.apache.spark.mllib.linalg.VectorImplicits._
    +import org.apache.spark.mllib.stat.MultivariateOnlineSummarizer
    +import org.apache.spark.rdd.RDD
    +import org.apache.spark.sql.{Dataset, Row}
    +import org.apache.spark.sql.functions._
    +import org.apache.spark.storage.StorageLevel
    +
    +/**
    + * Params for robust regression.
    + */
    +private[regression] trait RobustRegressionParams extends PredictorParams 
with HasRegParam
    +  with HasMaxIter with HasTol with HasFitIntercept with HasStandardization 
with HasWeightCol {
    +
    +  /**
    +   * The shape parameter to control the amount of robustness. Must be > 
1.0.
    +   * At larger values of M, the huber criterion becomes more similar to 
least squares regression;
    +   * for small values of M, the criterion is more similar to L1 regression.
    +   * Default is 1.35 to get as much robustness as possible while retaining
    +   * 95% statistical efficiency for normally distributed data.
    +   */
    +  @Since("2.1.0")
    +  final val m = new DoubleParam(this, "m", "The shape parameter to control 
the amount of " +
    +    "robustness. Must be > 1.0.", ParamValidators.gt(1.0))
    +
    +  /** @group getParam */
    +  @Since("2.1.0")
    +  def getM: Double = $(m)
    +}
    +
    +/**
    + * Robust regression.
    + *
    + * The learning objective is to minimize the huber loss, with 
regularization.
    + *
    + * The robust regression optimizes the squared loss for the samples where
    + * {{{ |\frac{(y - X \beta)}{\sigma}|\leq M }}}
    + * and the absolute loss for the samples where
    + * {{{ |\frac{(y - X \beta)}{\sigma}|\geq M }}},
    + * where \beta and \sigma are parameters to be optimized.
    + *
    + * This supports two types of regularization: None and L2.
    + *
    + * This estimator is different from the R implementation of Robust 
Regression
    + * ([[http://www.ats.ucla.edu/stat/r/dae/rreg.htm]]) because the R 
implementation does a
    + * weighted least squares implementation with weights given to each sample 
on the basis
    + * of how much the residual is greater than a certain threshold.
    + */
    +@Since("2.1.0")
    +class RobustRegression @Since("2.1.0") (@Since("2.1.0") override val uid: 
String)
    --- End diff --
    
    Are all `@Since` required? I'd think the one on line 82 would be enough.


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

Reply via email to