Package smile.clustering.linkage
Class UPGMALinkage
java.lang.Object
smile.clustering.linkage.Linkage
smile.clustering.linkage.UPGMALinkage
Unweighted Pair Group Method with Arithmetic mean (also known as average linkage).
The distance between two clusters is the mean distance between all possible
pairs of nodes in the two clusters.
In bioinformatics, UPGMA is used for the creation of phenetic trees (phenograms). UPGMA assumes a constant rate of evolution (molecular clock hypothesis), and is not a well-regarded method for inferring relationships unless this assumption has been tested and justified for the data set being used.
-
Constructor Summary
ConstructorDescriptionUPGMALinkage
(double[][] proximity) Constructor.UPGMALinkage
(int size, float[] proximity) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
merge
(int i, int j) Merges two clusters into one and update the proximity matrix.static UPGMALinkage
of
(double[][] data) Computes the proximity and the linkage.static <T> UPGMALinkage
Computes the proximity and the linkage.toString()
-
Constructor Details
-
UPGMALinkage
public UPGMALinkage(double[][] proximity) Constructor.- Parameters:
proximity
- the proximity matrix. Only the lower half will be referred.
-
UPGMALinkage
public UPGMALinkage(int size, float[] proximity) Constructor. Initialize the linkage with the lower triangular proximity matrix.- Parameters:
size
- the data size.proximity
- the column-wise linearized proximity matrix that stores only the lower half. The length of proximity should be size * (size+1) / 2. To save space, Linkage will use this argument directly without copy. The elements may be modified.
-
-
Method Details
-
of
Computes the proximity and the linkage.- Parameters:
data
- the data points.- Returns:
- the linkage.
-
of
Computes the proximity and the linkage.- Type Parameters:
T
- the data type of points.- Parameters:
data
- the data points.distance
- the distance function.- Returns:
- the linkage.
-
toString
-
merge
public void merge(int i, int j) Description copied from class:Linkage
Merges two clusters into one and update the proximity matrix.
-