Finding hierarchical clusters in Weka
Another common way to cluster data is the hierarchical way. This involves either splitting the dataset down to pairs (divisive or top-down) or building the clusters up by pairing the data or clusters that are closest to each other (agglomerative or bottom-up).
Weka has a class HierarchicalClusterer
to perform agglomerative hierarchical clustering. We'll use the defanalysis
macro that we created in the Discovering groups of data using K-Means clustering recipe to create a wrapper function for this analysis as well.
Getting ready
We'll use the same project.clj
dependencies that we did in the Loading CSV and ARFF files into Weka recipe, and this set of imports:
(import [weka.core EuclideanDistance] [weka.clusterers HierarchicalClusterer]) (require '[clojure.string :as str])
Because hierarchical clustering can be memory intensive, we'll use the Iris dataset, which is fairly small. The easiest way to get this dataset is to download...