小编M S*_*ava的帖子

使用肘部方法和 K 均值聚类找到最佳聚类数

我正在编写一个程序,需要对一些> 200、300 元素数组的数据集应用 K 均值聚类。有人可以给我提供一个代码链接,并解释一下- 1. 通过肘部方法找到 k 2. 应用 k 均值方法并获取质心数组

我自己搜索了上面的内容,但没有找到任何对代码有明确解释的内容。PS我正在Google Colab工作,所以如果有相同的具体方法,请提出建议


我尝试了下面的代码,但是,我不断收到以下错误 -

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

TypeError: float() argument must be a string or a number, not 'list'


The above exception was the direct cause of the following exception:

ValueError                                Traceback (most recent call last)

<ipython-input-70-68e300fd4bf8> in <module>()
     24 
     25 # step 1: find optimal k (number of clusters)
---> 26 find_best_k()
     27 

3 frames

/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
     83 
     84     """ …
Run Code Online (Sandbox Code Playgroud)

python k-means google-colaboratory

2
推荐指数
1
解决办法
1931
查看次数

标签 统计

google-colaboratory ×1

k-means ×1

python ×1