Google Colaboratory 上带有 GPU 的 XGBoost

use*_*890 3 python gpu xgboost google-colaboratory

我正在尝试在 Google Colaboratory 上使用带有 GPU 的 XGBoost。这是我的笔记本:

import numpy as np
import os
import xgboost as xgb

train_X = np.random.rand(100,5)
train_Y = np.random.choice(2, 100)

test_X = np.random.rand(10,5)
test_Y = np.random.choice(2, 10)

xg_train = xgb.DMatrix(train_X, label=train_Y)
xg_test = xgb.DMatrix(test_X, label=test_Y)

param = {}
# use softmax multi-class classification
param['objective'] = 'multi:softmax'
# scale weight of positive examples
param['eta'] = 0.1
param['max_depth'] = 6
param['silent'] = 1
param['nthread'] = 4
param['num_class'] = 2

param['gpu_id'] = 0
param['max_bin'] = 16
param['tree_method'] = 'gpu_hist'


# watchlist allows us to monitor the evaluation result on all data in the list 
watchlist = [(xg_train, 'train'), (xg_test, 'test')]
num_round = 5

bst = xgb.train(param, xg_train, num_round, watchlist)
Run Code Online (Sandbox Code Playgroud)

当我运行最后一行时:

bst = xgb.train(param, xg_train, num_round, watchlist)
Run Code Online (Sandbox Code Playgroud)

我得到“运行时死亡,自动重新启动”

任何想法如何排除故障?

Mat*_*ham 5

我已经在具有 GPU 支持的 Colab 上运行了 XGBoost。从这里下载 Linux 版本,然后

!pip uninstall xgboost
!pip install xgboost-0.81-py2.py3-none-manylinux1_x86_64.whl
Run Code Online (Sandbox Code Playgroud)

...正在为我工​​作。