如何在 google colab 中显示 catboost 图?

Pou*_*del 2 python pandas catboost google-colaboratory

我在 google colaboratory 中使用 catboost 模块对提升分类器进行建模。我遵循了官方示例

from catboost import CatBoostClassifier, Pool

train_data = [[1, 3], [0, 4], [1, 7], [0, 3]]
train_labels = [1, 0, 1, 1]

model = CatBoostClassifier(learning_rate=0.03)

model.fit(train_data,
          train_labels,
          verbose=False,
          plot=True)

Run Code Online (Sandbox Code Playgroud)

但这在 Google Colab notebook 中没有显示任何情节。

这是我的 google colab 代码:

from catboost import CatBoostClassifier, Pool

train_data = [[1, 3], [0, 4], [1, 7], [0, 3]]
train_labels = [1, 0, 1, 1]

model = CatBoostClassifier(learning_rate=0.03)

model.fit(train_data,
          train_labels,
          verbose=False,
          plot=True)

Run Code Online (Sandbox Code Playgroud)

Google colab 只是打印,<catboost.core.CatBoostClassifier at 0x7fc7a846d898>而不是像 catboost 的官方网页中显示的那样显示情节。

小智 5

Catboost 的绘图选项在 Google Colab 或 Jupiter Lab 中尚不可用。目前,“解决方案”是在常规 jupyter notebook 中运行您的代码。

在 Github 上已经有几次关于这个的讨论,catboost 团队成员已经承认了这个问题。真正的解决方案似乎是他们需要制作一个特殊的扩展来启用在 Google Colab 或 Jupiter Lab 中的绘图。不幸的是,他们在 2019 年 10 月表示“我们没有在这方面工作,我们非常感谢任何帮助!” https://github.com/catboost/catboost/issues/262

(另见:https : //github.com/catboost/catboost/issues/1092