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

    https://github.com/apache/spark/pull/3636#discussion_r21556490
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/optimization/GradientDescentSuite.scala
 ---
    @@ -138,6 +138,45 @@ class GradientDescentSuite extends FunSuite with 
MLlibTestSparkContext with Matc
           "The different between newWeights with/without regularization " +
             "should be initialWeightsWithIntercept.")
       }
    +
    +  test("iteration should end with convergence tolerance") {
    +    val nPoints = 10000
    +    val A = 2.0
    +    val B = -1.5
    +
    +    val initialB = -1.0
    +    val initialWeights = Array(initialB)
    +
    +    val gradient = new LogisticGradient()
    +    val updater = new SimpleUpdater()
    +    val stepSize = 1.0
    +    val numIterations = 10
    +    val regParam = 0
    +    val miniBatchFrac = 1.0
    +    val convergenceTolerance = 5.0e-1
    +
    +    // Add a extra variable consisting of all 1.0's for the intercept.
    --- End diff --
    
    I just realized there is already a method for this: MLUtils.appendBias
    Using that might be good since it's more human-readable.


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