AdaBoost means Adaptive Boosting which is a ensemble learning technique that combines multiple weak classifiers to create a strong classifier. It works by sequentially adding classifiers to correct the errors made by previous models giving more weight to the misclassified data points. Lets implement AdaBoost algorithm from scratch.
1. Import Libraries
Let's begin with importing important libraries like numpy and scikit learn which will be required to do classification task.
2. Defining the AdaBoost Class
In this step we define a custom class called AdaBoost that will implement the AdaBoost algorithm from scratch. This class will handle the entire training process and predictions.
The AdaBoost class is where we define the entire AdaBoost algorithm which consists of:
Initializing model parameters like number of estimators, weights and models.
Fitting the model to the training data.
Making predictions using the trained model.
The constructor (__init__) initializes the number of weak models (n_estimators) to a list to store the alphas (self.alphas) and a list to store the weak classifiers (self.models)