liveBook · Manning

Ensemble

As explained in Deep Learning with R, Third Edition

A model ensemble is a collection of predictive models whose outputs are combined to produce a joint prediction.

An ensemble combines predictions from several independently trained models to produce a joint prediction. Different models may capture different aspects of the data, so pooling their perspectives can improve accuracy beyond a single model. section 18.1.2

Averaging classifier predictions

For four similarly capable classifiers, predict the validation inputs with each model and average their outputs: final_preds = 0.25 * (preds_a + preds_b + preds_c + preds_d). If the models differ substantially in quality, use learned validation weights instead, such as 0.5, 0.25, 0.1, and 0.15. section 18.1.2

Use ensembles with these practical considerations:

  • Prefer diverse, well-performing models: each may make useful predictions for different reasons. section 18.1.2
  • Average predictions when the component classifiers are more or less equally good. section 18.1.2
  • Learn validation-data weights when some models are significantly better or worse than others. section 18.1.2
preds_a  <- model_a |> predict(x_val)  #1
preds_b  <- model_b |> predict(x_val) 
preds_c  <- model_c |> predict(x_val) 
preds_d  <- model_d |> predict(x_val)
final_preds <- 0.25 * (preds_a + preds_b + preds_c + preds_d)  #2

Inspect a compact R example that obtains predictions from four models and averages them into final predictions. section 18.1.2

preds_a  <- model_a |> predict(x_val)
preds_b  <- model_b |> predict(x_val)
preds_c  <- model_c |> predict(x_val)
preds_d  <- model_d |> predict(x_val)
final_preds <- .5*preds_a + .25*preds_b + .1*preds_c + .15*preds_d  #1

Compare equal averaging with a weighted combination that gives stronger models more influence. section 18.1.2

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains model diversity, equal averaging, and validation-weighted averaging, but does not derive ensemble theory mathematically.
Examples
Uses the blind-men-and-elephant analogy, four classifier predictions, equal averaging, and validation-weighted averaging.
What it assumes
Assumes trained predictive models, inference-time predictions, classifiers, and validation data while explaining ensemble motivation through analogy.
What you can do after
Apply prediction averaging or validation-weighted averaging to combine several trained models into a stronger prediction.
How it connects
Connects model ensembling with classification, validation data, hyperparameter tuning, validation-set overfitting, and Kaggle competitions.

Also explained in

Compare how 11 books explain ensemble →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.