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

    https://github.com/apache/spark/pull/6497#discussion_r31340620
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/clustering/StreamingKMeansSuite.scala
 ---
    @@ -133,6 +133,19 @@ class StreamingKMeansSuite extends FunSuite with 
TestSuiteBase {
         assert(math.abs(c1) ~== 0.8 absTol 0.6)
       }
     
    +  test("test setDecayFactor") {
    +    val initCenters = Array(Vectors.dense(500.0), Vectors.dense(-500.0))
    +    val weights = Array(5.0, 5.0)
    +
    +    // create model with two clusters
    +    val kMeans = new StreamingKMeans()
    +      .setK(2)
    +      .setDecayFactor(1.0)
    +      .setInitialCenters(initCenters, weights)
    +    val decayFactor = kMeans.decayFactor
    +    assert(kMeans.setDecayFactor(0.0).decayFactor != decayFactor)
    --- End diff --
    
    Let's simplify the test.
    
    ~~~scala
    val kMeans = new StrreamingKMeans()
    assert(kMeans.decayFactor === 1.0)
    kMeans.setDecayFactor(2.0)
    assert(kMeans.decayFactor === 2.0)
    ~~~
    
    It is also useful to include the JIRA number in the test name, in case 
people wonder why we have this particular 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