Learn R Programming

autostats (version 0.4.1)

tidy_predict: tidy predict

Description

tidy predict

Usage

tidy_predict(
  model,
  newdata,
  form = NULL,
  olddata = NULL,
  bind_preds = FALSE,
  ...
)

# S3 method for Rcpp_ENSEMBLE tidy_predict(model, newdata, form = NULL, ...)

# S3 method for glm tidy_predict(model, newdata, form = NULL, ...)

# S3 method for default tidy_predict(model, newdata, form = NULL, ...)

# S3 method for BinaryTree tidy_predict(model, newdata, form = NULL, ...)

# S3 method for xgb.Booster tidy_predict( model, newdata, form = NULL, olddata = NULL, bind_preds = FALSE, ... )

# S3 method for lgb.Booster tidy_predict( model, newdata, form = NULL, olddata = NULL, bind_preds = FALSE, ... )

Value

dataframe

Arguments

model

model

newdata

dataframe

form

the formula used for the model

olddata

training data set

bind_preds

set to TURE if newdata is a dataset without any labels, to bind the new and old data with the predictions under the original target name

...

other parameters to pass to predict

Examples

Run this code
iris %>%
 framecleaner::create_dummies(Species) -> iris_dummy

iris_dummy %>%
 tidy_formula(target= Petal.Length) -> petal_form

iris_dummy %>%
 tidy_xgboost(
   petal_form,
   trees = 20,
   mtry = .5
 )  -> xg1


xg1 %>%
 tidy_predict(newdata = iris_dummy, form = petal_form) %>%
 head()

Run the code above in your browser using DataLab