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!
Installing xgboost in Anaconda Step 1: Install the current version of Python3 in Anaconda. Step 2: Check pip3 and python3 are correctly installed in the system. Step 3: To install xgboost library we will run the following commands in conda environment.
Check which version of pyzmq is installed. If Jupyter Notebook and the kernel are in different conda envs, check both and make sure they are on the same version and build. Try upgrading or downgrading to different versions. According to Anaconda issue 8932, there are problems with pyzmq on Windows.
I was having similar problem. I solved it by installing an older version 0.80.
pip install xgboost==0.80
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
from xgboost import XGBClassifier
model = XGBClassifier()
model.fit(X, y)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With