Ens Embling
Ens Embling
• Bagging Classifier can be used for both regression and classification tasks. Here is an
overview of Bagging classifier algorithm:
• Bootstrap Sampling: Divides the original training data into ‘N’ subsets and randomly
selects a subset with replacement in some rows from other subsets. This step ensures
that the base models are trained on diverse subsets of the data and there is no class
imbalance.
• Base Model Training: For each bootstrapped sample we train a base model
independently on that subset of data. These weak models are trained in parallel to
increase computational efficiency and reduce time consumption. We can use
different base learners i.e different ML models as base learners to bring variety and
robustness.
• Prediction Aggregation: To make a prediction on testing data combine the predictions
of all base models. For classification tasks it can include majority voting or weighted
majority while for regression it involves averaging the predictions.
• Out-of-Bag (OOB) Evaluation:. Some samples are excluded from the training subset of
particular base models during the bootstrapping method.These “out-of-bag” samples
can be used to estimate the model’s performance without the need for cross-
validation.
• Final Prediction: After aggregating the predictions from all the base models, Bagging
produces a final prediction for each instance.
Python pseudo code for Bagging Estimator implementing libraries:
• Initialize Model Weights: Begin with a single weak learner and assign equal
weights to all training examples.
• Train Weak Learner: Train weak learners on these dataset.
• Sequential Learning: Boosting works by training models sequentially where
each model focuses on correcting the errors of its predecessor. Boosting
typically uses a single type of weak learner like decision trees.
• Weight Adjustment: Boosting assigns weights to training datapoints.
Misclassified examples receive higher weights in the next iteration so that next
models pay more attention to them.
Python pseudo code for boosting Estimator implementing libraries:
Output:
Accuracy: 1.0