跳到主要内容

资源 · 指南或文章

k-Means Algorithm

k-Means 聚类入门,适合可能被要求讲解或编写一个简单无监督机器学习算法的候选人。

审核日期

打开原站: k-Means Algorithm (在新标签页中打开原网站)

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

The k-Means algorithm is an unsupervised Machine Learning algorithm. It's a clustering algorithm, which groups the sample data on the basis of similarity between dimensions of vectors. In k-Means classification, the output is a set of classes assigned to each vector. Each cluster location is continuously optimized in order to get the accurate locations of each cluster such that they represent each group clearly. The idea is to calculate the similarity between cluster location and data vectors, and reassign clusters based on it. Euclidean distance is used mostly for this task.

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
参考资料

涵盖内容

  • 六步循环:初始化 k 个质心,按距离分配各点,重新计算质心,重复。
  • 欧几里得距离是常用的相似度度量。
  • 一段收敛动画,以及质心移动幅度随迭代逐渐减小的观察。
  • Code Examples 部分链接到该目录下的 JavaScript 实现及其测试文件。

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

只依据这六个步骤,在一个小型二维数据集上编写 k-Means,再与该目录下的 kMeans.js 及其测试进行比较。

范围与局限

内容简短:没有关于如何选择 k、初始化陷阱或复杂度的指导。代码只有 JavaScript。附有葡萄牙文译本的链接。

获取方式与形式

GitHub 上 trekhleb/javascript-algorithms(MIT)中的免费英文 README,与 JavaScript 源码放在一起。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/algorithms/ml/k-means/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱