bigdong89 / xgboostExtension

xgboost Extension for Easy Ranking & TreeFeature
Apache License 2.0
123 stars 35 forks source link

run xgbranker_example error #4

Closed lzhw520110 closed 6 years ago

lzhw520110 commented 6 years ago

win7 py2.7 xgboost 0.7 when run xgbranker_example, I get error as this image image I add 'n_jobs' and 'random_state' to class XGBRanker.init(), This error dispeared, but I get a new error as this

Traceback (most recent call last): File "", line 1, in dtrain.handle)) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\xgboost-0.7-py2.7.egg\xgboost\core.py", line 130, in _check_call raise XGBoostError(_LIB.XGBGetLastError()) xgboost.core.XGBoostError: Invalid Parameter format for seed expect int but value='None'

When I set seed=0 in class XGBRanker.init() and run xgbranker_example again, get a new error as this:

[11:10:29] dmlc-core/include/dmlc/./logging.h:300: [11:10:29] src/tree/updater_colmaker.cc:657: Check failed: param.colsample_bylevel > 0U (0 vs. 0) colsample_bylevel cannot be zero. Traceback (most recent call last): File "", line 1, in xgb_model=xgb_model, callbacks=callbacks) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\xgboost-0.7-py2.7.egg\xgboost\training.py", line 74, in _train_internal bst.update(dtrain, i, obj) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\xgboost-0.7-py2.7.egg\xgboost\core.py", line 898, in update dtrain.handle)) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\xgboost-0.7-py2.7.egg\xgboost\core.py", line 130, in _check_call raise XGBoostError(_LIB.XGBGetLastError()) xgboost.core.XGBoostError: [11:10:29] src/tree/updater_colmaker.cc:657: Check failed: param.colsample_bylevel > 0U (0 vs. 0) colsample_bylevel cannot be zero.

File "C:\Users\Lenovo\Anaconda2\lib\site-packages\xgboost-0.7-py2.7.egg\xgboost\training.py", line 204, in train xgb_model=None) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\xgboost_ranking-0.6.1-py2.7.egg\xgboostextension\xgbranker.py", line 101, in fit ranker.fit(X, y, [25, 25, 25, 25], eval_metric=['ndcg', 'map@5-']) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace) File "C:\Users\Lenovo\Anaconda2\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile exec(compile(scripttext, filename, 'exec'), glob, loc) File "D:/0rqalpha/quantOS/xgbRanker/demo.py", line 22, in

I have no idea about this error!

bigdong89 commented 6 years ago

I don't know what happened. But it's obvious that recently xgboost-0.7 is released but I haven't upgrade my package. Switch your xgboost to 0.6, it will be OK. I will update it to 0.7 work with new version of xgboost when I'm free. Good luck!

FlorisHoogenboom commented 6 years ago

I've encounterd the same issue. I've made PR https://github.com/bigdong89/xgboostExtension/pull/5 for the upgrade to V0.7.

The reason for the error lies in the fact that the get_xgb_params function uses the init signature to get the parameters. Since this signature has changed in XGBoost v0.7 this error was raised.

bigdong89 commented 6 years ago

Thanks, Floris! Codes are merged for 0.7!