Learn R Programming

MachineShop (version 3.3.0)

ModelSpecification: Model Specification

Description

Specification of a relationship between response and predictor variables and a model to define a relationship between them.

Usage

ModelSpecification(...)

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

# S3 method for formula ModelSpecification(formula, data, model, ...)

# S3 method for matrix ModelSpecification(x, y, model, ...)

# S3 method for ModelFrame ModelSpecification(input, model = NULL, ...)

# S3 method for recipe ModelSpecification(input, model = NULL, ...)

Arguments

...

arguments passed from the generic function to its methods. The first argument of each ModelSpecification method is positional and, as such, must be given first in calls to them.

input

input object defining and containing the model predictor and response variables.

model

model function, function name, or object; or another object that can be coerced to a model. The argument can be omitted altogether in the case of modeled inputs.

control

control function, function name, or object defining the resampling method to be employed. Specification of a resampling method results in the following characteristics.

  1. Tuning of input and model objects is performed simultaneously over a global grid of their parameter values.

  2. The specification's control method and training parameters below override those of any included TunedInput or TunedModel.

  3. ModeledInput, SelectedInput, and SelectedModel objects are not allowed in the input or model arguments.

Alternatively, a value of NULL may be specified so that any package input or model object is allowed, object-specific control structures and training parameters are used for selection and tuning, and objects are trained sequentially with nested resampling rather than simultaneously with a global grid.

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. Model 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 model tuning.

formula, data

formula defining the model predictor and response variables and a data frame containing them.

x, y

matrix and object containing predictor and response variables.

Value

ModelSpecification class object.

See Also

fit, resample, set_monitor, set_optim

Examples

Run this code
# NOT RUN {
## Requires prior installation of suggested package gbm to run

modelspec <- ModelSpecification(
  sale_amount ~ ., data = ICHomes, model = GBMModel
)
fit(modelspec)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab