bagging function

bagging method

bagging method

bagging(form, data, ntrees, pruning, dselection, pruning_cp)

Arguments

  • form: formula

  • data: training data

  • ntrees: ntrees

  • pruning: model pruning method. A character vector. Currently, the following methods are supported:

    • mdsq: Margin-distance minimisation
    • bb: boosting based pruning
    • none: no pruning
  • dselection: dynamic selection of the available models. Currently, the following methods are supported:

    • ola: Overall Local Accuracy
    • knora-e: K-nearest-oracles-eliminate
    • none: no dynamic selection. Majority voting is used.
  • pruning_cp: The pruning cutpoint for the pruning method picked.

Examples

# splitting an example dataset into train/test: train <- iris[1:(.7*nrow(iris)), ] test <- iris[-c(1:(.7*nrow(iris))), ] form <- Species ~. # a user-defined bagging workflow m <- bagging(form, iris, ntrees = 5, pruning = "bb", pruning_cp = .5, dselection = "ola") preds <- predict(m, test) # a standard bagging workflow with 5 trees (5 trees for examplification purposes): m2 <- bagging(form, iris, ntrees = 5, pruning = "none", dselection = "none") preds2 <- predict(m2, test)

See Also

baggedtrees for the implementation of the bagging model.

  • Maintainer: Vitor Cerqueira
  • License: GPL (>= 2)
  • Last published: 2017-07-02

Useful links