前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >What is k-means, How to set K?

What is k-means, How to set K?

作者头像
杨熹
发布2019-07-22 11:38:30
5000
发布2019-07-22 11:38:30
举报
文章被收录于专栏:杨熹的专栏杨熹的专栏

What is K-means?

figure cited here, recommend reading: K-Means Clustering – What it is and How it Works

K-means is a clustering algorithm, so it's one of the unsupervised machine learning algorithms.

This algorithm aims to group the data into K clusters.

Firstly, we predefine a K, and choose K data points arbitrarily as the centers of K clusters.

Secondly, for each data, we calculate its distances with the K centers. Select its nearest center and distribute it to this cluster.

Thirdly, after distributing all the data points, we compute the new centers within each cluster.

Then iterate step 2 and 3 until the centers are no longer change.

In a word, K-means is to get K clusters, use means to calculate the centers, and assign each sample to its nearest center.


How to set K?

Start with k equals to 1, and calculate its variation which is the worst. Then try k equals to 2, and compare its variation with k=1. ... Each time we increase k, the total variation is smaller than before. Let's plot the reduction in variance per value for k, and find the largest reduction point, like an elbow. For example, this figure shows that when k=3, the variation has the hugest reduction, so we can set k equals to 3.

figure cited here, recommend reading: StatQuest: K-means clustering

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019.07.20 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • What is K-means?
  • How to set K?
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档