fit-methods: Model Fitting

Description Usage Arguments Details Value See Also Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
fit(x, ...)

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

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

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

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

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

## S3 method for class '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.

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.

Value

MLModelFit class object.

See Also

as.MLModel, response, predict, varimp

Examples

1
2
3
4
5
6
7
## 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)

MachineShop documentation built on June 18, 2021, 9:06 a.m.