与xgboost并行线程? [英] Parallel threading with xgboost?

查看:96
本文介绍了与xgboost并行线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据其文档,xgboost具有n_jobs参数.但是,当我尝试设置n_jobs时,出现此错误:

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'

与其他一些参数(例如random_state)相同.我以为这可能是更新问题,但似乎我具有最新版本(0.6a2,随pip一起安装).

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).

对于我来说,重现该错误没有太多必要:

There isn't much needed for me to reproduce the error:

from xgboost import XGBClassifier 
estimator_xGBM = XGBClassifier(max_depth = 5, learning_rate = 0.05, n_estimators = 400, n_jobs = -1).fit(x_train)

有什么想法吗?

推荐答案

我昨天(25.09.2017)安装了xgboost:

I installed xgboost yesterday (25.09.2017):

如果使用pip或conda进行安装,则xgboost版本不支持n_jobs参数.仅nthreads参数.

If you install with pip or conda, the xgboost version does not support the n_jobs parameter; only the nthreads parameter.

如果您是从github仓库构建xgboost的,则可以使用n_jobs.

If you build xgboost from github repository, you can use n_jobs though.

更新:n_jobs是用于运行xgboost的并行线程数. (替换nthread)用于所有算法,例如XGBClassifier,XGBRanker,XGBRegressor等.

Update: n_jobs is the number of parallel threads used to run xgboost. (replaces nthread) for all algorithms like XGBClassifier, XGBRanker, XGBRegressor etc.

参考-此处

这篇关于与xgboost并行线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆