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

    https://github.com/apache/spark/pull/3636#discussion_r21724909
  
    --- 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.
    +    val testData = GradientDescentSuite.generateGDInput(A, B, nPoints, 42)
    +    val data = testData.map { case LabeledPoint(label, features) =>
    +      label -> MLUtils.appendBias(features)
    +    }
    +
    +    val dataRDD = sc.parallelize(data, 2).cache()
    +    val initialWeightsWithIntercept = Vectors.dense(1.0 +: 
initialWeights.toArray)
    --- End diff --
    
    MLUtils.appendBias appends (to the end), so the extra 1.0 should probably 
go at the end for consistency.


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