Learn R Programming

intubate (version 1.0.0)

adabag: Interfaces for adabag package for data science pipelines.

Description

Interfaces to adabag functions that can be used in a pipeline implemented by magrittr.

Usage

ntbt_autoprune(data, ...) # ntbt_bagging(data, ...) ## Already defined in ipred ntbt_bagging.cv(data, ...) ntbt_boosting(data, ...) ntbt_boosting.cv(data, ...)

Arguments

data
data frame, tibble, list, ...
...
Other arguments passed to the corresponding interfaced function.

Value

Object returned by interfaced function.

Details

Interfaces call their corresponding interfaced function.

Examples

Run this code
## Not run: 
# library(intubate)
# library(magrittr)
# library(adabag)
# 
# 
# ## ntbt_autoprune: Builds automatically a pruned tree of class rpart
# ## Original function to interface
# autoprune(Species ~ ., data = iris)
# 
# ## The interface puts data as first parameter
# ntbt_autoprune(iris, Species ~ .)
# 
# ## so it can be used easily in a pipeline.
# iris %>%
#   ntbt_autoprune(Species ~ .)
# 
# ## ntbt_bagging: Applies the Bagging algorithm to a data set
# library(rpart)
# data(iris)
# 
# ## Original function to interface
# bagging(Species ~ ., data = iris, mfinal = 10)
# 
# ## The interface puts data as first parameter
# ntbt_bagging(iris, Species ~ ., mfinal = 10)
# 
# ## so it can be used easily in a pipeline.
# iris %>%
#   ntbt_bagging(Species ~ ., mfinal = 10)
# 
# 
# 
# ## Original function to interface
# iris.baggingcv <- bagging.cv(Species ~ ., v = 2, data = iris, mfinal = 10,
#                              control = rpart.control(cp = 0.01))
# iris.baggingcv[-1]
# 
# ## The interface puts data as first parameter
# iris.baggingcv <- ntbt_bagging.cv(iris, Species ~ ., v = 2, mfinal = 10,
#                                   control = rpart.control(cp = 0.01))
# iris.baggingcv[-1]
# 
# ## so it can be used easily in a pipeline.
# iris.baggingcv <- iris %>%
#   ntbt_bagging.cv(Species ~ ., v = 2, mfinal = 10,
#                   control = rpart.control(cp = 0.01))
# iris.baggingcv[-1]
# 
# 
# ## ntbt_boosting: Applies the AdaBoost.M1 and SAMME algorithms to a data set
# ## Original function to interface
# boosting(Species ~ ., data = iris, boos = TRUE, mfinal = 5)
# 
# ## The interface puts data as first parameter
# ntbt_boosting(iris, Species ~ ., boos = TRUE, mfinal = 5)
# 
# ## so it can be used easily in a pipeline.
# iris %>%
#   ntbt_boosting(Species ~ ., boos = TRUE, mfinal = 5)
# 
# 
# ## ntbt_boosting.cv: Runs v-fold cross validation with AdaBoost.M1 or SAMME
# ## Original function to interface
# iris.boostcv <- boosting.cv(Species ~ ., v = 2, data = iris, mfinal = 10, 
#                             control = rpart.control(cp = 0.01))
# iris.boostcv[-1]
# 
# ## The interface puts data as first parameter
# iris.boostcv <- ntbt_boosting.cv(iris, Species ~ ., v = 2, mfinal = 10, 
#                                  control = rpart.control(cp = 0.01))
# iris.boostcv[-1]
# 
# ## so it can be used easily in a pipeline.
# iris.boostcv <- iris %>%
#   ntbt_boosting.cv(Species ~ ., v = 2, mfinal = 10, 
#                    control = rpart.control(cp = 0.01))
# iris.boostcv[-1]
# ## End(Not run)

Run the code above in your browser using DataLab