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

    https://github.com/apache/spark/pull/8884#discussion_r40518653
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/LinearRegressionSuite.scala 
---
    @@ -206,30 +213,32 @@ class LinearRegressionSuite extends SparkFunSuite 
with MLlibTestSparkContext {
           as.numeric.data.V2. 3.893869
           as.numeric.data.V3. 6.724286
          */
    -    val interceptR2 = 6.416948
    -    val weightsR2 = Vectors.dense(3.893869, 6.724286)
    +      val interceptR2 = 6.416948
    +      val weightsR2 = Vectors.dense(3.893869, 6.724286)
     
    -    assert(model2.intercept ~== interceptR2 relTol 1E-3)
    -    assert(model2.weights ~= weightsR2 relTol 1E-3)
    +      assert(model2.intercept ~== interceptR2 relTol 1E-3)
    +      assert(model2.weights ~= weightsR2 relTol 1E-3)
     
     
    -    model1.transform(dataset).select("features", 
"prediction").collect().foreach {
    -      case Row(features: DenseVector, prediction1: Double) =>
    -        val prediction2 =
    -          features(0) * model1.weights(0) + features(1) * 
model1.weights(1) + model1.intercept
    -        assert(prediction1 ~== prediction2 relTol 1E-5)
    -    }
    +      model1.transform(dataset).select("features", 
"prediction").collect().foreach {
    +        case Row(features: DenseVector, prediction1: Double) =>
    +          val prediction2 =
    +            features(0) * model1.weights(0) + features(1) * 
model1.weights(1) + model1.intercept
    +          assert(prediction1 ~== prediction2 relTol 1E-5)
    +      }
    +    })
       }
     
       test("linear regression without intercept with L1 regularization") {
    -    val trainer1 = (new 
LinearRegression).setElasticNetParam(1.0).setRegParam(0.57)
    -      .setFitIntercept(false)
    -    val trainer2 = (new 
LinearRegression).setElasticNetParam(1.0).setRegParam(0.57)
    -      .setFitIntercept(false).setStandardization(false)
    -    val model1 = trainer1.fit(dataset)
    -    val model2 = trainer2.fit(dataset)
    -
    -    /*
    +    Seq("auto").foreach(solver => {
    +      val trainer1 = (new 
LinearRegression).setElasticNetParam(1.0).setRegParam(0.57)
    +        .setFitIntercept(false).setSolver(solver)
    +      val trainer2 = (new 
LinearRegression).setElasticNetParam(1.0).setRegParam(0.57)
    +        .setFitIntercept(false).setStandardization(false).setSolver(solver)
    +      val model1 = trainer1.fit(dataset)
    +      val model2 = trainer2.fit(dataset)
    +
    +      /*
            weights <- coef(glmnet(features, label, family="gaussian", alpha = 
1.0, lambda = 0.57,
    --- End diff --
    
    ditto


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