T
- the type of the elements clusteredpublic class Hclust<T> extends Object
T
) hierarchically
using agglomerative clustering with different linkage methods.Modifier and Type | Class and Description |
---|---|
static class |
Hclust.Linkage
The linkage method for clustering
|
Constructor and Description |
---|
Hclust(DistanceMetric<T> metric,
Hclust.Linkage linkage)
Creates a new object for clustering using the supplied distance metric and linkage method.
|
Modifier and Type | Method and Description |
---|---|
ClusterTree<Integer> |
cluster(double[][] distMat,
LinkedList<ClusterTree<Integer>> list,
int indexOff)
Further clusters the supplied cluster trees using the given distance matrix
and creating original indexes for the inner node starting at -indexOff-1 in descending order
|
ClusterTree<T> |
cluster(double[][] distMat,
T... objects)
Clusters the given objects using the supplied distance matrix, which must be in the same
order as the elements provided in
objects . |
ClusterTree<T> |
cluster(int indexOff,
double[][] distMat,
ClusterTree<T>[] leaves)
Clusters the given leaf trees using the supplied distance matrix
|
ClusterTree<T> |
cluster(T... objects)
Clusters the supplied objects and return the resulting cluster tree.
|
ClusterTree<T> |
createTree(ClusterTree<Integer> intTree,
T... objects)
Creates a cluster tree given an index tree using the original indexes refering to the indexes
of elements in
objects . |
static <T> T[][] |
cutTree(ClusterTree<T> tree,
double distance)
Cuts the cluster tree at the specified distance and returns the leaf elements
grouped by their origin in the sub-trees below the cut
|
static <T> ClusterTree<T>[] |
cutTree(double distance,
ClusterTree<T> tree)
Cuts the cluster tree at the given distance and returns the sub-trees below the cut.
|
double |
getDistance(double[][] distMat,
ClusterTree<Integer> tree,
ClusterTree<Integer> tree2)
Returns the distance between the two supplied trees using the linkage method of this
Hclust object
and the given distance matrix. |
public Hclust(DistanceMetric<T> metric, Hclust.Linkage linkage)
metric
- the distance metriclinkage
- the linkage methodpublic ClusterTree<T> cluster(T... objects) throws Exception
objects
- the objects to be clusteredException
- if the distance matrix could not be created using the DistanceMetric
of this Hclust
objectpublic ClusterTree<Integer> cluster(double[][] distMat, LinkedList<ClusterTree<Integer>> list, int indexOff)
distMat
- the distance matrixlist
- the list of previous treesindexOff
- the offset on the original indexespublic ClusterTree<T> cluster(int indexOff, double[][] distMat, ClusterTree<T>[] leaves)
indexOff
- the offset on the original indexesdistMat
- the distance matrixleaves
- the leavescluster(int, double[][], ClusterTree[])
public ClusterTree<T> cluster(double[][] distMat, T... objects)
objects
.distMat
- the distance matrixobjects
- the objects to the clusteredpublic static <T> T[][] cutTree(ClusterTree<T> tree, double distance)
T
- the type of the leavestree
- the treedistance
- the cut distancepublic static <T> ClusterTree<T>[] cutTree(double distance, ClusterTree<T> tree)
T
- the type of the leavesdistance
- the distancetree
- the treepublic ClusterTree<T> createTree(ClusterTree<Integer> intTree, T... objects)
objects
.intTree
- the index treeobjects
- the objects filled into the tree instead of the indexesClusterTree.getIndexTree()
public double getDistance(double[][] distMat, ClusterTree<Integer> tree, ClusterTree<Integer> tree2)
Hclust
object
and the given distance matrix.distMat
- the distance matrixtree
- the first treetree2
- the second tree