AdaBoostClassifier<T>

Models & Types · AiDotNet.Classification.Ensemble

AdaBoost (Adaptive Boosting) classifier that combines weak learners.

Inheritance: ClassifierBase<T> → ProbabilisticClassifierBase<T> → EnsembleClassifierBase<T> → AdaBoostClassifier<T>

For Beginners

AdaBoost works like a learning system that focuses on its mistakes:

  1. Train a simple classifier on the data
  2. See which samples were misclassified
  3. Give those samples higher importance
  4. Train another classifier with the new importance weights
  5. Repeat many times
  6. Combine all classifiers with voting

This creates a powerful classifier from many weak ones.

How It Works

AdaBoost iteratively trains weak classifiers on re-weighted versions of the data, where incorrectly classified samples receive higher weights in subsequent iterations. The final prediction is a weighted vote of all weak learners.

Example

// Create AdaBoost classifier that combines weak learners
var options = new AdaBoostClassifierOptions<double>();
            
// Prepare training data
var features = new Matrix<double>(new double[,] { { 1.0, 1.1 }, { 1.2, 0.9 }, { 0.8, 1.0 }, { 5.0, 5.1 }, { 5.2, 4.9 }, { 4.8, 5.0 } });
var labels = new Vector<double>(new double[] { 0, 0, 0, 1, 1, 1 });
            
// Train by iteratively re-weighting misclassified samples
var result = new AiModelBuilder<double, Matrix<double>, Vector<double>>()
    .ConfigureModel(new AdaBoostClassifier<double>(options))
    .Build(features, labels);
            
// Predict using weighted vote of all weak learners
var newSample = new Matrix<double>(new double[,] { { 1.1, 1.0 } });
var prediction = result.Predict(newSample);
// Result is available in the returned value

Constructors

Constructor Summary
AdaBoostClassifier(AdaBoostClassifierOptions<T> options, IRegularization<T, Matrix<T>, Vector<T>> regularization) Initializes a new instance of the AdaBoostClassifier class.

Methods

Method Summary
Matrix<T> PredictProbabilities(Matrix<T> input)
ModelMetadata<T> GetModelMetadata()
Vector<T> Predict(Matrix<T> input)
void Train(Matrix<T> x, Vector<T> y) Returns the model type identifier for this classifier.