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

    https://github.com/apache/spark/pull/8013#discussion_r36719832
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/LinearRegressionSuite.scala 
---
    @@ -505,4 +505,455 @@ class LinearRegressionSuite extends SparkFunSuite 
with MLlibTestSparkContext {
           .zip(testSummary.residuals.select("residuals").collect())
           .forall { case (Row(r1: Double), Row(r2: Double)) => r1 ~== r2 
relTol 1E-5 }
       }
    +
    +  test("Robust params") {
    +    ParamsSuite.checkParams((new LinearRegression).setRobust(true))
    +    val model = new LinearRegressionModel("RobustReg", Vectors.dense(0.0), 
0.0)
    +    ParamsSuite.checkParams(model)
    +  }
    +
    +  test("Robust regression: default params") {
    +    val lir = (new LinearRegression).setRobust(true)
    +    assert(lir.getLabelCol === "label")
    +    assert(lir.getFeaturesCol === "features")
    +    assert(lir.getPredictionCol === "prediction")
    +    assert(lir.getRegParam === 0.0)
    +    assert(lir.getElasticNetParam === 0.0)
    +    assert(lir.getFitIntercept)
    +    assert(lir.getStandardization)
    +    val model = lir.fit(dataset)
    +    model.transform(dataset)
    +      .select("label", "prediction")
    +      .collect()
    +    assert(model.getFeaturesCol === "features")
    +    assert(model.getPredictionCol === "prediction")
    +    assert(model.intercept !== 0.0)
    +    assert(model.hasParent)
    +  }
    +
    +  test("Robust regression with intercept without regularization") {
    +    val trainer1 = (new LinearRegression).setRobust(true)
    +    // The result should be the same regardless of standardization without 
regularization
    +    val trainer2 = (new 
LinearRegression).setRobust(true).setStandardization(false)
    +    val model1 = trainer1.fit(dataset)
    +    val model2 = trainer2.fit(dataset)
    +
    +    /*
    +       Using the following R code to load the data and train the model 
using glmnet package.
    +
    --- End diff --
    
    Why do you test with `GLMNET`? Is it because all the data in this test 
suite doesn't have outliner? Can you have a test with outliner proving this 
algorithm works?


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