摘要: 代码: 结果: 总结:在仅考虑单一近邻时,训练集上的预测结果十分完美(接近100%)。但随着邻居个数的增多,模型变得更简单(泛化能力越好),训练集精度也随之下降。为求得较好的预测精度和泛化能力,最佳性能在neighbors为6左右! 阅读全文
posted @ 2018-07-12 10:32 云山之巅 阅读(739) 评论(0) 推荐(0) 编辑
摘要: 1 # -*- coding: utf-8 -*- 2 """ 3 Created on Thu Jun 28 17:16:19 2018 4 5 @author: zhen 6 """ 7 from sklearn.model_selection import train_test_split 8 阅读全文
posted @ 2018-07-12 10:17 云山之巅 阅读(758) 评论(0) 推荐(0) 编辑