IDEAS home Printed from https://ideas.repec.org/a/spr/compst/v37y2022i5d10.1007_s00180-022-01207-6.html
   My bibliography  Save this article

Regularized target encoding outperforms traditional methods in supervised machine learning with high cardinality features

Author

Listed:
  • Florian Pargent

    (Psychological Methods and Assessment, LMU Munich)

  • Florian Pfisterer

    (Statistical Learning and Data Science, LMU Munich)

  • Janek Thomas

    (Statistical Learning and Data Science, LMU Munich)

  • Bernd Bischl

    (Statistical Learning and Data Science, LMU Munich)

Abstract

Since most machine learning (ML) algorithms are designed for numerical inputs, efficiently encoding categorical variables is a crucial aspect in data analysis. A common problem are high cardinality features, i.e. unordered categorical predictor variables with a high number of levels. We study techniques that yield numeric representations of categorical variables which can then be used in subsequent ML applications. We focus on the impact of these techniques on a subsequent algorithm’s predictive performance, and—if possible—derive best practices on when to use which technique. We conducted a large-scale benchmark experiment, where we compared different encoding strategies together with five ML algorithms (lasso, random forest, gradient boosting, k-nearest neighbors, support vector machine) using datasets from regression, binary- and multiclass–classification settings. In our study, regularized versions of target encoding (i.e. using target predictions based on the feature levels in the training set as a new numerical feature) consistently provided the best results. Traditionally widely used encodings that make unreasonable assumptions to map levels to integers (e.g. integer encoding) or to reduce the number of levels (possibly based on target information, e.g. leaf encoding) before creating binary indicator variables (one-hot or dummy encoding) were not as effective in comparison.

Suggested Citation

  • Florian Pargent & Florian Pfisterer & Janek Thomas & Bernd Bischl, 2022. "Regularized target encoding outperforms traditional methods in supervised machine learning with high cardinality features," Computational Statistics, Springer, vol. 37(5), pages 2671-2692, November.
  • Handle: RePEc:spr:compst:v:37:y:2022:i:5:d:10.1007_s00180-022-01207-6
    DOI: 10.1007/s00180-022-01207-6
    as

    Download full text from publisher

    File URL: http://link.springer.com/10.1007/s00180-022-01207-6
    File Function: Abstract
    Download Restriction: Access to the full text of the articles in this series is restricted.

    File URL: https://libkey.io/10.1007/s00180-022-01207-6?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    References listed on IDEAS

    as
    1. D. J. Hand & W. E. Henley, 1997. "Statistical Classification Methods in Consumer Credit Scoring: a Review," Journal of the Royal Statistical Society Series A, Royal Statistical Society, vol. 160(3), pages 523-541, September.
    2. Jan Leeuw & Forrest Young & Yoshio Takane, 1976. "Additive structure in qualitative data: An alternating least squares method with optimal scaling features," Psychometrika, Springer;The Psychometric Society, vol. 41(4), pages 471-503, December.
    3. Wright, Marvin N. & Ziegler, Andreas, 2017. "ranger: A Fast Implementation of Random Forests for High Dimensional Data in C++ and R," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 77(i01).
    4. Bates, Douglas & Mächler, Martin & Bolker, Ben & Walker, Steve, 2015. "Fitting Linear Mixed-Effects Models Using lme4," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 67(i01).
    5. Bommert, Andrea & Sun, Xudong & Bischl, Bernd & Rahnenführer, Jörg & Lang, Michel, 2020. "Benchmark for filter methods for feature selection in high-dimensional classification data," Computational Statistics & Data Analysis, Elsevier, vol. 143(C).
    6. Friedman, Jerome H. & Hastie, Trevor & Tibshirani, Rob, 2010. "Regularization Paths for Generalized Linear Models via Coordinate Descent," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 33(i01).
    7. Forrest Young & Jan Leeuw & Yoshio Takane, 1976. "Regression with qualitative and quantitative variables: An alternating least squares method with optimal scaling features," Psychometrika, Springer;The Psychometric Society, vol. 41(4), pages 505-529, December.
    8. Mair, Patrick & de Leeuw, Jan, 2010. "A General Framework for Multivariate Analysis with Optimal Scaling: The R Package aspect," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 32(i09).
    Full references (including those not matched with items on IDEAS)

    Citations

    Citations are extracted by the CitEc Project, subscribe to its RSS feed for this item.
    as


    Cited by:

    1. Benjamin Avanzi & Greg Taylor & Melantha Wang & Bernard Wong, 2023. "Machine Learning with High-Cardinality Categorical Features in Actuarial Applications," Papers 2301.12710, arXiv.org.

    Most related items

    These are the items that most often cite the same works as this one and are cited by the same works as this one.
    1. Jian Lu & Raheel Ahmad & Thomas Nguyen & Jeffrey Cifello & Humza Hemani & Jiangyuan Li & Jinguo Chen & Siyi Li & Jing Wang & Achouak Achour & Joseph Chen & Meagan Colie & Ana Lustig & Christopher Dunn, 2022. "Heterogeneity and transcriptome changes of human CD8+ T cells across nine decades of life," Nature Communications, Nature, vol. 13(1), pages 1-13, December.
    2. Kadziński, MiŁosz & Greco, Salvatore & SŁowiński, Roman, 2012. "Extreme ranking analysis in robust ordinal regression," Omega, Elsevier, vol. 40(4), pages 488-501.
    3. Van Belle, Jente & Guns, Tias & Verbeke, Wouter, 2021. "Using shared sell-through data to forecast wholesaler demand in multi-echelon supply chains," European Journal of Operational Research, Elsevier, vol. 288(2), pages 466-479.
    4. Philipp Bach & Victor Chernozhukov & Malte S. Kurz & Martin Spindler & Sven Klaassen, 2021. "DoubleML -- An Object-Oriented Implementation of Double Machine Learning in R," Papers 2103.09603, arXiv.org, revised Feb 2024.
    5. Michael Bucker & Gero Szepannek & Alicja Gosiewska & Przemyslaw Biecek, 2020. "Transparency, Auditability and eXplainability of Machine Learning Models in Credit Scoring," Papers 2009.13384, arXiv.org.
    6. Fogliato Riccardo & Oliveira Natalia L. & Yurko Ronald, 2021. "TRAP: a predictive framework for the Assessment of Performance in Trail Running," Journal of Quantitative Analysis in Sports, De Gruyter, vol. 17(2), pages 129-143, June.
    7. van Rosmalen, J.M. & Koning, A.J. & Groenen, P.J.F., 2007. "Optimal Scaling of Interaction Effects in Generalized Linear Models," Econometric Institute Research Papers EI 2007-44, Erasmus University Rotterdam, Erasmus School of Economics (ESE), Econometric Institute.
    8. Yadid M. Algavi & Elhanan Borenstein, 2023. "A data-driven approach for predicting the impact of drugs on the human microbiome," Nature Communications, Nature, vol. 14(1), pages 1-13, December.
    9. Hye Won Suk & Heungsun Hwang, 2016. "Functional Generalized Structured Component Analysis," Psychometrika, Springer;The Psychometric Society, vol. 81(4), pages 940-968, December.
    10. Barbara Emmenegger & Julien Massoni & Christine M. Pestalozzi & Miriam Bortfeld-Miller & Benjamin A. Maier & Julia A. Vorholt, 2023. "Identifying microbiota community patterns important for plant protection using synthetic communities and machine learning," Nature Communications, Nature, vol. 14(1), pages 1-15, December.
    11. Lauren P. Grant & Chris Gennings & Edmond P. Wickham & Derek Chapman & Shumei Sun & David C. Wheeler, 2018. "Modeling Pediatric Body Mass Index and Neighborhood Environment at Different Spatial Scales," IJERPH, MDPI, vol. 15(3), pages 1-19, March.
    12. Michio Yamamoto, 2012. "Clustering of functional data in a low-dimensional subspace," Advances in Data Analysis and Classification, Springer;German Classification Society - Gesellschaft für Klassifikation (GfKl);Japanese Classification Society (JCS);Classification and Data Analysis Group of the Italian Statistical Society (CLADAG);International Federation of Classification Societies (IFCS), vol. 6(3), pages 219-247, October.
    13. Takane, Yoshio, 2016. "My Early Interactions with Jan and Some of His Lost Papers," Journal of Statistical Software, Foundation for Open Access Statistics, vol. 73(i07).
    14. Zhou, Lixing & Takane, Yoshio & Hwang, Heungsun, 2016. "Dynamic GSCANO (Generalized Structured Canonical Correlation Analysis) with applications to the analysis of effective connectivity in functional neuroimaging data," Computational Statistics & Data Analysis, Elsevier, vol. 101(C), pages 93-109.
    15. Seohee Park & Seongeun Kim & Ji Hoon Ryoo, 2020. "Latent Class Regression Utilizing Fuzzy Clusterwise Generalized Structured Component Analysis," Mathematics, MDPI, vol. 8(11), pages 1-16, November.
    16. Kouame, Anselme K.K. & Bindraban, Prem S. & Kissiedu, Isaac N. & Atakora, Williams K. & El Mejahed, Khalil, 2023. "Identifying drivers for variability in maize (Zea mays L.) yield in Ghana: A meta-regression approach," Agricultural Systems, Elsevier, vol. 209(C).
    17. John C. Gower & Sugnet Gardner-Lubbe & Niel J. Le Roux, 2018. "Interaction: Fisher’s Optimal Scores Revisited," Journal of Agricultural, Biological and Environmental Statistics, Springer;The International Biometric Society;American Statistical Association, vol. 23(1), pages 92-112, March.
    18. Joshua P White & Simon Dennis & Martin Tomko & Jessica Bell & Stephan Winter, 2021. "Paths to social licence for tracking-data analytics in university research and services," PLOS ONE, Public Library of Science, vol. 16(5), pages 1-19, May.
    19. Maria Giovanna Onorati & Francesco D. d’Ovidio & Laura Antonucci, 2017. "Cultural displacement as a lever to global-ready student profiles: results from a longitudinal study on International Lifelong Learning Programs (LLP)," Quality & Quantity: International Journal of Methodology, Springer, vol. 51(2), pages 545-563, March.
    20. Jack S. Gisby & Norzawani B. Buang & Artemis Papadaki & Candice L. Clarke & Talat H. Malik & Nicholas Medjeral-Thomas & Damiola Pinheiro & Paige M. Mortimer & Shanice Lewis & Eleanor Sandhu & Stephen , 2022. "Multi-omics identify falling LRRC15 as a COVID-19 severity marker and persistent pro-thrombotic signals in convalescence," Nature Communications, Nature, vol. 13(1), pages 1-21, December.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:spr:compst:v:37:y:2022:i:5:d:10.1007_s00180-022-01207-6. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    If CitEc recognized a bibliographic reference but did not link an item in RePEc to it, you can help with this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Sonal Shukla or Springer Nature Abstracting and Indexing (email available below). General contact details of provider: http://www.springer.com .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.