1. Out of (the) bag—encoding categorical predictors impacts out-of-bag samples
- Author
-
Helen L. Smith, Patrick J. Biggs, Nigel P. French, Adam N. H. Smith, and Jonathan C. Marshall
- Subjects
Absent levels ,Categorical predictors ,Label encoding ,Out-of-bag error ,Random forest ,Variable importance ,Electronic computers. Computer science ,QA75.5-76.95 - Abstract
Performance of random forest classification models is often assessed and interpreted using out-of-bag (OOB) samples. Observations which are OOB when a tree is trained may serve as a test set for that tree and predictions from the OOB observations used to calculate OOB error and variable importance measures (VIM). OOB errors are popular because they are fast to compute and, for large samples, are a good estimate of the true prediction error. In this study, we investigate how target-based vs. target-agnostic encoding of categorical predictor variables for random forest can bias performance measures based on OOB samples. We show that, when categorical variables are encoded using a target-based encoding method, and when the encoding takes place prior to bagging, the OOB sample can underestimate the true misclassification rate, and overestimate variable importance. We recommend using a separate test data set when evaluating variable importance and/or predictive performance of tree based methods that utilise a target-based encoding method.
- Published
- 2024
- Full Text
- View/download PDF