Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Boosting Ensemble Method 
Learning an AdaBoost Model from Data
An Example of How AdaBoost Works
The Mathematics Behind AdaBoost
Data Preparation for AdaBoost
Last Updated: Mar 27, 2024

Boosting with AdaBoost

0 upvote
Create a resume that lands you SDE interviews at MAANG
Anubhav Sinha
SDE-2 @
12 Jun, 2024 @ 01:30 PM


Boosting with AdaBoost is a short form for “Adaptive Boosting” which is the first practical boosting algorithm proposed by Freund and Schapire in 1996.

It focuses on classification problems and aims to convert a group of weak classifiers into a robust one. The ultimate equation for classification are often represented as below:

where f_m stands for the maths weak classifier and theta_m is that the corresponding weight. it’s precisely the weighted combination of M weak classifiers. the entire procedure of the AdaBoost algorithm are often summarised as follow.

Boosting Ensemble Method

Boosting may be a general ensemble method that makes a robust classifier from a variety of weak classifiers. This is done by building a model from the training data, then creating a second model that attempts to correct the errors from the primary model. In this the models are added to the data set till the training set is predicted perfectly.

AdaBoost was the primary really successful boosting algorithm developed for binary classification. it’s the simplest start line for understanding boosting.

Learning an AdaBoost Model from Data

AdaBoost is best wont to boost the performance of decision trees on binary classification problems. M1 is done by the authors of the technique & Innovation by Freund and Schapire. More recently it’s going to be mentioned as discrete AdaBoost because it’s used for classification instead of regression.

AdaBoost is often wont to boost the performance of any machine learning algorithm. it’s best used with weak learners. These are models that achieve accuracy just above random fall upon a classification problem.

The most suited and thus commonest algorithm used with AdaBoost is decision trees with one level. Because these trees are so short and only contain one decision for classification, they’re often called decision stumps.

Each instance within the training dataset is weighted. The initial weight is about to:
weight(xi) = 1/n


Where xi is that the i’th training instance and n is that the number of coaching instances.

Yoav Freund and Robert Schapire, who won the 2003 Gödel Prize for his or her work. It is often utilised in conjunction with many other sorts of learning algorithms to enhance performance. The output of the opposite learning algorithms (‘weak learners’) is combined into a weighted sum that represents the ultimate output of the boosted classifier.

AdaBoost is characterised within the sense that subsequent weak learners or people who want to gain knowledge are tweaked in favour of these instances misclassified by previous classifiers. AdaBoost is sensitive to noisy data and outliers. In some problems, it is often less vulnerable to the overfitting problem than other learning algorithms. The individual learners are often weak, but as long because the performance of everyone is slightly better than random guessing, the ultimate model is often proven to converge to a robust learner.

Every learning algorithm tries to fix some problem or issues types which are better than others and typically has many various parameters and configurations to regulate before it achieves optimal performance on a dataset. AdaBoost (with decision trees because the weak learners) is usually mentioned because of the best out-of-the-box classifier.

When it is used with decision tree learning or tree learning, information gathered or collected at each and every stage of the AdaBoost algorithm about the relative ‘hardness’ of every training sample is fed or put into the tree growing algorithm such later trees tend to specialise in harder-to-classify examples which is important.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

An Example of How AdaBoost Works

Step 1: A weak classifier (e.g. a choice stump) is formed on top of the training data supported the weighted samples. Here, the weights of every sample indicate how important it’s to be correctly classified. Initially, for the primary stump, we give all the samples equal weights.

Step 2: We create a choice stump for every variable and see how well each stump classifies samples to their target classes, for instance, within the diagram below we check for Age, Eating food and exercise. We’d check out what percentage samples are correctly or incorrectly classified as Fit or Unfit for every individual stump.

Step 3: More weight is assigned to the incorrectly classified samples in order that they’re classified correctly within the next decision stump. Weight is additionally assigned to every classifier supported the accuracy of the classifier, which suggests high accuracy = high weight!

Step 4: Reiterate from Step 2 until all the info points are correctly classified, or the utmost iteration level has been reached.

Fully grown decision tree which is on left side vs three decision stumps which is on right hand side.

Note: Some stumps get more say within the classification than other stumps.

The Mathematics Behind AdaBoost

Here comes the hair-tugging part. Let’s break AdaBoost down, step-by-step and equation-by-equation in order that it’s easier to grasp. Let’s start by considering a dataset with N points, or rows, in our dataset.

In this case,

  • n is that the dimension of real numbers or the number of attributes in our dataset
  • x is that the set of knowledge points
  • y is that the target variable which is either -1 or 1 because it may be a binary classification problem, denoting the primary or the second class (e.g. Fit vs Not Fit)

We calculate the weighted samples for every datum. AdaBoost assigns weight to every training example to work out its significance within the training dataset. When the assigned weights are high, that set of coaching data points are likely to possess a bigger say within the training set. Similarly, when the assigned weights are low, they need a minimal influence within the training dataset.

Initially, all the info points will have an equivalent weighted sample w:

where N is that the total number of knowledge points.

The weighted samples always sum to 1, therefore the value of every individual weight will always lie between 0 and 1. After this, we calculate the particular influence for this classifier in classifying the info points using the formula:

Alpha is what proportion influence this stump will have within the final classification. Total Error is nothing but the entire number of miss-classifications for that training set divided by the training set size. we will plot a graph for Alpha by plugging in various values of Total Error starting from 0 to 1.

Making Predictions with AdaBoost

Predictions are always helpful and done by calculating the weighted average of the two of the weak classifiers.

For a replacement input instance, each weak learner calculates a predicted value as either +1.0 or -1.0. the anticipated values are weighted by each weak learners stage value. If the sum is positive, then the primary class is predicted, if negative the second class is predicted.

For example there are 5 weak classifiers which might  predict the values for example  1.0, 1.0, -1.0, 1.0, -1.0. From a majority vote, it’s just like the model will predict a worth of 1.0 or the primary class. The similar  5 weak classifiers might have the stage values which are  0.2, 0.5, 0.8, 0.2 and 0.9 respectively. Calculating the weighted sum of those predictions leads to an output of -0.8, which might be an ensemble prediction of -1.0 or the second class.

Also Read, clustering in machine learning

Data Preparation for AdaBoost

This section would list some best practises for best preparing your data for AdaBoost.

• Quality Data: Because the ensemble method continues to aim to correct misclassifications within the training data, you would like to take care that the training data is of a high-quality.

• Outliers: Outliers will force the ensemble down the rabbit burrow of working hard to correct for cases that are unrealistic. These might be faraway from the training dataset.

• Noisy Data: Noisy data, specifically noise within the output variable are often problematic. If possible, plan to isolate and clean these from your training dataset.


As these examples demonstrate, real-world data includes some patterns that are linear but also many who aren’t. Switching from another algorithm like rectilinear regression to ensembles of decision stumps( AdaBoost) would allow us to capture many of those non-linear relationships which are important, which translates into better prediction accuracy on the serious matter of interest, whether that be finding the simplest wide receivers to draft or the simplest stocks which are easy to get.

In this article, we’ve discussed the varied ways to know the AdaBoost algorithm. We started by introducing you to Ensemble Learning and it’s various types to form sure that you simply understand where AdaBoost falls exactly. We discussed the pros and cons of the algorithm and gave you a fast demo on its implementation using Python.

AdaBoost is sort of a boon to enhance the accuracy of our classification algorithms if used accurately. it’s the primary successful algorithm to spice up binary classification. AdaBoost is increasingly getting used within the industry and has found its place in face recognition systems to detect if there’s a face on the screen or not.

Previous article
Deep learning with Tensorflow and Keras
Next article
Top 13 Machine Learning projects in R
Live masterclass