Out of (the) bag—encoding categorical predictors impacts out-of-bag samples

Loading...
Thumbnail Image

Date

2024-01-01

DOI

Open Access Location

Journal Title

Journal ISSN

Volume Title

Publisher

PeerJ Inc.

Rights

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.

Description

Keywords

Absent levels, Categorical predictors, Label encoding, Out-of-bag error, Random forest, Variable importance

Citation

Smith HL, Biggs PJ, French NP, Smith ANH, Marshall JC. (2024). Out of (the) bag—encoding categorical predictors impacts out-of-bag samples. PeerJ Computer Science. 10. (pp. 1-18).

Collections

Endorsement

Review

Supplemented By

Referenced By