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. 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).
    3. 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.
    4. 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).
    5. 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).
    6. 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.
    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. 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. 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.
    4. 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.
    5. 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.
    6. 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.
    7. 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.
    8. 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.
    9. 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.
    10. 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.
    11. Vanessa Ress & Eva‐Maria Wild, 2024. "The impact of integrated care on health care utilization and costs in a socially deprived urban area in Germany: A difference‐in‐differences approach within an event‐study framework," Health Economics, John Wiley & Sons, Ltd., vol. 33(2), pages 229-247, February.
    12. Natale Carlo Lauro & Maria Gabriella Grassia & Rosanna Cataldo, 2018. "Model Based Composite Indicators: New Developments in Partial Least Squares-Path Modeling for the Building of Different Types of Composite Indicators," Social Indicators Research: An International and Interdisciplinary Journal for Quality-of-Life Measurement, Springer, vol. 135(2), pages 421-455, January.
    13. Andreas Floren & Tobias Müller, 2023. "Using a Machine Learning Approach to Classify the Degree of Forest Management," Sustainability, MDPI, vol. 15(16), pages 1-14, August.
    14. Heungsun Hwang & Gyeongcheol Cho, 2020. "Global Least Squares Path Modeling: A Full-Information Alternative to Partial Least Squares Path Modeling," Psychometrika, Springer;The Psychometric Society, vol. 85(4), pages 947-972, December.
    15. Qian Wang & Tao Yan & Zhengbiao Long & Luna Yue Huang & Yang Zhu & Ying Xu & Xiaoyang Chen & Haksong Pak & Jiqiang Li & Dezhi Wu & Yang Xu & Shuijin Hua & Lixi Jiang, 2021. "Prediction of heterosis in the recent rapeseed (Brassica napus) polyploid by pairing parental nucleotide sequences," PLOS Genetics, Public Library of Science, vol. 17(11), pages 1-22, November.
    16. 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.
    17. Ganzeboom, H.B.G. & de Graaf, P.M. & Treiman, D.J. & de Leeuw, J., 1992. "A standard international socio-economic index of occupational status," WORC Paper 92.01.001/1, Tilburg University, Work and Organization Research Centre.
    18. Satre-Meloy, Aven & Diakonova, Marina & Grünewald, Philipp, 2020. "Cluster analysis and prediction of residential peak demand profiles using occupant activity data," Applied Energy, Elsevier, vol. 260(C).
    19. Hye Won Suk & Heungsun Hwang, 2016. "Functional Generalized Structured Component Analysis," Psychometrika, Springer;The Psychometric Society, vol. 81(4), pages 940-968, December.
    20. 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.

    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.