首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Optuna catboost修剪

Optuna catboost修剪
EN

Stack Overflow用户
提问于 2021-03-08 05:41:19
回答 1查看 596关注 0票数 0

有没有办法对CatBoost和Optuna进行修剪(在LightGBM中很简单,但在Catboost中我找不到任何提示)。我的代码是这样的

代码语言:javascript
复制
def objective(trial):
    param = {
        'iterations':trial.suggest_int('iterations', 100,1500, step=100),
        'learning_rate':trial.suggest_uniform("learning_rate", 0.001, 0.3),
        'random_strength':trial.suggest_int("random_strength", 1,10),
        'max_bin':trial.suggest_categorical('max_bin', [2,3,4,5,6,8,10,20,30]),
        'grow_policy':trial.suggest_categorical('grow_policy', ['SymmetricTree', 'Depthwise', 'Lossguide']),        
        "colsample_bylevel": trial.suggest_uniform("colsample_bylevel", 0.1, 1),
        'od_type' : "Iter",
        'od_wait' : 30,
        "depth": trial.suggest_int("max_depth", 1,12),
        "l2_leaf_reg": trial.suggest_loguniform("l2_leaf_reg", 1e-8, 100),
        'custom_metric' : ['AUC'],
        "loss_function": "Logloss",
        }
    
    if param['grow_policy'] == "SymmetricTree": 
        param["boosting_type"]= trial.suggest_categorical("boosting_type", ["Ordered", "Plain"])
    else:
        param["boosting_type"] = "Plain"
        
    # Added subsample manually
    param["subsample"] = trial.suggest_float("subsample", 0.1, 1)

### CV ###

    # How to add a callback for pruning?
    scores = cv(train_dataset,
            param,
            fold_count=5, 
            early_stopping_rounds=30,         
            plot=False, verbose=False)
    
    return scores['test-AUC-mean'].mean()
EN

回答 1

Stack Overflow用户

发布于 2021-03-18 16:51:28

不是,因为catboost不像其他的boosting库那样提供任何回调。然而,catboost计划在不久的将来引入一个回调函数。在该功能发布后,optuna可能会实现与LightGBM等catboost的集成。另请参阅github https://github.com/optuna/optuna/issues/2464上的功能请求。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66521731

复制
相关文章

相似问题

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