使用 python 时的警告信息
Warning messages when using python
当我 运行 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.
此警告消息表示什么?
提前致谢
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
表示scikit-learn的SVM模块内部使用模块cross_validation和grid_search。这两个都将在 0.20 版本中被模块的 model_selection 等效项替换。所以,您不必担心,一旦将 scikit-learn 升级到它的下一个版本,您就不会再看到警告了。
当 运行 python 来自终端的文件时,我遇到了同样的错误。在 RuntimeError 描述中,建议安装 python 应用程序并使用 pythonw 代替 python,而我正是这样做的。幸运的是它对我有用。
pythonw filename.py
当我 运行 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.
此警告消息表示什么?
提前致谢
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
表示scikit-learn的SVM模块内部使用模块cross_validation和grid_search。这两个都将在 0.20 版本中被模块的 model_selection 等效项替换。所以,您不必担心,一旦将 scikit-learn 升级到它的下一个版本,您就不会再看到警告了。
当 运行 python 来自终端的文件时,我遇到了同样的错误。在 RuntimeError 描述中,建议安装 python 应用程序并使用 pythonw 代替 python,而我正是这样做的。幸运的是它对我有用。
pythonw filename.py