model_trainer: Wrapper function for model inputs to 'find_model'

Description Usage Arguments Value Examples

View source: R/model_finder.R

Description

Wrapper function for model inputs to find_model

Usage

1
model_trainer(.train, .predict, ...)

Arguments

.train

The training function. This function has to take a data argument that stores the training data and a ... argument for the parameters.

.predict

The prediction function. This function needs to take two arguments, where the first is the model and the second the new dataset.

...

Other parameters to be passed to the training function.

Value

A list for use as a model input with find_model

Examples

1
2
3
4
5
6
d <- data.frame(x = 1:10, y = 1:10 + rnorm(10, sd = .3))
model_trainer(
    .train = function(data, ...) lm(data = data, formula = y ~ ., ...),
    .predict = function(x,y) predict.lm(x,y),
    x = FALSE
)

jeroenvdhoven/datapiper documentation built on July 14, 2019, 9:34 p.m.