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

    https://github.com/apache/spark/pull/8884#discussion_r41810212
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/LinearRegressionSuite.scala 
---
    @@ -93,525 +94,559 @@ class LinearRegressionSuite extends SparkFunSuite 
with MLlibTestSparkContext {
       }
     
       test("linear regression with intercept without regularization") {
    -    val trainer1 = new LinearRegression
    -    // The result should be the same regardless of standardization without 
regularization
    -    val trainer2 = (new LinearRegression).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.
    -
    -       library("glmnet")
    -       data <- read.csv("path", header=FALSE, stringsAsFactors=FALSE)
    -       features <- as.matrix(data.frame(as.numeric(data$V2), 
as.numeric(data$V3)))
    -       label <- as.numeric(data$V1)
    -       weights <- coef(glmnet(features, label, family="gaussian", alpha = 
0, lambda = 0))
    -       > weights
    -        3 x 1 sparse Matrix of class "dgCMatrix"
    -                                 s0
    -       (Intercept)         6.298698
    -       as.numeric.data.V2. 4.700706
    -       as.numeric.data.V3. 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)
    -
    -
    -    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)
    -    }
    +    Seq("auto", "l-bfgs", "normal").foreach { solver => {
    --- End diff --
    
    The `{` in ` solver => {` is not needed.


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