我正在尝试基于CatBoost的这篇文章
在它的代码中,CatBoost在model.fit()中有plot,所以我想在我的IPython上尝试它。
这是我的CatBoost代码:
from catboost import CatBoostRegressor
# indicate categorical features for CatBoost
categorical_features_indices = np.where(X.dtypes != np.float)[0]
model=CatBoostRegressor(iterations=50, depth=3, learning_rate=0.1,
loss_function='RMSE')
model.fit(X_train, y_train,
cat_features=categorical_features_indices,
use_best_model=True,
eval_set=(X_validation, y_validation), plot=True)但是,它不能显示任何阴谋,并不断给我错误:

我确实安装了ipywidget和ipython。你知道如何处理这个问题吗?
发布于 2017-08-17 06:22:48
最后,我解决了这个问题,现在我可以看到这个情节了。

在我的例子中,解决方案是安装Conda并创建Conda虚拟环境,然后通过conda安装ipywidgets。让我在这里写下所有的细节,希望能有所帮助。这可能只会帮助Mac用户
$PATH:如何运行Conda?中conda create -n yourenvname python=x.x anacondasource activate yourenvnamevirtualenv并为此安装了IPython,您可以跳过这一步):(yourenvname)$ pip install jupyter(yourenvname)$ pip install ipykernel(yourenvname)$ python -m ipykernel install --user --name testenv --display-name "Python2 (yourenvname)",如果您有多个ipykernel,这里的testenv也应该更改为另一个名称。
(yourenvname)$ conda install ipywidgets --no-deps(yourenvname)$ pip install catboostjupyter notebook,在Python2 (yourenvname)下创建一个新的笔记本,然后它就能工作了。注意:如果不工作,在步骤8之前,尝试如下:
pip install widgetsnbextensionjupyter nbextension enable --py widgetsnbextension --sys-prefixhttps://stackoverflow.com/questions/45707010
复制相似问题