[SPARK-22119][FOLLOWUP][ML] Use spherical KMeans with cosine distance
## What changes were proposed in this pull request? In #19340 some comments considered needed to use spherical KMeans when cosine distance measure is specified, as Matlab does; instead of the implementation based on the behavior of other tools/libraries like Rapidminer, nltk and ELKI, ie. the centroids are computed as the mean of all the points in the clusters. The PR introduce the approach used in spherical KMeans. This behavior has the nice feature to minimize the within-cluster cosine distance. ## How was this patch tested? existing/improved UTs Author: Marco Gaido <marcogaido91@gmail.com> Closes #20518 from mgaido91/SPARK-22119_followup.
Showing
- mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeans.scala 48 additions, 6 deletions...main/scala/org/apache/spark/mllib/clustering/KMeans.scala
- mllib/src/test/scala/org/apache/spark/ml/clustering/KMeansSuite.scala 14 additions, 1 deletion...st/scala/org/apache/spark/ml/clustering/KMeansSuite.scala
Please register or sign in to comment