tidy predict
tidy_predict(
model,
newdata,
form = NULL,
olddata = NULL,
bind_preds = FALSE,
...
)
# S3 method for class 'Rcpp_ENSEMBLE'
tidy_predict(model, newdata, form = NULL, ...)
# S3 method for class 'glm'
tidy_predict(model, newdata, form = NULL, ...)
# Default S3 method
tidy_predict(model, newdata, form = NULL, ...)
# S3 method for class 'BinaryTree'
tidy_predict(model, newdata, form = NULL, ...)
# S3 method for class 'xgb.Booster'
tidy_predict(
model,
newdata,
form = NULL,
olddata = NULL,
bind_preds = FALSE,
...
)
# S3 method for class 'lgb.Booster'
tidy_predict(
model,
newdata,
form = NULL,
olddata = NULL,
bind_preds = FALSE,
...
)dataframe
iris %>%
framecleaner::create_dummies(Species) -> iris_dummy
#> 1 column(s) have become 3 dummy columns
iris_dummy %>%
tidy_formula(target= Petal.Length) -> petal_form
iris_dummy %>%
tidy_xgboost(
petal_form,
trees = 20,
mtry = .5
) -> xg1
#> accuracy tested on a validation set
#> # A tibble: 3 × 2
#> .metric .estimate
#> <chr> <dbl>
#> 1 ccc 0.855
#> 2 rmse 0.758
#> 3 rsq 0.947
xg1 %>%
tidy_predict(newdata = iris_dummy, form = petal_form) %>%
head()
#> created the following column: Petal.Length_preds_Table
#> Sepal.Length Sepal.Width Petal.Length Petal.Width species_setosa
#> 1 5.1 3.5 1.4 0.2 1
#> 2 4.9 3.0 1.4 0.2 1
#> 3 4.7 3.2 1.3 0.2 1
#> 4 4.6 3.1 1.5 0.2 1
#> 5 5.0 3.6 1.4 0.2 1
#> 6 5.4 3.9 1.7 0.4 1
#> species_versicolor species_virginica Petal.Length_preds_Table
#> 1 0 0 2.295974
#> 2 0 0 2.295974
#> 3 0 0 2.295974
#> 4 0 0 2.295974
#> 5 0 0 2.295974
#> 6 0 0 2.295974