【问题标题】:How to show catboost plot in google colab?如何在谷歌 colab 中显示 catboost 图?
【发布时间】:2020-03-19 10:51:32
【问题描述】:

我在 google colaboratory 中使用 catboost 模块对增强分类器进行建模。 我关注了official example

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)

但这并没有在 Google Colab 笔记本中显示任何情节。

这是我的 google colab 代码:

import sys
ENV_COLAB = 'google.colab' in sys.modules

if ENV_COLAB:

    !pip install catboost
    !pip install ipywidgets
    !jupyter nbextension enable --py widgetsnbextension

    print('Environment: 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)

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

【问题讨论】:

    标签: python pandas google-colaboratory catboost


    【解决方案1】:

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

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

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

    【讨论】:

      猜你喜欢
      • 2020-12-09
      • 2016-02-11
      • 1970-01-01
      • 2021-01-18
      • 1970-01-01
      • 2019-03-02
      • 2020-05-07
      • 2019-11-14
      • 2020-01-27
      相关资源
      最近更新 更多