Data Mining and Knowledge DiscoveryBioinformaticsPeer-reviewed journal article
Lost In The Forest: Encoding Categorical Variables and the Absent Levels Problem
Helen L. SmithiD, Patrick J. BiggsiD, Nigel Peter FrenchiD, Adam N. H. SmithiD, Jonathan C. MarshalliD
Abstract
Levels of a predictor variable that are absent when a classification tree is grown can not be subject to an explicit splitting rule. This is an issue if these absent levels then present in a new observation for prediction. To date, there remains no satisfactory solution for absent levels in random forest models. Unlike missing data, absent levels are fully observed and known. Ordinal encoding of predictors allows absent levels to be integrated and used for prediction. Using a case study on source attribution of Campylobacter species using whole genome sequencing (WGS) data as predictors, we examine how target-agnostic versus target-based encoding of predictor variables with absent levels affects the accuracy of random forest models. We show that a target-based encoding approach using class probabilities, with absent levels designated the highest rank, is systematically biased, and that this bias is resolved by encoding absent levels according to the a priori hypothesis of equal class probability. We present a novel method of ordinal encoding predictors via principal coordinates analysis (PCO) which capitalizes on the similarity between pairs of predictor levels. Absent levels are encoded according to their similarity to each of the other levels in the training data. We show that the PCO-encoding method performs at least as well as the target-based approach and is not biased.
- Citations
- 15
- FWCI
- 5.66
- Field percentile
- top 4%
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- Modelling species presence-only data with random forests
R. Valavi, J. Elith, … G. Guillera-Arroita·bioRxiv·Nov 16, 2020
- Structuring the unstructured: estimating species-specific absence from multi-species presence data to inform pseudo-absence selection in species distribution models
S. Croft, G. C. Smith·bioRxiv·May 31, 2019
- Robust Random Forests for Genomic Prediction: Challenges and Remedies
Vanda Lourenço, Joseph Ochieng Ogutu, Hans‐Peter Piepho·bioRxiv·May 22, 2026
- Preferential sampling for presence/absence data and for fusion of presence/absence data with presence-only data
A. Gelfand, S. Shirota·bioRxiv·Sep 7, 2018
- Predicting long-term multicategory cause of death in patients with prostate cancer: random forest versus multinomial model
Jianwei Wang, Fei Deng, … Lanjing Zhang·bioRxiv·Jan 3, 2020
- Predicting predator-prey interactions in terrestrial endotherms using random forest
J. Llewelyn, G. Strona, … C. J. A. Bradshaw·bioRxiv·Sep 2, 2022