Litcius/Paper detail

Encoding High-Cardinality String Categorical Variables

Patricio Cerda, Gaël Varoquaux

2020IEEE Transactions on Knowledge and Data Engineering115 citationsDOIOpen Access PDF

Abstract

Statistical models usually require vector representations of categorical variables, using for instance <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">one-hot encoding</i> . This strategy breaks down when the number of categories grows, as it creates high-dimensional feature vectors. Additionally, for string entries, one-hot encoding does not capture morphological information in their representation. Here, we seek low-dimensional encoding of high-cardinality string categorical variables. Ideally, these should be: scalable to many categories; interpretable to end users; and facilitate statistical analysis. We introduce two encoding approaches for string categories: a <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">Gamma-Poisson matrix factorization</i> on substring counts, and a <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">min-hash encoder</i> , for fast approximation of string similarities. We show that min-hash turns set inclusions into inequality relations that are easier to learn. Both approaches are scalable and streamable. Experiments on real and simulated data show that these methods improve supervised learning with high-cardinality categorical variables. We recommend the following: if scalability is central, the min-hash encoder is the best option as it does not require any data fit; if interpretability is important, the Gamma-Poisson factorization is the best alternative, as it can be interpreted as one-hot encoding on inferred categories with informative feature names. Both models enable autoML on string entries as they remove the need for feature engineering or data cleaning.

Topics & Concepts

String (physics)Categorical variableComputer scienceCardinality (data modeling)ScalabilityHash functionTheoretical computer scienceInterpretabilityArtificial intelligenceData miningMachine learningMathematicsProgramming languageDatabaseMathematical physicsTopic ModelingNatural Language Processing TechniquesMachine Learning and Data Classification
Encoding High-Cardinality String Categorical Variables | Litcius