Pyspark ML KMean 是否有办法获得解释方差?

Does Pyspark ML KMean have a way to get the explained variance?

当我阅读 Pyspark 的 ML 包时 here,似乎 KMeanModel 没有办法计算解释的方差以绘制肘部曲线,建立最佳数量集群。

但是在 this 示例中,用户似乎具有 computeCost() 功能。这个功能是从哪里来的?我的计划没有取得成功。

我正在使用 Spark 1.6。提前致谢!

关于 pyspark 中的 computcost 方法,我遇到了同样的问题。

您可以在应用 kmeans 之后使用 mahalanobis 距离或 WSSE 而不是使用计算成本。

To compute the distance you have to write the code and and getting the various result you can draw the graph to see the knee point for optimum number of cluster .

Anomaly Detection Using PySpark 这个用例帮我看了一下。