使用python fit,predict出现的错误

来源:互联网 发布:ec软件 编辑:程序博客网 时间:2024/06/05 16:40

 错误信息:

C:\Python27\lib\site-packages\sklearn\utils\validation.py: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError 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.
  DeprecationWarning

make your data from 1D to 2D

  1. Just add: []

    vec = [vec]
  2. Reshape your data

    vec = np.array(vec).reshape(1, -1)
原创粉丝点击