Learn R Programming

MachineShop (version 2.0.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

defines a relationship between model predictor and response variables. May be a formula, design matrix of predictors, ModelFrame, SelectedModelFrame, untrained recipe, SelectedRecipe, or TunedRecipe object. Alternatively, a model function or call may be given first followed by objects defining the predictor and response relationship.

...

arguments passed to other methods.

data

data frame containing observed predictors and outcomes.

model

model function, function name, or call.

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 {
## Survival response example
library(survival)
library(MASS)

gbm_fit <- fit(Surv(time, status != 2) ~ sex + age + year + thickness + ulcer,
               data = Melanoma, model = GBMModel)
varimp(gbm_fit)

# }

Run the code above in your browser using DataLab