Catboost 超参数搜索

gus*_*art 6 machine-learning catboost

我想在随机搜索中使用默认超参数,我该怎么做?(此处为 per_float_feature_quantization 参数)

grid = {'learning_rate': [0.1, 0.16, 0.2],
        'depth': [4, 6, 10],
        'l2_leaf_reg': [1, 3, 5, 7, 9],
        'iterations': [800, 1000, 1500, 2000],
        'bagging_temperature': [1, 2, 3, 4, 5],
        'border_count': [128, 256, 512],
        'grow_policy': ['SymmetricTree', 'Depthwise'],
        'per_float_feature_quantization':[None, '3:border_count=1024']}

model = CatBoostClassifier(loss_function='MultiClass',
                          custom_metric='Accuracy',
                          eval_metric='TotalF1',
                          od_type='Iter',
                          od_wait=40,
                          task_type="GPU", 
                          devices='0:1',
                          random_seed=42,
                          cat_features=cat_features)

randomized_search_result = model.randomized_search(grid,
                                                   X=X,
                                                   y=y
                                                   )
Run Code Online (Sandbox Code Playgroud)

我有

CatBoostError: library/cpp/json/writer/json_value.cpp:499: Not a map
Run Code Online (Sandbox Code Playgroud)

小智 -1

您的网格的一个或多个参数存在错误。将它们一一注释掉应该可以帮助您识别它。

\n

附带说明一下,Optuna 最近发布了对 CatBoost 的支持,以防您想尝试使用它而不是网格搜索。CatBoost 示例的 Optuna\xe2\x80\x99s 文档

\n