>>> from mlpack import adaboost

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.

This program allows training of an AdaBoost model, and then application of that model to a test dataset. To train a model, a dataset must be passed with the 'training' option. Labels can be given with the 'labels' option; if no labels are specified, the labels will be assumed to be the last column of the input dataset. Alternately, an AdaBoost model may be loaded with the 'input_model' option.

Once a model is trained or loaded, it may be used to provide class predictions for a given test dataset. A test dataset may be specified with the 'test' parameter. The predicted classes for each point in the test dataset are output to the 'output' output parameter. The AdaBoost model itself is output to the 'output_model'output parameter.

For example, to run AdaBoost on an input dataset 'data' with perceptrons as the weak learner type, storing the trained model in 'model', one could use the following command:

>>> adaboost(training=data, weak_learner='perceptron')
>>> model = output['output']

Similarly, an already-trained model in 'model' can be used to provide class predictions from test data 'test_data' and store the output in 'predictions' with the following command:

>>> adaboost(input_model=model, test=test_data)
>>> predictions = output['output']

input options

output options

The return value from the binding is a dict containing the following elements: