[论文解读] Comparative Study on the Performance of Categorical Variable Encoders in Classification and Regression Tasks
本文在理论和实证上分析 one-hot 编码器如何模仿 ATI 模型的其他编码,以及为何 target 编码在基于树的模型中表现出色,覆盖 28 个数据集和多种模型。
Categorical variables often appear in datasets for classification and regression tasks, and they need to be encoded into numerical values before training. Since many encoders have been developed and can significantly impact performance, choosing the appropriate encoder for a task becomes a time-consuming yet important practical issue. This study broadly classifies machine learning models into three categories: 1) ATI models that implicitly perform affine transformations on inputs, such as multi-layer perceptron neural network; 2) Tree-based models that are based on decision trees, such as random forest; and 3) the rest, such as kNN. Theoretically, we prove that the one-hot encoder is the best choice for ATI models in the sense that it can mimic any other encoders by learning suitable weights from the data. We also explain why the target encoder and its variants are the most suitable encoders for tree-based models. This study conducted comprehensive computational experiments to evaluate 14 encoders, including one-hot and target encoders, along with eight common machine-learning models on 28 datasets. The computational results agree with our theoretical analysis. The findings in this study shed light on how to select the suitable encoder for data scientists in fields such as fraud detection, disease diagnosis, etc.
研究动机与目标
- 对编码器和模型进行分类,以理解编码器与模型的兼容性。
- 从理论上证明 one-hot 编码对 ATI 模型具有通用性。
- 解释为何 target 编码在基于树的模型中更有优势。
- 基于多模型在 28 个数据集上对 14 种编码器进行实证比较。
提出的方法
- 将编码器定义为从类别水平到 R^l 向量的映射。
- 证明对于 ATI 模型,one-hot 编码的线性变换可以重现任意编码器。\n
- 分析收敛行为,显示通过每个水平的平均样本数(ASPL)来衡量数据充分性。
- 从理论和实证角度分析用于基于树的模型(如 RF 和 GBDT)的 Mean(target)编码。
- 在 28 个数据集上对 14 种编码器和 8 种模型进行大规模实验;使用 F1 和 RMSE 作为性能指标;报告相对性能差异。
实验结果
研究问题
- RQ1在何种条件下,one-hot 编码可以重现 ATI 模型的其他编码?
- RQ2为何 target 编码在基于树的模型中特别适用?
- RQ3数据充分性(ASPL)在实际中如何影响编码器性能?
- RQ4在广泛的数据集和模型中,哪些编码器表现最佳?
主要发现
- 在数据充足的前提下,one-hot 编码可以重现 ATI 模型的任意编码。
- target 编码在高基数类别编码时能提供更具信息量的分裂,因此在基于树的模型中通常性能更优。
- 随着 ASPL 增加,one-hot 与最优编码器之间的性能差距缩小,在更大 ASPL 的数据集上接近零。
- Mean 编码器在低 ASPL 时性能下降,但数据增多时提升,有时甚至接近最佳编码器;SShrink 在数据稀缺场景下可带来微小增益。
- 在 28 个数据集上,target 编码及其变体在基于树的方法中经常成为顶尖;而 one-hot 对 ATI 模型仍然表现强劲。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。