GBDT + LR 架构的提出
就是这篇论文提出了 GBDT + LR 的架构,强调了正确的特征和正确的模型这件事情的重要性
In this paper we introduce a model which combines decision trees with logistic regression, outperforming either of these methods on its own by over 3%, an improvement with significant impact to the overall system performance. We then explore how a number of fundamental parameters impact the final prediction performance of our system. Not surprisingly, the most important thing is to have the right features: those capturing historical information about the user or ad dominate other types of features. Once we have the right features and the right model (decisions trees plus logistic regression), other factors play small roles (though even small improvements are important at scale). Picking the optimal handling for data freshness, learning rate schema and data sampling improve the model slightly, though much less than adding a high-value feature, or picking the right model to begin with.

数据处理
离线数据准备:为了进行严谨且受控的实验,作者从Facebook2013年第四季度中随机选择了一周的数据作为离线训练数据。这种选择方式可以确保实验数据具有代表性,同时避免因数据选择偏差导致的实验结果不可靠。
模拟在线数据流:为了在不同的实验条件下保持训练和测试数据的一致性,作者准备的离线数据与在线观察到的数据相似。然后,将这些离线数据划分为训练集和测试集,并用它们来模拟在线训练和预测的流式数据。这意味着虽然实验是在离线环境中进行的,但数据的处理方式尽量模拟了在线环境中的动态数据流,从而使得实验结果更接近实际在线系统的运行情况。
统一的实验基准:所有实验都使用相同的训练/测试数据作为测试平台。这样可以确保不同实验条件下的结果具有可比性,因为它们都是基于同一组数据进行评估的。
评估指标
Since we are most concerned with the impact of the factors to the machine learning model, we use the accuracy of prediction instead of metrics directly related to profit and revenue. In this work, we use Normalized Entropy (NE) and calibration as our major evaluation metric.
Normalized Cross-Entropy (NE): 用于评估模型预测的准确性,通过归一化对数损失来消除背景CTR的影响。NE越低,模型性能越好。
Calibration: 用于评估模型预测的CTR与实际CTR的一致性。Calibration越接近1,模型的预测越准确。

CTR 预测模型详解
论文中描述了一种混合模型结构,结合了提升决策树(Boosted Decision Trees)和概率稀疏线性分类器(Probabilistic Sparse Linear Classifier),并详细介绍了模型的训练和推理过程
特征转换技术:分箱和组合
文中指出,有两种简单的方法来转换线性分类器的输入特征,以提高其准确性,分别是以下两个
连续特征分箱:将连续特征,使用k-d树等算法进行联合分箱,将其离散化为分箱特征,通过寻找最优分箱边界实现非线性变换
For continuous features, a simple trick for learning non-linear transformations is to bin the feature and treat the bin index as a categorical feature. The linear classifier effectively learns a piece-wise constant non-linear map for the feature.
对类别特征进行特征组合:对于类别特征,使用笛卡尔积生成组合特征后将没有用的特征组合剪枝
For categorical features, the brute force approach consists in taking the Cartesian product, i.e. in creating a new categorical feature that takes as values all possible values of the original features. Not all combinations are useful, and those that are not can be pruned out.
GBDT特征编码方法
论文指出,GBDT特征编码通过树模型自动实现特征组合与非线性转换非常好用:
- 我们将每个单独的树视为一个分类特征,它将实例最终落入的叶子的索引作为值,使用这类特征的1-of-K编码。 梯度提升树将原始特征转换为叶节点路径规则(如"特征A>5 ∧ 特征B<3")
- GBDT使用 L2-TreeBoost 算法,即在每次学习迭代中,都会创建一棵新树来对先前树的残差进行建模。
- 从根节点到叶子节点的遍历表征了对于特定特征的规则
- 在GBDT生成的二进制向量上拟合线性分类器,本质上就是学习上去这些规则的权重
模型对比(Normalized Entropy)

数据时效性影响
总的来说结论很符合直觉:越新鲜的数据越好

在线学习
SGD五种学习率方案比较
因为上面提到了越新鲜的数据越好,进一步的思路就是我们最好可以在线学习,因此进而评估了为基于SGD的逻辑回归在线学习设置学习率的几种方法。而后,我们将BOPR模型的最佳变体与在线学习进行比较。
学习率方案 | 公式/参数说明 | 说明 |
---|---|---|
Per-coordinate | $η_{t,i} = α/(β+\sqrt{\sum∇^2_{j,i}})$ $α=0.1$, $β=1.0$ |
基于每个特征维度的梯度平方和调整学习率 |
Per-weight square root | $η_{t,i} = α/\sqrt{n_{t,i}}$ $α=0.01$ |
基于每个权重更新次数的平方根调整 |
Per-weight | $η_{t,i} = α/n_{t,i}$ $α=0.01$ |
基于每个权重的更新次数调整 |
Global | $η_{t,i} = α/\sqrt{t}$ $α=0.01$ |
基于全局迭代次数的平方根调整 |
Constant | $η_{t,i} = α$ $α=0.0005$ |
使用固定学习率 |

- 性能排序:Per-coordinate > Per-weight√ ≈ Constant > Global > Per-weight
- Per-coordinate方案相比最差的Per-weight方案,NE降低5%
- 全局学习率失败原因:特征训练样本不均衡导致高频特征学习率下降过快
- Per-weight方案问题:所有特征学习率下降过快,过早终止训练

LR与BOPR模型对比
文章中还提到了LR模型和BOPR模型的对比。首先我们注意到BOPR的后验方差更新越Per-coordinate学习率调整,一方面都实现了特征级别的自适应学习率,另一方面更新量都考虑了"预测意外程度"(实际标签与预测差异),所以将这两者进行比较。
It is interesting to note that the BOPR update equation for the mean is most similar to per-coordinate learning rate version of SGD for LR.
总的来说,BOPR是贝叶斯方法,提供预测分布,而LR是频率主义方法。两者的参数更新方式不同,BOPR需要维护均值和方差,而LR只需要权重。这影响了模型大小和计算量。
维度 | LR | BOPR |
---|---|---|
参数存储 | 单一权重向量 $w$ | 均值向量 $μ$ 和方差向量 $σ^2$ |
模型体积 | 1x 特征维度 | 2x 特征维度 |
预测计算 | $p = σ(w·x)$ | $p = Φ(μ·x / \sqrt{1 + x·(σ^2∘x)})$ |
不确定性估计 | 无 | 提供完整概率分布 |
更新规则 | $w ← w + η(y - p)x$ | $μ,σ^2$ 根据贝叶斯公式在线更新 |
学习率控制 | 显式设置学习率 $η$ | 通过方差 $σ^2$ 隐式控制 |
实验的结果如下:
