grid_search: Perform grid search over a grid of parameters.

Description Usage Arguments Details Value

View source: R/grid_search.R

Description

Perform grid search over a grid of parameters.

Usage

1
2
grid_search(resamples, recipe, param_grid, scoring_func, ...,
  verbosity = TRUE, accept_func = NULL)

Arguments

resamples

A data.frame with columns 'splits' and 'id', created using the 'rsample' package.

recipe

The recipe to use. See package 'recipes'.

param_grid

Data frame of parameters combinations (e.g. generated by expand.grid).

scoring_func

Your custom train/predict/score function. Must take as parameters:

  • a training dataframe

  • the name of the target variable in the training dataframe

  • a list of parameters (these are the hyperparameters we are tuning)

  • an evaluation dataframe

  • dots. These are additional non-tunable parameters that could be passed to the function.

...

Optional params passed to scoring_func.

verbosity

Level of verbosity. Integer or TRUE/FALSE for max/min verbosity.

Details

'scoring_func' can return a single score as a numeric vector, or multiple scores in a data.frame.

Value

A tidy data.frame, with one column per parameter, columns to identify the paramset and the fold, a column giving the row indices of the evaluation dataset, and columns for the performance scores (these are taken from the scoring function if it returned a data.frame, otherwise it will just be a _score_ column).


artichaud1/cook documentation built on July 17, 2018, 2:11 a.m.