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

    https://github.com/apache/spark/pull/3610#discussion_r22077332
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/clustering/KMeansSuite.scala ---
    @@ -90,6 +90,27 @@ class KMeansSuite extends FunSuite with 
MLlibTestSparkContext {
         assert(model.clusterCenters.size === 3)
       }
     
    +  test("deterministic initialization") {
    +    // Create a large-ish set of points for clustering
    +    val points = List.tabulate(1000)(n => Vectors.dense(n, n))
    +    val rdd = sc.parallelize(points, 3)
    +
    +    for (initMode <- Seq(RANDOM, K_MEANS_PARALLEL)) {
    +      // Create three deterministic models and compare cluster means
    +      val model1 = KMeans.train(rdd, k = 10, maxIterations = 2, runs = 1, 
initializationMode = initMode, seed = 42)
    +      val centers1 = model1.clusterCenters
    +
    +      val model2 = KMeans.train(rdd, k = 10, maxIterations = 2, runs = 1, 
initializationMode = initMode, seed = 42)
    +      val centers2 = model2.clusterCenters
    +
    +      val model3 = KMeans.train(rdd, k = 10, maxIterations = 2, runs = 1, 
initializationMode = initMode, seed = 42)
    --- End diff --
    
    Two should be sufficient.


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