自定义的K-均值的距离在禀阿帕奇火花蟒蛇 [英] Customize Distance Formular of K-means in apache spark python

查看:227
本文介绍了自定义的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:

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆