Self-supervised Random Forest

Machine Learning
Introduced by
Lefortier, D. et al.; Criminisi, A. et al. (semi-supervised RF lineage)
Year
2012–2022
Type
Semi-supervised ensemble (self-supervised pretext task + RF)
Family
Machine learning

What does it do?

Self-supervised Random Forest (SSL-RF) is a semi-supervised tree ensemble.

The forest is first trained on pseudo-labels produced by a self-supervised pretext task defined on unlabeled data, and then refined using whatever true labels are available. The approach aims to combine the label efficiency of self-supervised learning with the ensemble structure of random forests.

The intuition behind the method

Labeled examples are often expensive, while unlabeled data of the same kind may be plentiful. SSL-RF uses the unlabeled data by first posing a surrogate task, such as predicting masked feature values or recognising transformed versions of a sample, so that the forest learns structure without human annotation. Once this structure is in place, a small labeled set is used to refine the model and to check its predictions. The final model is still a random forest, so its tree-based splitting and feature importance measures remain available for inspection.

History

The decision-forest framework underlying SSL-RF is set out in Criminisi, Shotton and Konukoglu (2012). Their review unifies classification, regression, density estimation, manifold learning, semi-supervised learning and active learning under one forest model, which may be applied to labeled or unlabeled data in a discriminative or generative way. The self-supervised random forest formulation is attributed to Lefortier, Chitta and Agrawal (2022). Its specific claims should be checked against the original paper before they are relied upon.

When to use it

Choose SSL-RF when labeled examples are scarce compared with the complexity of the problem, and a large pool of unlabeled data comes from the same distribution as the test data. It fits tabular or lightly engineered feature sets and image-derived features where tree ensembles are already a sensible baseline, and where interpretability and feature importance are needed. Do not use it when a fully labeled dataset of adequate size is available, since a standard random forest is simpler and avoids the pretext-task design. It is also a poor choice when no meaningful pretext task can be defined for the data, for example unstructured text that has not been converted to features, and when the unlabeled data are expected to differ substantially from the labeled test population.

Limitations and considerations

  • Performance depends strongly on whether the pretext task reflects the class structure that matters downstream; a task unrelated to the target can produce pseudo-labels that mislead the forest.
  • The pseudo-label encoding (hard or soft) is an implementation choice that must be made explicitly and kept consistent with the training target and the aggregation rule.
  • Iterative self-training adds a confidence threshold, a number of rounds and a stopping rule to the usual random forest hyperparameters, which makes tuning more involved.
  • Formal guarantees for the combined pretraining and refinement pipeline are not established, so error behaviour must be checked empirically.
  • If the unlabeled data distribution differs from the labeled or test distribution, the pretraining can introduce systematic bias that the refinement stage may not remove.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Uses unlabeled data from the same distribution to shape the forest. Whether this reduces the number of true labels needed depends on the pretext task and the dataset, and must be checked on a labeled validation set.
  • Keeps the tree-ensemble structure of the random forest, including its feature importance measures and its averaging over bootstrap-trained trees.
  • Tree splitting does not assume normally distributed features, a property shared with standard random forests, so no normality transformation is needed for the forest step.
  • The pretext task is a separate component, so it can be changed for a given domain without altering the forest training procedure.
  • Self-training rounds, where used, add confidently pseudo-labelled examples over time. Whether this improves label quality depends on the confidence threshold and should be checked on labeled data.

Applications

  • Medical image analysis where annotated cases are scarce, using tree-compatible image-derived features.
  • Scientific tabular datasets in which only a few confirmed class examples exist.
  • Sensor and monitoring data where labeled fault events are rare but normal operation data are abundant.
  • Image-derived feature classification where ground-truth labels are costly to obtain.

How it works

How it works

1

A pretext task is defined on the unlabeled data. Common examples are predicting whether two feature views come from the same sample, reconstructing masked features, and classifying artificially introduced transformations. The task requires no human annotation, but it has to be designed for the data at hand.

2

The pretext task supplies pseudo-labels for unlabeled samples without using ground-truth class information. Pseudo-labels can be encoded as hard class assignments or as soft class distributions. This encoding is an implementation choice: it must match the training target and the aggregation rule used at prediction time.

3

A standard random forest is trained on the pseudo-labeled data. Each tree is grown on a bootstrap sample, and at each node the split is chosen from a random subset of features, as in the usual random forest algorithm. The target signal comes from the pseudo-labels rather than from true class labels.

4

When some true labels are available, the model is refined on them, for example by a fine-tuning pass or by a self-training loop in which confidently predicted unlabeled examples receive pseudo-labels in later rounds. Such a loop needs a confidence threshold and a stopping rule, because errors in early pseudo-labels can carry into later rounds. No single schedule or threshold is prescribed for this method; these are set by the user and tuned on the labeled validation data.

5

Predictions aggregate the trees: a majority vote for classification and a mean for regression. Because the self-supervised loss is only a proxy, the accuracy of the final model should be judged on a held-out labeled validation set rather than on the pretext objective.

Formula
\hat{y} = \text{mode/mean of } T \text{ trees trained on pseudo-labeled data}

Common pitfalls

  • Choosing a pretext task that does not reflect the downstream class structure, which yields pseudo-labels that carry little information about the target.
  • Mixing unlabeled data from a different distribution with the labeled data without any adjustment, which degrades the pseudo-labels.
  • Running self-training rounds without a stopping criterion, so that errors from overconfident early pseudo-labels accumulate in later rounds.
  • Judging performance by the self-supervised objective instead of by accuracy on a held-out labeled validation set.
  • Treating pseudo-label confidence scores as calibrated probabilities without checking calibration on labeled data.

Frequently asked questions

How is Self-supervised Random Forest different from a standard semi-supervised forest?

The decision-forest framework of Criminisi et al. (2012) already covers semi-supervised learning with forests. As described on this page, SSL-RF differs by using a self-supervised pretext task to generate pseudo-labels on unlabeled data before the forest is trained, so the initial forest training needs no true labels.

What pretext tasks are suitable for tabular data?

Masked-feature prediction, in which some feature values are hidden and the forest is trained to predict them, is a common choice. Whatever task is used should correlate with the class structure of the downstream problem, and its pseudo-labels should be checked against the small labeled set before they are trusted.

Does SSL-RF require more hyperparameter tuning than a standard random forest?

Yes. Besides the usual forest settings such as the number of trees, the maximum features and the maximum depth, the user must choose and configure the pretext task, the number of self-training rounds and the confidence threshold for accepting pseudo-labels. A validation set drawn from the labeled data is needed to tune these choices.

When might a deep self-supervised model be preferable to SSL-RF?

Deep neural models are generally used for raw images or audio, where learned feature hierarchies matter. On lightly engineered tabular features, tree ensembles are often competitive, which is the setting where SSL-RF is most relevant. The choice should be made by comparing performance on a held-out labeled set.

Can SSL-RF handle class imbalance?

Imbalance can be addressed with the usual random forest measures, such as class weighting or oversampling of the minority class, and by the confidence threshold used when selecting pseudo-labels. Self-training can, however, make imbalance worse if confident pseudo-labels favour the majority class, so per-class error should be checked on the labeled validation set.

Related methods

Sources

  1. Lefortier, D., Chitta, K., & Agrawal, P. (2022). Self-supervised random forests. arXiv:2204.01430.

    Open publication reference
  2. Criminisi, A., Shotton, J., & Konukoglu, E. (2012). Decision forests: A unified framework for classification, regression, density estimation, manifold learning and semi-supervised learning. Foundations and Trends in Computer Graphics and Vision, 7(2–3), 81–227.

    Open DOI reference