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

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 <i>vs</i>. 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.

Authors

Institutions

Publication Details

Journal
PeerJ Computer Science
Published
2024-11-18
DOI
https://doi.org/10.7717/peerj-cs.2445
Citations
11
Primary Topic
Machine Learning and Data Classification
Type
article
Field-Weighted Citation Impact
3.82

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

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

Helen Smith, Nigel French, Patrick J. Biggs, Jonathan C. Marshall et al.
11 citations
PeerJ Computer Science
Machine Learning and Data Classification
3.82
article

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

Helen Smith, Nigel French, Patrick J. Biggs, Jonathan C. Marshall, Adam N. H. Smith
article en
11 citations

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 <i>vs</i>. 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.

PeerJ Computer ScienceVol. 10
Massey University (NZ)
New Zealand Food Safety Science and Research Centre
Life in Land
Openalex Percentile: Top 6%
Machine Learning and Data Classification
3.82
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.