自定义的K-均值的距离在禀阿帕奇火花蟒蛇 [英] Customize Distance Formular of K-means in apache spark python
本文介绍了自定义的K-均值的距离在禀阿帕奇火花蟒蛇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在即时通讯使用K-均值聚类及以下
本教程
和 API
但我想使用自定义的公式推计算距离。那么,如何可以通过自定义的距离函数K-均值与PySpark?
请帮我解决这个问题!
Now im using K-means for clustering and following this tutorial and API But i want to use custom formular for calculate distances. So how can i pass custom distance functions in k-means with PySpark? Please help me to solve this problem!
推荐答案
这是不可能的,即使是它是没有意义的:
It is not possible and even if it was it wouldn't make sense:
- 这是不可能的,因为MLlib算法在Scala中实现的PySpark仅提供执行斯卡拉code要求包装
- 这是没有意义的,因为K-手段(不像 K-medoids 中)算法仅被定义为欧氏距离。请参见聚类算法只使用欧氏距离度量为什么K-手段?一个解释。
- it is not possible because MLlib algorithms are implemented in Scala an PySpark provides only a wrappers required to execute Scala code
- it wouldn't make sense because k-means (unlike k-medoids) algorithm is defined only for Euclidean distances. See Why does k-means clustering algorithm use only Euclidean distance metric? for an explanation.
这篇关于自定义的K-均值的距离在禀阿帕奇火花蟒蛇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文