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 ininterpret()
.- params_inter
An integer for the maximum number of sample points to model interaction effects. i.e.,
k
for interactions ininterpret()
.- penalty
A non-negative number representing the total amount of regularization. i.e.,
lambda
ininterpret()
.- custom_formula
A formula object. If passed,
fit()
internally usesinterpret.formula()
with the specified formula, otherwise it usesinterpret.default()
. i.e., `formula` ininterpret.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()
.
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.