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

    https://github.com/apache/spark/pull/10940#discussion_r51050297
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/classification/LogisticRegressionSuite.scala
 ---
    @@ -607,6 +607,74 @@ class LogisticRegressionSuite
         assert(model2.coefficients ~= coefficientsR2 relTol 1E-2)
       }
     
    +
    +  test("an extra large example for review only") {
    +    val trainer1 = (new LogisticRegression).setFitIntercept(false)
    +      .setElasticNetParam(0.0)
    +      .setRegParam(1)
    +      .setStandardization(false)
    +      .setMaxIter(1000)
    +      .setTol(1e-9)
    +
    +    val binaryDatasetWithUniqueColumn = sqlContext.read
    +      .format("libsvm")
    +      .load("../data/mllib/sample_libsvm_data_with_unique_column.txt")
    +
    +    val model1 = trainer1.fit(binaryDatasetWithUniqueColumn)
    +
    +    val interceptR1 = 0.0
    +    val coefficientsR1 = Vectors.dense(0.0301002746509743, 
0.0906099616129797, 0.0954855492088332,
    +      0.0243782420594917, 0.0174024017667667, -0.0006549273929309,
    +      0.0637250665085166, -0.0589532651377124, 0.1383368129434264,
    +      0.0665749825701113, 0.0799386779781182, 0.1198682685242071,
    +      0.1802933312643371, -0.0124797701753129)
    +
    +    assert(model1.intercept ~== interceptR1 absTol 1E-3)
    +    assert(model1.coefficients ~= coefficientsR1 relTol 1E-2)
    +  }
    +
    +  test("binary logistic regression without intercept with L2 
regularizationon " +
    +    "data with unique column without intercept") {
    +    val trainer = (new LogisticRegression).setFitIntercept(false)
    +      .setElasticNetParam(0.0)
    +      .setRegParam(1)
    +      .setStandardization(false)
    +      .setMaxIter(1000)
    +      .setTol(1e-9)
    +
    +    val binaryDatasetWithUniqueColumn = sqlContext.createDataFrame(
    +      sc.parallelize(
    +        Array(
    +          LabeledPoint(label = 1.0, features = Vectors.dense(1, 1)),
    +          LabeledPoint(label = 0.0, features = Vectors.dense(0, 1))
    +        )
    +      )
    +    )
    +
    +    val model = trainer.fit(binaryDatasetWithUniqueColumn)
    +
    +    val interceptR = 0.0
    +    val coefficientsR = Vectors.dense(0.22478867, -0.02241016)
    +
    +    assert(model.intercept ~== interceptR absTol 1E-3)
    +    assert(model.coefficients ~= coefficientsR relTol 1E-2)
    +
    +    /*
    +        Use the following scikit-learn Python code to get a reference 
result:
    --- End diff --
    
    Please move the comments to the beginning of the test.


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