Database Reference
In-Depth Information
See also…
F
For information about K-Means clustering, Wikipedia provides a good introduction at
F
For information about Weka's
SimpleKMeans
class, including an explanation of its
options, see
http://weka.sourceforge.net/doc.dev/weka/clusterers/
written a longer tutorial on macros, which is available at
http://writingcoding.
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
iles 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 it from
http://www.
ericrochester.com/clj-data-analysis/data/UCI/iris.arff
.
You can also
download it, and other datasets, in a JAR ile from
http://weka.wikispaces.com/
into Weka
recipe:
(def iris (load-arff "data/UCI/iris.arff"))
We'll also use the
defanalysis
macro that we deined in the
Discovering groups of data
using K-Means clustering
recipe.