必备!人工智能和数据科学的七大 Python 库( 十 )
接下来我们再次加载生成的 .py文件,你将看到:
1importnumpyasnp
2fromsklearn.model_selectionimporttrain_test_split
3fromsklearn.neighborsimportKNeighborsClassifier
4#NOTE:Make sure that the class is labeled 'class' in the data file
5tpot_data = http://www.veick.cn/news/np.recfromcsv('PATH/TO/DATA/FILE', delimiter='COLUMN_SEPARATOR', dtype=np.float64)
6features = np.delete(tpot_data.view(np.float64).reshape(tpot_data.size,-1), tpot_data.dtype.names.index('class'), axis=1)
7training_features, testing_features, training_classes, testing_classes = \
8train_test_split(features, tpot_data['class'], random_state=42)
9exported_pipeline = KNeighborsClassifier(n_neighbors=4, p=2, weights="distance")
推荐阅读
- 捉迷藏|?LOL世界赛“含金量”数据出炉:EDG仅排第六,IG稳居榜首
- 碧蓝航线|碧蓝航线SR重巡福煦数据详解 期待越高失望越大 强度平平无奇
- 娜美|《英雄联盟手游》软辅渐起成主流-娜美成上分必备
- kramer|国服极地大乱斗数据上线,来看看胜率榜符合你的预期吗?
- 米莱狄|峡谷数据榜:分均输出TOP5,干将莫邪只排第四,米莱狄至今被误解
- |S11淘汰赛数据盘点:场均时长为33分 55个不同英雄登场
- 中单|2021年英雄联盟世界赛终于落下帷幕!!大数据统计二!!
- 灵饰|梦幻西游:109级法系前排灵饰选择方法,用数据告诉你怎么做
- 卡牌|S11淘汰赛数据出炉,卡牌24场全被ban,压刀最多竟是辅助
- edg战队|堡垒之夜国服将清除数据,EDG创造队史晋级S11世界赛决赛