Hclust (d, method = "complete", Members=null)
D is the distance matrix.
Method represents the merging methods of the class, which are:
Single Shortest distance method
Complete the longest distance method
Median intermediate distance method
McQuitty Similarity method
Average class averaging method
Centroid Center of gravity method
Ward Deviation squared sum method
# ' Example
D <-Dist (x)
HC <-Hclust (d, "single")
Plot (HC)
# ' Then you can use Rect.hclust (tree, k = null, which = NULL, x = null, h = Null,border = 2, cluster = NULL) to determine the number of classes. # ' tree is the object of the finding. K is the number of classifications, and H is the threshold for the distance between classes. Border are painted colors that are used for classification.
Rect.hclust (hc,k=2)
Rect.hclust (hc,h=0.5)
# ' Extract the categories to which each sample belongs
Label <-Cutree (hc,k=2)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.