Skip to main content
QUICK REVIEW

[Paper Review] Comparative Study on the Performance of Categorical Variable Encoders in Classification and Regression Tasks

Wenbin Zhu, Runwen Qiu|arXiv (Cornell University)|Jan 18, 2024
Machine Learning and Data ClassificationComputer Science8 citations
TL;DR

The paper theoretically and empirically analyzes how one-hot encoders can emulate other encoders for ATI models, and why target encoders excel for tree-based models, across 28 datasets and multiple models.

ABSTRACT

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.

Motivation & Objective

  • Classify encoders and models to understand encoder-model compatibility.
  • Theoretically prove one-hot encoding as universal for ATI models.
  • Explain why target encoders are advantageous for tree-based models.
  • Empirically compare 14 encoders across 28 datasets using multiple models.

Proposed method

  • Define encoder as a mapping from category levels to a vector in R^l.
  • Prove that, for ATI models, a linear transformation of one-hot encodings can reproduce any encoder.
  • Analyze convergence behavior showing data sufficiency via average samples per level (ASPL).
  • Theoretically and empirically analyze mean (target) encoders for tree-based models like RF and GBDT.
  • Conduct extensive experiments with 14 encoders and 8 models on 28 datasets; use F1 and RMSE as performance metrics; report relative performance differences.

Experimental results

Research questions

  • RQ1Under what conditions can one-hot encoding replicate other encoders for ATI models?
  • RQ2Why are target encoders particularly suitable for tree-based models?
  • RQ3How does data sufficiency (ASPL) affect encoder performance in practice?
  • RQ4Which encoders perform best across a broad set of datasets and models?

Key findings

  • One-hot encoding can reproduce any encoder for ATI models given sufficient data.
  • Target encoders often yield superior performance for tree-based models due to more informative splits when encoding high-cardinality categories.
  • Performance gaps between one-hot and the best encoder shrink as ASPL increases, approaching zero on larger ASPL datasets.
  • Mean encoder performance declines with low ASPL but improves with more data, sometimes rivaling the best encoder; SShrink can offer marginal gains in data-sparse settings.
  • Across 28 datasets, target encoders and their variants frequently emerge as top performers for tree-based methods, while one-hot remains strong for ATI models.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.