使用python时的警告消息

时间:2016-12-20 09:23:58

标签: python python-2.7 svm

当我运行SVM python代码时,我会继续这样做:

Warning (from warnings module):
  File "/usr/local/lib/python2.7/dist-packages/sklearn/cross_validation.py", line 44
    "This module will be removed in 0.20.", DeprecationWarning)
DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.

Warning (from warnings module):
  File "/usr/local/lib/python2.7/dist-packages/sklearn/grid_search.py", line 43
    DeprecationWarning)
DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. This module will be removed in 0.20.

此警告消息表示什么?

先谢谢

3 个答案:

答案 0 :(得分:27)

scikit-learn的最新稳定版本是0.18 http://scikit-learn.org/stable/

您使用的版本已弃用这些模块。
或者使用

    from sklearn.model_selection import train_test_split

看看这个讨论 https://github.com/rhiever/tpot/issues/284
这个评论:
https://github.com/rhiever/tpot/commit/84c5e26b447251088826737612ccf0817ef43db2

答案 1 :(得分:0)

这意味着scikit-learn的SVM模块在内部使用模块cross_validation和grid_search。这两个版本都将在版本0.20中被模块的model_selection等价物替换。所以,你不用担心,一旦你升级scikit-learn到下一个版本,你就不应该再看到警告了。

答案 2 :(得分:0)

从终端运行python文件时遇到同样的错误。在RuntimeError描述中,它建议安装python app并使用pythonw代替python,我就是这么做的。幸运的是,它对我有用。

  

pythonw filename.py