predict.ml_pipeline: Predict method for ML pipelines

Description Usage Arguments Value Examples

View source: R/api.R

Description

Predict method for ML pipelines

Usage

1
2
3
## S3 method for class 'ml_pipeline'
predict(object, data, verbose = FALSE,
  pred_var = "pred_model", ...)

Arguments

object

An estimated pipleine object of class ml_pipeline.

data

A data.frame in which to look for input variables with which to predict.

verbose

Boolean - whether or not to return data.frame with all input and interim variables as well as predictions.

pred_var

Name to assign to for column of predictions from the 'raw' (or inner) model in the pipeline.

...

Any additional arguements than need to be passed to the underlying model's predict methods.

Value

A vector of model predictions or scores (default); or, a data.frame containing the predicted values, input variables, as well as any interim tranformed variables.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data <- faithful

lm_pipeline <-
  pipeline(
    data,
    estimate_model(function(df) {
      lm(eruptions ~ 1 + waiting, df)
    })
  )

in_sample_predictions <- predict(lm_pipeline, data)
head(in_sample_predictions)
# [1] 4.100592 2.209893 3.722452 2.814917 4.554360 2.285521

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