expand_modelgrid-methods: Model Tuning Grid Expansion

Description Usage Arguments Details Value See Also Examples

Description

Expand a model grid of tuning parameter values.

Usage

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

## S3 method for class 'formula'
expand_modelgrid(x, data, model, info = FALSE, ...)

## S3 method for class 'matrix'
expand_modelgrid(x, y, model, info = FALSE, ...)

## S3 method for class 'ModelFrame'
expand_modelgrid(x, model, info = FALSE, ...)

## S3 method for class 'recipe'
expand_modelgrid(x, model, info = FALSE, ...)

## S3 method for class 'TunedModel'
expand_modelgrid(x, ..., info = FALSE)

Arguments

x

input specifying a relationship between model predictor and response variables. Alternatively, a TunedModel object may be given first followed optionally by an input specification.

...

arguments passed to other methods.

data

data frame containing observed predictors and outcomes.

model

TunedModel object.

info

logical indicating whether to return model-defined grid construction information rather than the grid values.

y

response variable.

Details

The expand_modelgrid function enables manual extraction and viewing of grids created automatically when a TunedModel is fit.

Value

A data frame of parameter values or NULL if data are required for construction of the grid but not supplied.

See Also

TunedModel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
expand_modelgrid(TunedModel(GBMModel, grid = 5))

expand_modelgrid(TunedModel(GLMNetModel, grid = c(alpha = 5, lambda = 10)),
                 sale_amount ~ ., data = ICHomes)

gbm_grid <- ParameterGrid(
  n.trees = dials::trees(),
  interaction.depth = dials::tree_depth(),
  size = 5
)
expand_modelgrid(TunedModel(GBMModel, grid = gbm_grid))

rf_grid <- ParameterGrid(
  mtry = dials::mtry(),
  nodesize = dials::max_nodes(),
  size = c(3, 5)
)
expand_modelgrid(TunedModel(RandomForestModel, grid = rf_grid),
                 sale_amount ~ ., data = ICHomes)

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