Package smile.clustering.linkage
Class WPGMALinkage
java.lang.Object
smile.clustering.linkage.Linkage
smile.clustering.linkage.WPGMALinkage
Weighted Pair Group Method with Arithmetic mean. WPGMA down-weights the
largest group by giving equal weights to the two branches of the dendrogram
that are about to fuse.
Note that the terms weighted and unweighted refer to the final result, not the math by which it is achieved. Thus, the simple averaging in WPGMA produces a weighted result, and the proportional averaging in UPGMA produces an unweighted result.
-
Constructor Summary
ConstructorDescriptionWPGMALinkage
(double[][] proximity) Constructor.WPGMALinkage
(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 WPGMALinkage
of
(double[][] data) Computes the proximity and the linkage.static <T> WPGMALinkage
Computes the proximity and the linkage.toString()
-
Constructor Details
-
WPGMALinkage
public WPGMALinkage(double[][] proximity) Constructor.- Parameters:
proximity
- the proximity matrix. Only the lower half will be referred.
-
WPGMALinkage
public WPGMALinkage(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.
-