meta_mod: Meta Models for Regression (Model Stacking)

View source: R/meta_mod.R

meta_modR Documentation

Meta Models for Regression (Model Stacking)

Description

Train a meta model from the output of base learners trained using different learners (algorithms)

Usage

meta_mod(
  x,
  y = NULL,
  x.test = NULL,
  y.test = NULL,
  base.mods = c("mars", "ranger"),
  base.params = vector("list", length(base.mods)),
  base.resample.params = setup.resample(resampler = "kfold", n.resamples = 4),
  meta.mod = "gam",
  meta.params = list(),
  x.name = NULL,
  y.name = NULL,
  save.base.res = TRUE,
  save.base.full = FALSE,
  col = NULL,
  se.lty = 3,
  print.base.plot = FALSE,
  print.plot = TRUE,
  plot.fitted = NULL,
  plot.predicted = NULL,
  plot.theme = rtTheme,
  question = NULL,
  verbose.base.res.mods = FALSE,
  verbose.base.mods = FALSE,
  verbose = TRUE,
  trace = 0,
  base.n.cores = 1,
  n.cores = rtCores,
  save.mod = FALSE,
  outdir = NULL,
  ...
)

Arguments

x

Numeric vector or matrix of features, i.e. independent variables

y

Numeric vector of outcome, i.e. dependent variable

x.test

(Optional) Numeric vector or matrix of validation set features must have set of columns as x

y.test

(Optional) Numeric vector of validation set outcomes

base.mods

Character vector: Two or more base learners. Options: select_learn

base.params

List of length equal to N of base.mods. Each element should be a list of arguments to pass to the corresponding base mod

meta.mod

String. Meta learner. Options: select_learn

x.name

Character: Name for predictor set. (What kind of data is it?)

y.name

Character: Name for outcome

se.lty

How to plot standard errors. If a number, it corresponds to par("lty") line types and is plotted with lines(). If "solid", a transparent polygon is plotted using polygon()

resampler

String. Resampling method to use. Options: "bootstrap", "kfold", "strat.boot", "strat.sub"

Details

This is included mainly for educational purposes.

  • Train a set of base learners on resamples of the training set x

  • Train a meta learner to map bases' validation set predictions to outcomes

  • Train base learners on full training set x

  • Use the meta learner to predict test set outcome y.test from testing set (x.test)

Author(s)

E.D. Gennatas


egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.