aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml
diff options
context:
space:
mode:
authorZheng RuiFeng <ruifengz@foxmail.com>2017-01-19 03:46:37 -0800
committerYanbo Liang <ybliang8@gmail.com>2017-01-19 03:46:37 -0800
commit8ccca9170f983f74a7482f67206dae070c77b419 (patch)
treee2dcfdd1256cdb2e0c1a3ca8a7d148d59fa3f78f /python/pyspark/ml
parent2e62560024999c215cf2373fc9a8070bb2ad5c58 (diff)
downloadspark-8ccca9170f983f74a7482f67206dae070c77b419.tar.gz
spark-8ccca9170f983f74a7482f67206dae070c77b419.tar.bz2
spark-8ccca9170f983f74a7482f67206dae070c77b419.zip
[SPARK-14272][ML] Add Loglikelihood in GaussianMixtureSummary
## What changes were proposed in this pull request? add loglikelihood in GMM.summary ## How was this patch tested? added tests Author: Zheng RuiFeng <ruifengz@foxmail.com> Author: Ruifeng Zheng <ruifengz@foxmail.com> Closes #12064 from zhengruifeng/gmm_metric.
Diffstat (limited to 'python/pyspark/ml')
-rw-r--r--python/pyspark/ml/clustering.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/python/pyspark/ml/clustering.py b/python/pyspark/ml/clustering.py
index 25f97f5696..c6c1a00331 100644
--- a/python/pyspark/ml/clustering.py
+++ b/python/pyspark/ml/clustering.py
@@ -175,6 +175,8 @@ class GaussianMixture(JavaEstimator, HasFeaturesCol, HasPredictionCol, HasMaxIte
3
>>> summary.clusterSizes
[2, 2, 2]
+ >>> summary.logLikelihood
+ 8.14636...
>>> weights = model.weights
>>> len(weights)
3
@@ -281,6 +283,14 @@ class GaussianMixtureSummary(ClusteringSummary):
"""
return self._call_java("probability")
+ @property
+ @since("2.2.0")
+ def logLikelihood(self):
+ """
+ Total log-likelihood for this model on the given data.
+ """
+ return self._call_java("logLikelihood")
+
class KMeansSummary(ClusteringSummary):
"""