1. KMeans警告
ConvergenceWarning: Number of distinct clusters (1) found smaller than n_clusters (10). Possibly due to duplicate points in X.
cluster.KMeans(
修改前
修改后
2.上述警告修改后,初始化 1 未收敛警告增多,还未修改
ConvergenceWarning: Initialization 1 did not converge. Try different init parameters, or increase max_iter, tol or check for degenerate data.
3.UserWarning: X has feature names, but SVC was fitted without feature names
用户警告:X 有功能名称,但 SVC 安装时没有功能名称
修改前以及修改后
尝试把warnings注释掉
4.上述警告改完后,运行代码报错,TypeError: object of type 'NoneType' has no len()
修改前
这段代码中的错误是由于 fitted_feature_names
或 X_feature_names
的值为 None
,无法执行 len()
操作。
要解决这个错误,可以在使用 len()
前先检查这两个变量是否为 None
。
修改后
尝试把warnings注释掉
5.上述两个尝试注释掉warnings,等待查看结果
没注释前一直有下述两个警告,警告意义不大
修改后没有警告
6.上述所有警告修改后,只剩下两个警告
选择注释掉warnings
没有任何警告了!哦耶!