sklearn.cluster.KMeans 报错 ValueError: n_samples=1 should be >= n_clusters=10
来源:互联网 发布:罗斯文数据库 编辑:程序博客网 时间:2024/06/07 03:08
from sklearn.cluster import KMeansk_center_num = 10yc = [1,2,34,6,8,9,0,5,43,9,3123,5432,6823,0,312]kcl = KMeans(n_clusters = k_center_num)cl_obj = kcl.fit(yc)# ErrorValueError: n_samples=1 should be >= n_clusters=10
是因为 一个 list 会被认为是一个 sample。所以,每一个元素都被转化成一个 list。
from sklearn.cluster import KMeansk_center_num = 10yc = [1,2,34,6,8,9,0,5,43,9,3123,5432,6823,0,312]yc = [[i] for i in yc] # 把每个样本变成一个单独的‘向量’就可以了。kcl = KMeans(n_clusters = k_center_num)cl_obj = kcl.fit(yc)
阅读全文
0 0
- sklearn.cluster.KMeans 报错 ValueError: n_samples=1 should be >= n_clusters=10
- sklearn.cluster.KMeans
- sklearn 文档翻译之 sklearn.cluster.KMeans
- sklearn 文档翻译之 sklearn.cluster.KMeans
- HIbernate报should be mapped with insert="false" update="false“错
- DatePickerDialog:void onDateSet报错:current should be >= start and <= end
- sklearn.cluster.Kmeans 聚类研究
- 聚类算法学习----之----sklearn.cluster.KMeans
- PHP报错Only variables should be passed by referen
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false
- (should be mapped with insert="false" update="false")
- should be mapped with insert="false" update="false"
- should be mapped with insert="false" update="false"
- npm: 2.15.1 should be >= 3.0.0 npm install express operation not permitted
- Spark Streaming 报错:kafka.cluster.BrokerEndPoint cannot be cast to kafka.cluster.Broker
- 路由器k2固件改系统时间
- C/C++指针数组的问题
- 如何看懂一个小型的mfc写的工程
- Math ceil()、floor()、round()方法
- 抽象类和接口
- sklearn.cluster.KMeans 报错 ValueError: n_samples=1 should be >= n_clusters=10
- 网络安全与主机基本防护:限制端口、网络升级与SELinux
- 模式匹配之(BF KMP算法)
- CentOS 7 编译安装Nginx
- Linux中,top命令查看CPU利用率
- 每日一题--两个链表的第一个公共结点
- 911-917提升--本周计划
- 平衡二叉树(AVL)的创建、插入、删除
- 系统学习,系统掌握知识与技能