Learn R Programming

mlpack (version 4.8.0)

adaboost_train: AdaBoost

Description

Training AdaBoost model.

Usage

adaboost_train(
  training,
  iterations = 1000,
  labels = NA,
  tolerance = 1e-10,
  verbose = getOption("mlpack.verbose", FALSE),
  weak_learner = "decision_stump"
)

Value

A list with several components defining the class attributes:

output_model

Output trained AdaBoost model (AdaBoostModel).

Arguments

training

Dataset for training AdaBoost (numeric matrix).

iterations

The maximum number of boosting iterations to be run (0 will run until convergence.. Default value "1000" (integer).

labels

Labels for the training set (integer row).

tolerance

The tolerance for change in values of the weighted error during training. Default value "1e-10" (numeric).

verbose

Display informational messages and the full list of parameters and timers at the end of execution. Default value "getOption("mlpack.verbose", FALSE)" (logical).

weak_learner

The type of weak learner to use: 'decision_stump', or 'perceptron'. Default value "decision_stump" (character).

Author

mlpack developers

Details

This program implements the AdaBoost (or Adaptive Boosting) algorithm. The variant of AdaBoost implemented here is AdaBoost.MH. It uses a weak learner, either decision stumps or perceptrons, and over many iterations, creates a strong learner that is a weighted ensemble of weak learners. It runs these iterations until a tolerance value is crossed for change in the value of the weighted training error.

For more information about the algorithm, see the paper "Improved Boosting Algorithms Using Confidence-Rated Predictions", by R.E. Schapire and Y. Singer.

Examples

Run this code
# 
# \dontrun{
# suppressMessages(library(mlpack)) # in case 'mlpack' is not yet loaded
# X <- as.matrix(read.csv("http://datasets.mlpack.org/iris.csv",
# header=FALSE))
# y <- as.matrix(read.csv("http://datasets.mlpack.org/iris_labels.csv",
# header=FALSE))
# pp <- preprocess_split(input=X, input_label=as.matrix(1:nrow(X)),
# test_ratio=0.2)
# X_train <- pp[["training"]]
# X_test <- pp[["test"]]
# # labels are indices to operate on both factors or numeric data
# y_train <- y[as.integer(pp[["training_labels"]]), 1]
# y_test <- y[as.integer(pp[["test_labels"]]), 1]
# 
# model <- adaboost_train(training=X_train, labels=y_train)
# }

Run the code above in your browser using DataLab