View source: R/adaboost_train.R
| adaboost_train | R Documentation |
Training AdaBoost model.
adaboost_train(
training,
iterations = 1000,
labels = NA,
tolerance = 1e-10,
verbose = getOption("mlpack.verbose", FALSE),
weak_learner = "decision_stump"
)
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). |
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.
A list with several components defining the class attributes:
output_model |
Output trained AdaBoost model (AdaBoostModel). |
mlpack developers
#
# \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)
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.