当前位置:网站首页>LightGBM--调参笔记
LightGBM--调参笔记
2022-06-26 06:20:00 【Huranqingqing】
记录使用LightGBM时调参技巧
查看官方文档确定需要调的参数
LightGBM
LightGBM 使用 leaf-wise 的树生长策略, 而很多其他流行的算法(如xgboost)采用 depth-wise 的树生长策略. 与 depth-wise 的树生长策略相较, leaf-wise 算法可以收敛的更快. 但是, 如果参数选择不当的话, leaf-wise 算法有可能导致过拟合.
重要超参
- num_leaves
这是控制树模型复杂度的主要参数. 理论上, 借鉴 depth-wise 树, 我们可以设置 num_leaves = 2^(max_depth) 但是, 这种简单的转化在实际应用中表现不佳. 这是因为, 当叶子数目相同时, leaf-wise 树要比 depth-wise 树深得多, 这就有可能导致过拟合. 因此, 当我们试着调整 num_leaves 的取值时, 应该让其小于 2^(max_depth). 举个例子, 当 max_depth=6 时(这里译者认为例子中, 树的最大深度应为7), depth-wise 树可以达到较高的准确率.但是如果设置 num_leaves 为 127 时, 有可能会导致过拟合, 而将其设置为 70 或 80 时可能会得到比 depth-wise 树更高的准确率. - min_data_in_leaf
这是处理 leaf-wise 树的过拟合问题中一个非常重要的参数. 它的值取决于训练数据的样本个树和 num_leaves. 将其设置的较大可以避免生成一个过深的树, 但有可能导致欠拟合. 实际应用中, 对于大数据集, 设置其为几百或几千就足够了. - max_depth
显式地限制树的深度,为-1时表示没有限制 - bagging_fraction
默认为1.0,在不进行重采样的情况下随机选择部分数据,如0.8,一般在0.5-1.0之间。可以用来加速训练;可以用来处理过拟合;为了使用bagging, bagging_freq 应该设置为非零值; - feature_fraction
默认为1.0,在每次迭代中随机选择部分特征,如0.8,一般在0.5-1.0之间。可以用来加速训练;可以用来处理过拟合; - early_stopping_round
早停策略,一般在使用较大训练迭代次数时设置,如果一个验证集的度量在 early_stopping_round 循环中没有提升, 将停止训练 - num_iterations
迭代次数,默认为100,直觉上来讲,越大越好,数值设置比较大时结合早停策略 - learning_rate
学习率,一般设置在0.01-0.1之间,迭代次数越大,lr越小,成反比 - lambda_l1
L1正则化 - lambda_l2
L2正则化
更好的准确率
- 使用较大的 max_bin (学习速度可能变慢)
- 使用较小的 learning_rate 和较大的 num_iterations
- 使用较大的 num_leaves (可能导致过拟合)
- 使用更大的训练数据
- 尝试 dart
缓解过拟合
- 使用较小的 max_bin
- 使用较小的 num_leaves
- 使用较小的 min_data_in_leaf
- 通过设置 bagging_fraction 和 bagging_freq
- 通过设置 feature_fraction 来使用特征子抽样
- 使用 lambda_l1, lambda_l2
- 限制max_depth 来避免生成过深的树
边栏推荐
- NPM private server problem of peanut shell intranet penetration mapping
- Import / export function implementation
- 【golang】time相关
- TCP連接與斷開,狀態遷移圖詳解
- Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
- Import export simple
- Play with a variety of application scenarios and share secrets with Kwai MMU
- 自顶向下的变成方法
- Message queuing - omnidirectional comparison
- 打印数字的位信息
猜你喜欢

Comparison between Prometheus and ZABBIX

Tencent's 2022 school recruitment of large factories started with salary, and the general contracting of cabbage is close to 40W!

GoF23—抽象工厂模式

Import export simple

Gof23 - abstract factory pattern

DS18B20详解

Thinking skills of technical leaders
Customer Stories | Netease spring breeze: the "spring breeze" of the fun industry, reaching out to all areas through in-depth interaction
A new paradigm for large model application: unified feature representation optimization (UFO)

Container with the most water
随机推荐
架构设计方法
[spark] how to implement spark SQL field blood relationship
成水最多的容器
稀疏数组sparsearray
Transaction and message semantics
消息队列-全方位对比
PyTorch使用多GPU并行训练及其原理和注意事项
数据治理工作的几种推进套路
数据可视化实战:数据可视化
Architecture design method
GoF23—工厂模式
温度报警器
Handwritten background management framework template (I)
Thread status and stop
Gof23 - abstract factory pattern
Web components series (10) -- realize the basic layout of mycard
Mongodb -- use mongodb to intercept the string content in the field and perform grouping statistics
跨域的五种解决方案
A new paradigm for large model application: unified feature representation optimization (UFO)
Redis multithreading and ACL