What is k-means clustering in R language clustering algorithm
R language clustering algorithm in the k-means clustering is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
1. Principle analysis:
The k (preset number of categories) samples are randomly selected as the starting center point, and the rest of the samples are classified into the cluster where the similarity center point is the highest (cluster). Then the mean value of the sample coordinates in the current cluster is established as the new center point, and iterates in a cycle until the category to which all samples belong is no longer changed.
two。 Application in R language
In k-means clustering, we apply the kmeans function in the stats package (R language built-in package).
Kmeans (x Hartigan-Wong, Loyd, For-gy, MacQueen))
3. Discriminant analysis with iris dataset as an example
1) apply the model and view the corresponding parameters of the model
Fit_km=kmeans (iris [,-5], center=3)
Fit_ km [1: length (fit_km)]
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.