estimate_model: Estimate machine learning model

Description Usage Arguments Value Examples

View source: R/api.R

Description

A function that takes as its arguement another function defining how a machine learning model should be estimated based on the variables available in the input data frame. This function is wrapped (or adapted) for use within a machine learning pipeline.

Usage

1

Arguments

.f

A unary function of a data.frame that returns a fitted model object, which must have a predict.{model-class} defined and available in the enclosing environment. An error will be thrown if any of these criteria are not met.

Value

A unary function of a data.frame that returns a fitted model object that has a predict.{model-class} defined This function is assigned the classes "estimate_model" and "ml_pipeline_section".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data <- head(faithful)
f <- estimate_model(function(df) {
  lm(eruptions ~ 1 + waiting, df)
})

f(data)
# Call:
#   lm(formula = eruptions ~ 1 + waiting, data = df)
#
# Coefficients:
# (Intercept)      waiting
#    -1.53317      0.06756

pipeliner documentation built on May 1, 2019, 6:49 p.m.