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

    https://github.com/apache/spark/pull/3981#discussion_r22737647
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/clustering/GMMExpectationMaximizationSuite.scala
 ---
    @@ -35,12 +35,14 @@ class GMMExpectationMaximizationSuite extends FunSuite 
with MLlibTestSparkContex
         val Ew = 1.0
         val Emu = Vectors.dense(5.0, 10.0)
         val Esigma = Matrices.dense(2, 2, Array(2.0 / 3.0, -2.0 / 3.0, -2.0 / 
3.0, 2.0 / 3.0))
    -    
    -    val gmm = new GaussianMixtureEM().setK(1).run(data)
    -                
    -    assert(gmm.weight(0) ~== Ew absTol 1E-5)
    -    assert(gmm.mu(0) ~== Emu absTol 1E-5)
    -    assert(gmm.sigma(0) ~== Esigma absTol 1E-5)
    +
    +    val seeds = Array(314589, 29032897, 50181, 494821, 4660)
    +    seeds.foreach { seed =>
    +      val gmm = new GaussianMixtureEM().setK(1).setSeed(seed).run(data)
    +      assert(gmm.weight(0) ~== Ew absTol 1E-5)
    +      assert(gmm.mu(0) ~== Emu absTol 1E-5)
    +      assert(gmm.sigma(0) ~== Esigma absTol 1E-5)
    +    }
    --- End diff --
    
    In general, you're correct.  The issue is that, with some probability, the 
5 data points chosen for initializing the cluster will be identical, causing 
initialization of the covariance matrix to fail.
    
    I'd be fine with having this test use only 1 random seed instead of 5, but 
it's fast anyways.


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