【问题标题】:Why there is no booster parameter in the XGBoost installation, meanwhile it is in the documentation?为什么 XGBoost 安装中没有 booster 参数,同时在文档中?
【发布时间】:2017-05-19 15:41:30
【问题描述】:

我已经安装了 XGBoost。 这些是它在执行时显示的参数: 打印(xgboost.XGBClassifier())

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)

但是在Scikit-Learn API的文档中,出现了“助推器”参数。为什么我没有?

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)

编辑

这是我得到的:

    ---------------------------------------------------------------------------
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'

【问题讨论】:

    标签: python machine-learning xgboost


    【解决方案1】:

    恕我直言,这是一个严重的不一致,您应该为此打开一个问题。

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

    因此,您实际上可以通过以下方式提供助推器方法:

    clf = xgb.XGBClassifier()
    params = {"booster" : "gbtree"}
    xgb.train(params, ...)
    

    【讨论】:

    • 好吧,如果我添加参数,我会收到此错误:TypeError: __init__() got an unexpected keyword argument 'booster'。有什么想法吗?
    • @Aizzaac 你能添加堆栈跟踪吗?否则很难为我遵循代码。
    • 我在 EDIT 上添加了它。
    • 根据签名缺少:args=['self', 'max_depth', 'learning_rate', 'n_estimators', 'silent', 'objective', 'nthread', 'gamma' , 'min_child_weight', 'max_delta_step', 'subsample', 'colsample_bytree', 'colsample_bylevel', 'reg_alpha', 'reg_lambda', 'scale_pos_weight', 'base_score', 'seed', 'missing'], varargs=None,关键字=None, defaults=(3, 0.1, 100, True, 'reg:linear', -1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0.5, 0, None)) 可能(就我而言)因为我使用的是包装器,并且不是从源代码编译的
    猜你喜欢
    • 2018-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-09
    • 2016-01-09
    • 2015-03-13
    • 2019-11-28
    • 1970-01-01
    相关资源
    最近更新 更多