Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is k-means clustering in R language clustering algorithm

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report