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. 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).
    2. 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.
    3. 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).
    4. 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.
    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. 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.
    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. Wang, Ruihan & Zhang, Mingyang & Gong, Fuzhong & Wang, Shaohan & Yan, Ran, 2025. "Improving port state control through a transfer learning-enhanced XGBoost model," Reliability Engineering and System Safety, Elsevier, vol. 253(C).
    2. 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. Colin Griesbach & Andreas Groll & Elisabeth Bergherr, 2021. "Addressing cluster-constant covariates in mixed effects models via likelihood-based boosting techniques," PLOS ONE, Public Library of Science, vol. 16(7), pages 1-17, July.
    4. 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.
    5. 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).
    6. Foutzopoulos, Giorgos & Pandis, Nikolaos & Tsagris, Michail, 2024. "Predicting full retirement attainment of NBA players," MPRA Paper 121540, University Library of Munich, Germany.
    7. Johnson, Jean-Martial & Becker, Mathias & Dossou-Yovo, Elliott Ronald & Saito, Kazuki, 2024. "Enhancing rice yields, water productivity, and profitability through alternate wetting and drying technology in farmers’ fields in the dry climatic zones of West Africa," Agricultural Water Management, Elsevier, vol. 304(C).
    8. Gyeongcheol Cho & Heungsun Hwang & Marko Sarstedt & Christian M. Ringle, 2020. "Cutoff criteria for overall model fit indexes in generalized structured component analysis," Journal of Marketing Analytics, Palgrave Macmillan, vol. 8(4), pages 189-202, December.
    9. 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.
    10. 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 Jun 2024.
    11. 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.
    12. Kwanghee Jung & Yoshio Takane & Heungsun Hwang & Todd Woodward, 2012. "Dynamic GSCA (Generalized Structured Component Analysis) with Applications to the Analysis of Effective Connectivity in Functional Neuroimaging Data," Psychometrika, Springer;The Psychometric Society, vol. 77(4), pages 827-848, October.
    13. van der Kooij, Anita J. & Meulman, Jacqueline J. & Heiser, Willem J., 2006. "Local minima in categorical multiple regression," Computational Statistics & Data Analysis, Elsevier, vol. 50(2), pages 446-462, January.
    14. 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.
    15. 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.
    16. Bennett, Donyetta & Mekelburg, Erik & Strauss, Jack & Williams, T.H., 2024. "Unlocking the black box of sentiment and cryptocurrency: What, which, why, when and how?," Global Finance Journal, Elsevier, vol. 60(C).
    17. 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.
    18. 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.
    19. Monica E. Ellwood-Lowe & Susan Whitfield-Gabrieli & Silvia A. Bunge, 2021. "Brain network coupling associated with cognitive performance varies as a function of a child’s environment in the ABCD study," Nature Communications, Nature, vol. 12(1), pages 1-14, December.
    20. 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.

    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.