Search code examples
apache-sparkpysparkapache-spark-ml

Bisecting K-Means spark ml - what is the division rule?


I started using Bisecting K-Means Clustering in pyspark and I am wondering what is the division rule during clustering.

I know that K-Means is done there, but how next cluster for next division is selected? I have seen that there are couple of methods ( eg. biggest cluster is divided / cluster with less internal similarity), but I can't find what is division rule implemented in spark ml.

Thank you for help


Solution

  • According to the Pyspark ML documentation (https://spark.apache.org/docs/latest/api/python/pyspark.ml.html#pyspark.ml.clustering.BisectingKMeans), Bisecting KMeans algorithm is based on the paper “A comparison of document clustering techniques” by Steinbach, Karypis, and Kumar (https://www.cs.cmu.edu/~dunja/KDDpapers/Steinbach_IR.pdf).

    In section 3:

    We found little difference between the possible methods for selecting a cluster to split and chose to split the largest remaining cluster.

    Modifications were made for Pyspark. According to the Pyspark doc :

    The algorithm starts from a single cluster that contains all points. Iteratively it finds divisible clusters on the bottom level and bisects each of them using k-means, until there are k leaf clusters in total or no leaf clusters are divisible. The bisecting steps of clusters on the same level are grouped together to increase parallelism. If bisecting all divisible clusters on the bottom level would result more than k leaf clusters, larger clusters get higher priority.