Skip to contents

mid_reg() defines a model that can predict numeric values from predictors using a set of functions each with up to two predictors. This function can fit regression models.

Usage

mid_reg(
  mode = "regression",
  engine = "midr",
  params_main = NULL,
  params_inter = NULL,
  penalty = NULL,
  custom_formula = NULL
)

fit_mid_reg(
  x,
  y,
  weights = NULL,
  params_main = NA,
  params_inter = NA,
  penalty = 0,
  custom_formula = NULL,
  ...
)

Arguments

mode

A single character string for the type of model.

params_main

An integer for the maximum number of sample points to model main effects. i.e., k for main effects in interpret().

params_inter

An integer for the maximum number of sample points to model interaction effects. i.e., k for interactions in interpret().

penalty

A non-negative number representing the total amount of regularization. i.e., lambda in interpret().

custom_formula

A formula object. If passed, fit() internally uses interpret.formula() with the specified formula, otherwise it uses interpret.default(). i.e., `formula` in interpret.formula().

x

a data frame or matrix of predictor variables.

y

a vector of target variable.

weights

an optional vector of case weights.

...

other arguments passed to midr::interpret().

Value

a mid_reg model specification.

Details

This function is the main specification for the parsnip model. The underlying fitting is performed by fit_mid_reg(), which is a helper function that connects fit() to the midr::interpret() function.

See also