One of the most popular and well-known clustering methods is K-means clustering. It's conceptually simple. It's also easy to implement and computationally cheap. We can get decent results quickly for many different datasets.
On the downside, it sometimes gets stuck in local optima and misses a better solution altogether.
Generally, K-means clustering works best when groups in the data are spatially distinct. This means that if the natural groups in the data overlap, the clusters that K-means generates will not properly distinguish the natural groups in the data.
For this recipe, we'll need the same dependencies in our project.clj
file that we used in the Loading CSV and ARFF files into Weka recipe.
We'll need a slightly different set of imports in our script or REPL, however.
(import [weka.core EuclideanDistance] [weka.clusterers SimpleKMeans])
For data, we'll use the Iris dataset, which is often used for learning about...