Model stacking is an ensemble technique where a meta-learner is trained to combine the predictions of multiple constituent models (called "members").
In {stacks}, the process follows a specific lifecycle:
- Model Definitions: You create instructions using
{parsnip}, {recipes}, and {workflows}. Each instruction is a candidate member. - Data Stack Initialization: You initialize a
data_stack object using stacks(). - Candidate Collation: You add model definitions to the stack using
add_candidates(). This function uses a shared resampling object (from {rsample}) to collect predictions from each candidate on an assessment set. - Meta-learner Fitting: You use
blend_predictions() to fit an elastic net model on the data stack. This determines the stacking coefficients (weights) for each candidate. - Member Fitting: Candidates with non-zero coefficients are identified as members. You use
fit_members() to fit these members on the entire training set, resulting in a model_stack object ready for prediction.