MachineShop (version 3.7.0)

SelectedInput: Selected Model Inputs

Description

Formula, design matrix, model frame, or recipe selection from a candidate set.

Usage

SelectedInput(...)

# S3 method for formula SelectedInput( ..., data, control = MachineShop::settings("control"), metrics = NULL, cutoff = MachineShop::settings("cutoff"), stat = MachineShop::settings("stat.TrainingParams") )

# S3 method for matrix SelectedInput( ..., y, control = MachineShop::settings("control"), metrics = NULL, cutoff = MachineShop::settings("cutoff"), stat = MachineShop::settings("stat.TrainingParams") )

# S3 method for ModelFrame SelectedInput( ..., control = MachineShop::settings("control"), metrics = NULL, cutoff = MachineShop::settings("cutoff"), stat = MachineShop::settings("stat.TrainingParams") )

# S3 method for recipe SelectedInput( ..., control = MachineShop::settings("control"), metrics = NULL, cutoff = MachineShop::settings("cutoff"), stat = MachineShop::settings("stat.TrainingParams") )

# S3 method for ModelSpecification SelectedInput( ..., control = MachineShop::settings("control"), metrics = NULL, cutoff = MachineShop::settings("cutoff"), stat = MachineShop::settings("stat.TrainingParams") )

# S3 method for list SelectedInput(x, ...)

Value

SelectedModelFrame, SelectedModelRecipe, or SelectedModelSpecification class object that inherits from SelectedInput and ModelFrame, recipe, or ModelSpecification, respectively.

Arguments

...

inputs defining relationships between model predictor and response variables. Supplied inputs must all be of the same type and may be named or unnamed.

data

data frame containing predictor and response variables.

control

control function, function name, or object defining the resampling method to be employed.

metrics

metric function, function name, or vector of these with which to calculate performance. If not specified, default metrics defined in the performance functions are used. Recipe selection is based on the first calculated metric.

cutoff

argument passed to the metrics functions.

stat

function or character string naming a function to compute a summary statistic on resampled metric values for recipe selection.

y

response variable.

x

list of inputs followed by arguments passed to their method function.

See Also

fit, resample

Examples

Run this code
## Selected model frame
sel_mf <- SelectedInput(
  sale_amount ~ sale_year + built + style + construction,
  sale_amount ~ sale_year + base_size + bedrooms + basement,
  data = ICHomes
)

fit(sel_mf, model = GLMModel)

## Selected recipe
library(recipes)
data(Boston, package = "MASS")

rec1 <- recipe(medv ~ crim + zn + indus + chas + nox + rm, data = Boston)
rec2 <- recipe(medv ~ chas + nox + rm + age + dis + rad + tax, data = Boston)
sel_rec <- SelectedInput(rec1, rec2)

fit(sel_rec, model = GLMModel)

Run the code above in your browser using DataLab