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

    https://github.com/apache/spark/pull/15777#discussion_r86653456
  
    --- Diff: python/pyspark/ml/tests.py ---
    @@ -1097,6 +1097,42 @@ def test_logistic_regression_summary(self):
             sameSummary = model.evaluate(df)
             self.assertAlmostEqual(sameSummary.areaUnderROC, s.areaUnderROC)
     
    +    def test_gaussian_mixture_summary(self):
    +        data = [(Vectors.dense(1.0),), (Vectors.dense(5.0),), 
(Vectors.dense(10.0),),
    +                (Vectors.sparse(1, [], []),)]
    +        df = self.spark.createDataFrame(data, ["features"])
    +        gmm = GaussianMixture(k=2)
    +        model = gmm.fit(df)
    +        self.assertTrue(model.hasSummary)
    +        s = model.summary
    +        self.assertTrue(isinstance(s.predictions, DataFrame))
    +        self.assertEqual(s.probabilityCol, "probability")
    +        self.assertTrue(isinstance(s.probability, DataFrame))
    +        self.assertEqual(s.featuresCol, "features")
    +        self.assertEqual(s.predictionCol, "prediction")
    +        self.assertTrue(isinstance(s.cluster, DataFrame))
    +        self.assertEqual(len(s.clusterSizes), 2)
    +        self.assertEqual(s.k, 2)
    +
    +        # TODO: test when there is no summary
    --- End diff --
    
    We should test that `hasSummary` returns `False` when there is no summary 
available, and that `summary` throws an exception. The problem I'm having is 
that I'm not sure how to create this test case. The only way to get a model is 
by calling fit, which will produce a model with a summary. Calling 
`model._call_java("setSummary", None)` doesn't work either. Is there some way 
that I'm missing?


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