[调试多项式回归器代码错误,调试过程及总结]
Deprecation Warning: Reshape your data either using X.reshape(-1, 1)···or X.reshape(1, -1)
1.运行环境
系统:win 7 64位
Python版本:python 2.7
代码编辑器:PyCharm Community
代码来源: Python Machine Learning Cookbook中文版—Python机器学习经典实例1.8创建多项式回归器,源码在出版社 GitHub 上:regression_multivar.py
2.报错:
Deprecation Warning: Passing 1d arrays as data is deprecated in 0.17 and will raise Value Error in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample.
(中文翻译:弃用警告:传递1d 数组作为数据在0.17中被弃用,并会在0.19中引发值错误。 如果数据具有单个特征,则使用X.reshape(-1,1)重新整形数据,如果数据包含单个特征,则使用X.reshape(1,-1)重整数据)
3.代码前期修改过程
-
# 源码
filename =