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

    https://github.com/apache/spark/pull/8884#discussion_r40518507
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/LinearRegressionSuite.scala 
---
    @@ -113,34 +115,37 @@ class LinearRegressionSuite extends SparkFunSuite 
with MLlibTestSparkContext {
            as.numeric.data.V2. 4.700706
            as.numeric.data.V3. 7.199082
          */
    -    val interceptR = 6.298698
    -    val weightsR = Vectors.dense(4.700706, 7.199082)
    +      val interceptR = 6.298698
    +      val weightsR = Vectors.dense(4.700706, 7.199082)
     
    -    assert(model1.intercept ~== interceptR relTol 1E-3)
    -    assert(model1.weights ~= weightsR relTol 1E-3)
    -    assert(model2.intercept ~== interceptR relTol 1E-3)
    -    assert(model2.weights ~= weightsR relTol 1E-3)
    +      assert(model1.intercept ~== interceptR relTol 1E-3)
    +      assert(model1.weights ~= weightsR relTol 1E-3)
    +      assert(model2.intercept ~== interceptR relTol 1E-3)
    +      assert(model2.weights ~= weightsR 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 without regularization") {
    -    val trainer1 = (new LinearRegression).setFitIntercept(false)
    -    // Without regularization the results should be the same
    -    val trainer2 = (new 
LinearRegression).setFitIntercept(false).setStandardization(false)
    -    val model1 = trainer1.fit(dataset)
    -    val modelWithoutIntercept1 = trainer1.fit(datasetWithoutIntercept)
    -    val model2 = trainer2.fit(dataset)
    -    val modelWithoutIntercept2 = trainer2.fit(datasetWithoutIntercept)
    -
    -
    -    /*
    +    Seq("auto", "l-bfgs", "normal").foreach(solver => {
    +      val trainer1 = (new 
LinearRegression).setFitIntercept(false).setSolver(solver)
    +      // Without regularization the results should be the same
    +      val trainer2 = (new 
LinearRegression).setFitIntercept(false).setStandardization(false)
    +        .setSolver(solver)
    +      val model1 = trainer1.fit(dataset)
    +      val modelWithoutIntercept1 = trainer1.fit(datasetWithoutIntercept)
    +      val model2 = trainer2.fit(dataset)
    +      val modelWithoutIntercept2 = trainer2.fit(datasetWithoutIntercept)
    +
    --- End diff --
    
    remove extra line


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