public class HierarchicalClustering
extends java.lang.Object
implements java.io.Serializable
In general, the merges are determined in a greedy manner. In order to decide which clusters should be combined, a measure of dissimilarity between sets of observations is required. In most methods of hierarchical clustering, this is achieved by use of an appropriate metric, and a linkage criteria which specifies the dissimilarity of sets as a function of the pairwise distances of observations in the sets.
Hierarchical clustering has the distinct advantage that any valid measure of distance can be used. In fact, the observations themselves are not required: all that is used is a matrix of distances.
Linkage
,
Serialized FormConstructor and Description |
---|
HierarchicalClustering(int[][] tree,
double[] height)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
static HierarchicalClustering |
fit(Linkage linkage)
Fits the Agglomerative Hierarchical Clustering with given linkage
method, which includes proximity matrix.
|
double[] |
getHeight()
Returns a set of n-1 non-decreasing real values, which are the clustering height,
i.e., the value of the criterion associated with the clustering method
for the particular agglomeration.
|
int[][] |
getTree()
Returns an n-1 by 2 matrix of which row i describes the merging of clusters at
step i of the clustering.
|
int[] |
partition(double h)
Cuts a tree into several groups by specifying the cut height.
|
int[] |
partition(int k)
Cuts a tree into several groups by specifying the desired number.
|
public HierarchicalClustering(int[][] tree, double[] height)
tree
- an n-1 by 2 matrix of which row i describes the merging
of clusters at step i of the clustering.height
- the clustering height.public static HierarchicalClustering fit(Linkage linkage)
linkage
- a linkage method to merge clusters. The linkage object
includes the proximity matrix of data.public int[][] getTree()
public double[] getHeight()
public int[] partition(int k)
k
- the number of clusters.public int[] partition(double h)
h
- the cut height.