【发布时间】:2017-06-20 21:31:40
【问题描述】:
import operator
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import xgboost as xgb
import seaborn as sns
%matplotlib inline
pd.set_option('display.max_columns', 50)
导入上述文件后,我收到了一个找不到模块的错误,因为我没有安装 xboost,因为我是 python 和数据分析的新手。
然后我直接从here安装了。
现在在安装 xgboost 后,我收到了与上述相同代码行的弃用警告,如下所示:
C:\ProgramData\Anaconda3\lib\site-packages\sklearn\cross_validation.py:44:
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.
"This module will be removed in 0.20.", DeprecationWarning)
请告诉我为什么会出现这个警告以及如何解决这个问题?
【问题讨论】:
-
这意味着在产品的更高版本中,您使用的代码将不再有效。阅读
model_selection模块的文档并将您的代码放入其中,以便用户能够在更高版本中使用您的代码。 -
Sklearn 将取消 cross_validation。他们将在 cross_validation 下的类放到现在的 model_selection 中。我认为 XGBoost 也已更新,因为他们使用
try/except导入KFold、StratifiedKFold(用于 example)。
标签: python python-3.x jupyter-notebook data-analysis xgboost