集成学习专题索引
专题概览
本专题系统讲解集成学习的理论与实践,涵盖从基础概念到最新进展的完整知识体系。
内容导航
1. 基础理论
2. 梯度提升算法
| 文档 | 内容简介 |
|---|---|
| 梯度提升决策树(GBDT) | GBDT理论基础、前向分步算法、CART回归树 |
| XGBoost深入解析 | XGBoost目标函数、二阶优化、正则化设计 |
| LightGBM高效实现 | GOSS采样、EFB特征捆绑、直方图算法 |
| CatBoost与类别特征 | 有序提升、目标统计编码、对称树结构 |
3. 进阶主题
学习路径
路径一:从零基础到实战
第一阶段:基础概念
├── 偏差-方差分解
├── 决策树基础
└── 集成学习基本思想
第二阶段:Bagging方法
├── Bootstrap采样
├── 随机森林
└── Out-of-Bag评估
第三阶段:Boosting方法
├── AdaBoost基础
├── GBDT理论
├── XGBoost深入
├── LightGBM高效实现
└── CatBoost进阶
第四阶段:高级集成
├── Stacking框架
├── 模型剪枝与加权
└── 深度集成方法
路径二:快速应用导向
优先级 1:LightGBM/CatBoost实战
├── LightGBM高效实现(重点:参数调优)
├── CatBoost与类别特征(重点:类别处理)
└── XGBoost深入解析(重点:正则化)
优先级 2:集成学习统一理论
├── 偏差-方差分解
├── 三种集成方法对比
└── 何时选择哪种方法
优先级 3:深入理论
├── 前向分步算法推导
├── GOSS/EFB算法原理
└── 有序提升理论
知识图谱
┌─────────────────────┐
│ 集成学习 Unified │
└──────────┬──────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Bagging │ │ Boosting │ │ Stacking │
├─────────────────┤ ├─────────────────┤ ├─────────────────┤
│ Bootstrap采样 │ │ 前向分步算法 │ │ 元学习器 │
│ 随机森林 │ │ AdaBoost │ │ OOF预测 │
│ ExtraTrees │ │ GBDT │ │ 多层堆叠 │
│ 方差缩减理论 │ │ XGBoost │ │ │
│ │ │ LightGBM │ │ │
│ │ │ CatBoost │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
└─────────────────────┴─────────────────────┘
│
▼
┌─────────────────────┐
│ 决策树基础 │
├─────────────────────┤
│ CART算法 │
│ 剪枝策略 │
│ 分裂准则 │
└─────────────────────┘
核心公式速查
偏差-方差分解
GBDT前向分步
XGBoost目标函数
XGBoost最优叶子权重
AdaBoost权重更新
Bagging方差缩减
参数调优速查
LightGBM关键参数
| 参数 | 默认值 | 调优建议 |
|---|---|---|
num_leaves | 31 | 控制复杂度,建议31-255 |
max_depth | -1 | 限制深度,配合num_leaves |
learning_rate | 0.1 | 通常0.01-0.1 |
n_estimators | 100 | 树的数量,与learning_rate配合 |
min_child_samples | 20 | 防止过拟合 |
subsample | 1.0 | 行采样,0.7-0.9 |
colsample_bytree | 1.0 | 列采样,0.6-0.9 |
XGBoost关键参数
| 参数 | 默认值 | 调优建议 |
|---|---|---|
max_depth | 6 | 3-10,控制树深度 |
learning_rate | 0.1 | 0.01-0.3 |
n_estimators | 100 | 100-1000 |
min_child_weight | 1 | 防止过拟合 |
subsample | 1.0 | 0.6-0.9 |
colsample_bytree | 1.0 | 0.6-0.9 |
reg_alpha | 0 | L1正则化 |
reg_lambda | 1 | L2正则化 |
CatBoost关键参数
| 参数 | 默认值 | 调优建议 |
|---|---|---|
depth | 6 | 4-10 |
learning_rate | 0.03 | 0.01-0.1 |
iterations | 1000 | 树的数量 |
l2_leaf_reg | 3 | L2正则化 |
bootstrap_type | Bayesian | Bernoulli/MVS |
one_hot_max_size | 10 | 独热编码阈值 |
实践案例
案例1:选择合适的梯度提升库
def choose_boosting_library(data_type, n_samples, has_categorical=False):
"""
根据数据特点选择合适的梯度提升库
"""
recommendations = []
if n_samples > 1_000_000:
recommendations.append("LightGBM(大数据处理快)")
if has_categorical:
recommendations.append("CatBoost(类别特征处理强)")
if n_samples < 10_000:
recommendations.append("XGBoost(精度优先)")
if len(recommendations) > 1:
recommendations.append("可尝试集成:LightGBM + CatBoost")
return recommendations
# 示例
print(choose_boosting_library(
data_type='tabular',
n_samples=5_000_000,
has_categorical=True
))
# 输出:['LightGBM(大数据处理快)', 'CatBoost(类别特征处理强)', '可尝试集成:LightGBM + CatBoost']案例2:集成调参策略
class EnsembleTuner:
"""集成学习参数调优器"""
def tune(self, X, y, time_budget='medium'):
if time_budget == 'low':
# 快速调参
params = {
'n_estimators': 100,
'max_depth': 6,
'learning_rate': 0.1
}
elif time_budget == 'medium':
# 中等调参
params = {
'n_estimators': 500,
'max_depth': [4, 6, 8],
'learning_rate': [0.01, 0.05, 0.1],
'subsample': [0.7, 0.8, 0.9],
'colsample_bytree': [0.7, 0.8, 0.9]
}
else: # high
# 深度调参
params = {
'n_estimators': 2000,
'max_depth': range(3, 12),
'learning_rate': np.logspace(-3, -1, 20),
'subsample': np.linspace(0.5, 1.0, 10),
'colsample_bytree': np.linspace(0.5, 1.0, 10),
'reg_alpha': [0, 0.01, 0.1, 1],
'reg_lambda': [0, 0.01, 0.1, 1]
}
return params常见问题
Q1: 何时使用集成学习?
A: 当单一模型性能不足、基学习器存在但有改进空间时。
Q2: Bagging vs Boosting 如何选择?
A:
- 数据噪声大、模型不稳定 → Bagging
- 模型欠拟合、偏差大 → Boosting
- 追求精度、不在乎训练时间 → Boosting
Q3: 如何处理集成过拟合?
A:
- 增加正则化
- 使用早停
- 减少基学习器数量
- 使用简单的元学习器
Q4: 集成多少个模型合适?
A: 通常10-500个基学习器效果较好,具体取决于:
- 基学习器复杂度
- 计算资源
- 边际收益递减点
相关领域链接
机器学习基础
深度学习相关
其他算法专题
更新日志
2026-05-11 本轮新增
gradient-boosting-decision-tree.md— GBDT基础理论xgboost-deep-dive.md— XGBoost深入解析lightgbm-efficient-implementation.md— LightGBM高效实现catboost-categorical-features.md— CatBoost与类别特征ensemble-learning-unified-theory.md— 集成学习统一理论ensemble-learning-index.md— 本专题索引
本专题持续更新中