Encoding high-cardinality string categorical variables - Inria - Institut national de recherche en sciences et technologies du numérique Accéder directement au contenu
Pré-Publication, Document De Travail Année : 2019

Encoding high-cardinality string categorical variables

Résumé

Statistical models usually require vector representations of categorical variables, using for instance one-hot encoding. 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 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 Gamma-Poisson matrix factorization on substring counts, and the min-hash encoder, 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 the original string entries as they remove the need for feature engineering or data cleaning.
Fichier principal
Vignette du fichier
article.pdf (2.31 Mo) Télécharger le fichier
Origine : Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-02171256 , version 1 (02-07-2019)
hal-02171256 , version 2 (10-07-2019)
hal-02171256 , version 3 (15-07-2019)
hal-02171256 , version 4 (24-07-2019)
hal-02171256 , version 5 (15-05-2020)

Identifiants

Citer

Patricio Cerda, Gaël Varoquaux. Encoding high-cardinality string categorical variables. 2019. ⟨hal-02171256v4⟩
2313 Consultations
1924 Téléchargements

Altmetric

Partager

Gmail Facebook X LinkedIn More