liveBook · Manning

Prediction averaging

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

An averaging ensemble combines predictions from multiple models by averaging their outputs or taking a majority vote.

Prediction averaging combines multiple models to produce one prediction. For regression, it averages outputs; for classification, it uses majority voting. The models differ because they train on different samples, features, or both, making the combined estimate more reliable than a single model. section 5.1.1

Common averaging strategies differ in how they vary the training data:

  • Pasting trains models on subsamples drawn without replacement, then pools their predictions. section 5.1.1
  • Bagging uses bootstrapped samples, or sampling with replacement, to create diverse models. section 5.1.1
  • Random subspaces sample features, while random patches sample both training examples and features. section 5.1.1
  • These approaches primarily reduce prediction variance, although sampling can increase bias by excluding parts of the data distribution and can raise computational cost. section 5.6
Table 5.1 Bagging and sampling strategies (view table figure)

Averaging strategy

What happens to data

Parameters for BaggingClassifier/BaggingRegressor

Pasting

Training examples are sampled without replacement

bootstrap = False

max_samples < 1.0

max_features = 1.0

Bagging

Training examples are sampled with replacement (bootstrapping)

bootstrap = True

max_samples = 1.0

max_features = 1.0

Random subspaces

Features are sampled (without replacement)

bootstrap = False

max_samples = 1.0

max_features < 1.0

Random patches

Training examples and features are sampled without replacement

bootstrap = False

max_samples < 1.0

max_features < 1.0

Compare pasting, bagging, random subspaces, and random patches through their sampling choices and BaggingClassifier or BaggingRegressor parameters. section 5.1.1

A bagged tree classifier

A practical implementation uses scikit-learn's BaggingClassifier with a DecisionTreeClassifier, 300 estimators, bootstrap sampling, and five-fold shuffled cross-validation. The reported result is 0.809 accuracy, with fit and prediction timings included, making both predictive performance and operating cost visible. section 5.1.1

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Explains averaging, voting, sampling variants, variance-bias trade-offs, and computational cost without deriving ensemble internals.
Examples
Uses pasting, bagging, random subspaces, random patches, and a scikit-learn bagged tree classifier with reported accuracy.
What it assumes
Builds on single learning algorithms, especially decision trees, before combining multiple models.
What you can do after
Apply it via BaggingClassifier or BaggingRegressor and evaluate accuracy, variance reduction, bias, and computational cost.
How it connects
Connects averaging with decision trees, bagging, pasting, random subspaces, random patches, random forests, and boosting.

Also explained in

Compare how 2 books explain prediction averaging →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.