[论文解读] Encoding Categorical Variables with Conjugate Bayesian Models for WeWork Lead Scoring Engine
本文提出了一种共轭贝叶斯模型(CBM)编码技术,用于处理机器学习中的高基数分类变量,特别适用于WeWork的潜在客户评分引擎。通过使用问题特定的共轭先验分布(如二分类任务中的Beta分布),该方法通过解析后验更新将分类特征转换为低维数值编码,实现了训练速度提升10倍,并在具有高达346,727个唯一类别的真实数据上将AUC从0.87提升至0.97。
Applied Data Scientists throughout various industries are commonly faced with the challenging task of encoding high-cardinality categorical features into digestible inputs for machine learning algorithms. This paper describes a Bayesian encoding technique developed for WeWork's lead scoring engine which outputs the probability of a person touring one of our office spaces based on interaction, enrichment, and geospatial data. We present a paradigm for ensemble modeling which mitigates the need to build complicated preprocessing and encoding schemes for categorical variables. In particular, domain-specific conjugate Bayesian models are employed as base learners for features in a stacked ensemble model. For each column of a categorical feature matrix we fit a problem-specific prior distribution, for example, the Beta distribution for a binary classification problem. In order to analytically derive the moments of the posterior distribution, we update the prior with the conjugate likelihood of the corresponding target variable for each unique value of the given categorical feature. This function of column and value encodes the categorical feature matrix so that the final learner in the ensemble model ingests low-dimensional numerical input. Experimental results on both curated and real world datasets demonstrate impressive accuracy and computational efficiency on a variety of problem archetypes. Particularly, for the lead scoring engine at WeWork -- where some categorical features have as many as 300,000 levels -- we have seen an AUC improvement from 0.87 to 0.97 through implementing conjugate Bayesian model encoding.
研究动机与目标
- 解决将高基数分类特征(如具有346,727个唯一值的公司电子邮件域名)转化为机器学习模型可用的有意义数值输入的挑战。
- 克服传统编码方法(如独热编码)在稀疏性、高维性和对罕见或未见类别泛化能力差方面的局限性。
- 开发一种可扩展、计算高效且具有统计合理性的编码方法,支持实时推理并能泛化至罕见类别。
- 在多样化数据类型和基数水平下评估该方法的性能,包括真实世界的潜在客户评分数据和基准数据集(如PetFinder)。
- 证明共轭贝叶斯模型可作为堆叠集成模型中的有效基学习器,从而提升预测准确性和计算效率。
提出的方法
- 针对每个分类特征,基于目标变量的分布,拟合问题特定的共轭先验分布(如二分类任务中的Beta分布,多分类结果任务中的Dirichlet分布)。
- 通过使用观测数据中的充分统计量,将先验分布与目标变量的共轭似然函数结合,解析地计算后验分布。
- 每个类别值的后验均值(或后验众数)即为其数值编码,从而将高基数特征降维为低维、稠密的表示形式。
- 这些编码作为堆叠集成模型中元学习器的输入特征,其中基学习器在转换后的数据上独立训练。
- 通过利用先验分布作为正则化机制,该方法可实现对未见类别的泛化,尤其适用于罕见或新出现的值。
- 该方法计算高效,因为编码维度不随样本量或基数大小而变化,避免了独热编码带来的组合爆炸问题。
实验结果
研究问题
- RQ1共轭贝叶斯模型能否在保持预测性能的同时,有效编码高基数分类特征,并实现对罕见或未见类别的泛化?
- RQ2在大规模真实数据集上,CBM编码与传统方法(如独热编码和哈希编码)相比,在准确性、训练时间和可扩展性方面表现如何?
- RQ3在罕见分类水平的低样本场景下,使用共轭先验在多大程度上提升了模型的泛化能力?
- RQ4随着数据集规模和特征基数的增加,该方法是否仍能保持计算效率,尤其与稀疏编码技术相比?
- RQ5能否系统性地选择问题特定的共轭先验分布(如Beta、GIG、Dirichlet)以在不同机器学习任务中最大化性能?
主要发现
- 在具有高达346,727个唯一类别的真实数据集上,CBM编码将WeWork潜在客户评分模型的AUC从0.87提升至0.97。
- 与scikit-learn的哈希编码器相比,该方法将训练时间减少了100倍以上,并且在样本量增长时计算时间仅略有增加。
- 在PetFinder数据集上,GIG编码器取得了0.3999的加权 kappa 评分,优于哈希编码(0.3777)和独热编码(0.3485),尽管其维度更低。
- 在潜在客户评分数据集上,Beta编码器仅用5个维度即达到92.53%的准确率,显著优于独热编码(91.62%)和哈希编码(91.52%)在更高维输入下的表现。
- 当样本量从2,000增至50,000时,CBM编码的训练时间增加不足1秒,而独热编码的训练时间则从10秒增至400秒以上,这是由于基数和稀疏性持续上升所致。
- 随着样本量增加,该模型表现出更高的准确性,而独热编码则因维度灾难导致准确率下降。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。