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

    https://github.com/apache/spark/pull/15413#discussion_r94085951
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/clustering/GaussianMixtureSuite.scala 
---
    @@ -126,6 +141,106 @@ class GaussianMixtureSuite extends SparkFunSuite with 
MLlibTestSparkContext
         testEstimatorAndModelReadWrite(gm, dataset,
           GaussianMixtureSuite.allParamSettings, checkModelData)
       }
    +
    +  test("univariate dense data with two clusters") {
    +    val weights = Array(2.0 / 3.0, 1.0 / 3.0)
    +    val mean = Array(Vectors.dense(5.1604), Vectors.dense(-4.3673))
    +    val cov = Array(Matrices.dense(1, 1, Array(0.86644)), 
Matrices.dense(1, 1, Array(1.1098)))
    +
    +    val gmm = new GaussianMixture().setK(2).fit(denseDataset)
    +
    +    assert(gmm.weights(0) ~== weights(0) absTol 1E-3)
    +    assert(gmm.weights(1) ~== weights(1) absTol 1E-3)
    +    assert(gmm.gaussians(0).mean ~== mean(0) absTol 1E-3)
    +    assert(gmm.gaussians(1).mean ~== mean(1) absTol 1E-3)
    +    assert(gmm.gaussians(0).cov ~== cov(0) absTol 1E-3)
    +    assert(gmm.gaussians(1).cov ~== cov(1) absTol 1E-3)
    +  }
    +
    +  test("univariate sparse data with two clusters") {
    +    val weights = Array(2.0 / 3.0, 1.0 / 3.0)
    +    val mean = Array(Vectors.dense(5.1604), Vectors.dense(-4.3673))
    +    val cov = Array(Matrices.dense(1, 1, Array(0.86644)), 
Matrices.dense(1, 1, Array(1.1098)))
    +
    +    val gmm = new GaussianMixture().setK(2).fit(sparseDataset)
    --- End diff --
    
    Set the seed in this and other tests


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