机器学习(八) — K-means

发布时间:2024年01月18日

model 5 — K-means

1 definition

  1. randomly initialize K cluster centroids μ 1 , μ 2 , ? \mu_1, \mu_2, \cdots μ1?,μ2?,?
  2. repeat:
    • assign each point to its closest centroid μ \mu μ
    • recompute the centroids(average of the closest point)

在这里插入图片描述

2 optimazation objective

  1. c ( i ) c^{(i)} c(i) = index of cluster to which example x ( i ) x^{(i)} x(i) is currently assigned
  2. μ k \mu_k μk? = cluster centroid k
  3. μ c ( i ) \mu_{c^{(i)}} μc(i)? = cluster centroid of cluster to which example x ( i ) x^{(i)} x(i) has been assigned

J = 1 m ∑ i = 1 m ∥ x ( i ) ? μ c ( i ) ∥ J = \frac{1}{m} \sum_{i=1}^m \| x^{(i)} - \mu_{c^{(i)}} \| J=m1?i=1m?x(i)?μc(i)?

3 randomly initialization

for i = 1 to n(usually 50 to 1000)
	randomly initialize K-means
	run K-means
	compute cost function
	
pick set of clusters that give the lowest cost
文章来源:https://blog.csdn.net/m0_65591847/article/details/135641839
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。