Xgboost: n_jobs is not accepted as an argument of XGBClassifier

Created on 20 Sep 2017  路  5Comments  路  Source: dmlc/xgboost

According to its documentation, xgboost has an n_jobs parameter. However, when I attempt to set n_jobs, I get this error:

TypeError: __init__() got an unexpected keyword argument 'n_jobs'

Same issue for some other parameters like random_state. I assumed this might be an update issue, but it seems I have the latest version (0.6a2, installed with pip).

Operating System: Linux
Package used (python/R/jvm/C++): python

All 5 comments

The Pypi xgboost package is over a year old. Please install from the source.

On version 0.7.post3 I have the same problem.

I have the same issue as well (on 0.7.post3).

still have the same issue on version 0.7.1 any fix for this?

n_jobs should be accepted by XGBClassifier, according to line 397 of sklearn.py, version 0.71. Make sure you have the correct version installed, by running

pip3 install xgboost==0.71

EDIT. I just installed 0.71 and managed to run

clf = xgboost.XGBClassifier(n_jobs=3)
Was this page helpful?
0 / 5 - 0 ratings