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

    https://github.com/apache/spark/pull/6906#discussion_r34198407
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/clustering/GaussianMixtureSuite.scala
 ---
    @@ -148,6 +148,30 @@ class GaussianMixtureSuite extends SparkFunSuite with 
MLlibTestSparkContext {
         }
       }
     
    +  test("model prediction, parallel and local") {
    +
    +    val data = sc.parallelize(GaussianTestData.data)
    +
    +    val gmm = new GaussianMixture().setK(2).setSeed(0).run(data)
    +
    +    val batchPredictions = gmm.predict(data).collect()
    --- End diff --
    
    Be careful about assuming rows are returned in the same order.  It 
generally works but is not guaranteed.  Instead, how about doing:
    ```
    val batchPredictions = gmm.predict(data)
    batchPredictions.zip(data).collect().foreach { case (batchPred, datum) =>
      assert(batchPred === gmm.predict(datum))
    }
    ```
    Note the use of triple equals (better type handling).
    
    Same for soft predictions.


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