6

I don't know how to make the XGBoost classifier work. I am running the code below on Jupyter notebook, and it always generates this message "The kernel appears to have died. It will restart automatically."

from xgboost import XGBClassifier
model = XGBClassifier()
model.fit(X, y)

There is no problem with importing the XGBClassifier, but it crashes upon fitting it to my data. X is a 502 by 33 all-numeric dataframe, y is the set of 0 or 1 labels for each row. Does anyone know what could be the problem here? I downloaded the newest version of XGBoost through pip3 install, and also through Conda install.

Thanks!

Mario Boss
  • 1,784
  • 3
  • 20
  • 43
Zofia
  • 123
  • 2
  • 5

2 Answers2

21

I was having similar problem. I solved it by installing an older version 0.80.

pip install xgboost==0.80
  • 1
    Евгений , спасибо вам огромное! I've been trying to solve this issue for a few days in a row. I've even decided to move from my laptop's Jupyter to the Kaggle's one with the powerful GPU on it. Then I googled again and came across this answer which really solved my problem! Thanks a loooot! – Aidos Feb 03 '19 at 13:16
  • 1
    I always love it when a _newer_ version of a library has some _critical_ error. Worked for me, thanks! – Jakub Langr Apr 10 '19 at 08:22
  • 1
    This is so far the best solution, after wasting nearly 3 hours how to install xgboost from source – MGLondon Sep 21 '19 at 15:57
2
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
from xgboost import XGBClassifier
model = XGBClassifier()
model.fit(X, y)
fuwiak
  • 721
  • 1
  • 8
  • 25