MachineShop (version 2.8.0)

fit: Model Fitting

Description

Fit a model to estimate its parameters from a data set.

Usage

fit(x, ...)

# S3 method for formula fit(x, data, model, ...)

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

# S3 method for ModelFrame fit(x, model, ...)

# S3 method for recipe fit(x, model, ...)

# S3 method for MLModel fit(x, ...)

# S3 method for MLModelFunction fit(x, ...)

Arguments

x

input specifying a relationship between model predictor and response variables. Alternatively, a model function or call may be given first followed by the input specification.

...

arguments passed to other methods.

data

data frame containing observed predictors and outcomes.

model

model function, function name, or call; ignored and can be omitted when fitting modeled inputs.

y

response variable.

Value

MLModelFit class object.

Details

User-specified case weights may be specified for ModelFrames upon creation with the weights argument in its constructor.

Variables in recipe specifications may be designated as case weights with the role_case function.

See Also

as.MLModel, response, predict, varimp

Examples

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

## Survival response example
library(survival)

gbm_fit <- fit(Surv(time, status) ~ ., data = veteran, model = GBMModel)
varimp(gbm_fit)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab