stacks 0.1.0

  tidymodels, stacks

  Simon Couch and Max Kuhn

A few months ago, the tidymodels team coordinated a community survey to get a sense for what users most wanted to see next in the tidymodels package ecosystem. One resounding theme from responses was that tidymodels users wanted a framework for tidymodels-aligned model stacking.

We’re excited to announce the release of stacks 0.1.0, a package for model stacking that aligns with existing functionality in the tidymodels package ecosystem! Model stacking is an ensembling technique that combines the outputs of many models to generate a new model—referred to as an ensemble in this package—that generates predictions informed by each of its members.

You can install it from CRAN with:


To load the package:


A Brief Overview

The process of a building a model stack goes something like this:

  1. Define candidate ensemble members using functionality from rsample, parsnip, workflows, recipes, and tune
  2. Initialize a data_stack object with stacks()
  3. Iteratively add candidate ensemble members to the data_stack with add_candidates()
  4. Evaluate how to combine their predictions with blend_predictions()
  5. Fit candidate ensemble members with non-zero stacking coefficients with fit_members()
  6. Predict on new data with predict()

For an example of using stacks to build a stacked ensemble model, see the package vignette.


Thank you to Julie Jung for contributing the package’s hex sticker as well as research data used in examples throughout the package. Read more about the example data here.

This release was made possible in part by the RStudio internship program, which allowed me ( Simon Couch) to work on developing stacks full-time throughout July. I’m also grateful for support from Dr.┬áKelly McConville as well as the Reed College Mathematics Department, where this package will partially fulfill my undergraduate senior thesis requirement.

Also, we thank those who have tested and provided feedback on the developmental versions of the package over the last few months.