首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么在XGBoost安装中没有booster参数,而在文档中有?

为什么在XGBoost安装中没有booster参数,而在文档中有?
EN

Stack Overflow用户
提问于 2017-05-19 23:41:31
回答 1查看 1.7K关注 0票数 1

我已经安装了XGBoost。以下是它执行以下操作时显示的参数: print(xgboost.XGBClassifier())

代码语言:javascript
复制
XGBClassifier(base_score=0.5, colsample_bylevel=1, colsample_bytree=1,
   gamma=0, learning_rate=0.1, max_delta_step=0, max_depth=3,
   min_child_weight=1, missing=None, n_estimators=100, nthread=-1,
   objective='binary:logistic', reg_alpha=0, reg_lambda=1,
   scale_pos_weight=1, seed=0, silent=True, subsample=1)

但是在documentation Scikit-Learn API中,出现了一个"booster“参数,为什么我没有这个参数呢?

代码语言:javascript
复制
Scikit-Learn API
Scikit-Learn Wrapper interface for XGBoost.

class xgboost.XGBRegressor(max_depth=3, learning_rate=0.1,  
n_estimators=100, silent=True, objective='reg:linear', 
**booster='gbtree'**, nthread=-1, gamma=0, min_child_weight=1, 
max_delta_step=0, subsample=1, colsample_bytree=1, colsample_bylevel=1, 
reg_alpha=0, reg_lambda=1, scale_pos_weight=1, base_score=0.5, seed=0, 
missing=None)

编辑

这是我得到的:

代码语言:javascript
复制
    ---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-63-26499cfcb8f8> in <module>()
     18         #Inicio de Cross-validation
     19         clf = Pipeline([('rcl', RobustScaler()),
---> 20                         ('clf',    xgboost.XGBClassifier(booster='gbtree', objective='multi:softmax', seed=0,  nthread=-1))])
     21         ##############4 epoch x sujeto###########
     22         print("4 epoch x sujeto en test_size")

 TypeError: __init__() got an unexpected keyword argument 'booster'
EN

回答 1

Stack Overflow用户

发布于 2017-05-20 00:07:35

我想这是一个糟糕的不一致,你应该为它打开一个问题。

但是XGB类或多或少都是围绕这样一个事实设计的,即您可以通过train方法在包中设置参数。

因此,您可以通过以下方式实际提供booster方法:

代码语言:javascript
复制
clf = xgb.XGBClassifier()
params = {"booster" : "gbtree"}
xgb.train(params, ...)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44074078

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档