Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/9931#discussion_r48909691
--- Diff: python/pyspark/ml/clustering.py ---
@@ -36,6 +36,14 @@ def clusterCenters(self):
"""Get the cluster centers, represented as a list of NumPy
arrays."""
return [c.toArray() for c in self._call_java("clusterCenters")]
+ @since("1.6.0")
+ def computeCost(self, dataset):
+ """
+ Return the K-means cost (sum of squared distances of points to
their nearest center)
+ for this model on the given data.
+ """
+ return self._java_obj.computeCost(dataset._jdf)
--- End diff --
Use _call_java instead of accessing the _java_obj (That seems to be the
more common pattern.)
---
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]