Abstract
The Random Forests classifier, a widely utilized off-the-shelf classification tool, assumes training and test samples come from the same distribution as other standard classifiers. However, in safety-critical scenarios like medical diagnosis and network attack detection, discrepancies between the training and test sets, including the potential presence of novel outlier samples not appearing during training, can pose significant challenges. To address this problem, we introduce the Conformalized Semi-Supervised Random Forest (CSForest), which couples the conformalization technique Jackknife+ aB with semi-supervised tree ensembles to construct a set-valued prediction. Instead of optimizing over the training distribution, CSForest employs unlabeled test samples to enhance accuracy and flag unseen outliers by generating an empty set. Theoretically, we establish CSForest to cover true labels for previously observed inlier classes under arbitrarily label-shift in the test data. We compare CSForest with state-of-the-art methods using synthetic examples and various real-world datasets, under different types of distribution changes in the test domain. Our results highlight CSForest’s effective prediction of inliers and its ability to detect outlier samples unique to the test data. In addition, CSForest shows persistently good performance as the sizes of the training and test sets vary.
Introduction
Standard machine learning classifiers typically operate under a "closed-world" assumption, expecting test data to mirror the training distribution. However, real-world applications in high-stakes fields like healthcare or cybersecurity often face two major challenges: label shift, where class proportions change dynamically, and abnormalities, where novel samples appear that were absent during training.
Traditional models often produce overconfident, incorrect predictions for these novel samples. While Conformal Prediction offers a framework for uncertainty quantification by producing sets of possible labels, existing methods often require data-inefficient sample-splitting. CSForest addresses these limitations by integrating semi-supervised learning with conformal inference.
Methodology: The CSForest Framework
CSForest bridges the gap between semi-supervised learning and conformal inference through a multi-stage pipeline designed to handle distribution shifts and detect novelties.
The core components of the methodology include:
- Semi-Supervised Tree Construction: Unlike standard forests, CSForest builds trees using both labeled training data and unlabeled test data. By treating the test set as its own "class" during splitting, the model learns the specific boundaries of the deployment environment.
- Jackknife+aB Integration: To maximize data utility, the authors adapt the "Jackknife+-after-Bootstrap" (Jackknife+aB) technique. This allows the entire dataset to be used for both training and calibration, maintaining theoretical coverage guarantees without the waste of simple sample-splitting.
- Set-Valued Prediction: The model outputs a set $C(x)$ rather than a single label. If a sample is highly uncertain, the set may contain multiple labels. Crucially, if a sample is significantly different from the training data, the model returns an empty set ($\emptyset$), effectively flagging it as an abnormality.
- Optimization: The framework is tuned to minimize the size of the prediction set (efficiency) while ensuring the true label is included at a user-defined confidence level (e.g., 95%).
Experimental Evaluation
The authors evaluated CSForest against baselines like BCOPS and standard Conformal Random Forests across diverse datasets, including synthetic 2D data, image benchmarks (MNIST, FashionMNIST, CIFAR-10), and domain-specific data like KDD Network Intrusion and Chest X-ray datasets. Experiments simulated label shift by varying class proportions and outliers by withholding specific classes during training.
Key Results
- Outlier Detection: On MNIST, CSForest achieved approximately 90% outlier detection accuracy, significantly outperforming standard conformal methods.
- Efficiency: CSForest produced narrower, more useful prediction sets. On MNIST and FashionMNIST, standard methods had Type II errors (inclusion of incorrect labels) 10% to 50% higher than CSForest.
- Stability: The model maintained "persistently good performance" across varying training and test set sizes, whereas competitors often degraded when test data was limited.
Discussion and Insights
CSForest introduces the "empty set" as a mathematically grounded feature for abnormality detection, allowing the model to signal "unknown" rather than making a forced guess. The use of Jackknife+aB ensures high data efficiency, leading to tighter prediction sets for inliers.
Theoretically, CSForest is robust, maintaining coverage guarantees under arbitrary label shift, provided the feature distribution for each class ($x|y$) remains stable. A weight parameter $w$ allows users to balance optimization between training and test distributions.
Limitations
The current theoretical guarantees rely on the "Generalized Label Shift" assumption, which assumes class characteristics stay the same even if proportions change. Future work may explore relaxing this to handle "covariate shift." Additionally, while CSForest outperforms other methods, very small test sets (e.g., 5 samples per class) remain a challenging frontier for outlier detection.
Summary updated