Isaac Tonyloi
4 min readFeb 7, 2021

Machine Learning Ensemble Methods.

Forming a study group with one of your best friends to ace that end of trimester paper. A lecturer combining different teaching methods to increase learner understanding, are just a few of illustrations the of what ensemble methods are all about. Better results nothing else.

While this might not be the actual replica of how ensemble methods work the analogy is the same together with what ensemble learning hopes to achieve which is better accuracy and more stable algorithms(models).

Ensemble methods are largely used with unsupervised learning algorithms when making predictions.

It is a technique that involves combining a diverse range of algorithms in order to come up with a better and more optimized output(better accuracy). This has to be done by carefully considering the efficiency, time and space complexities of the algorithms.

Ensemble methods have not only been known to improve the overall accuracy of the models but have also been very effective for winning competitions in which candidates are required to come up with the most accurate model.

When working with a single algorithm there are instances when a data scientist may be forced to make a tradeoff of certain features in a dataset in order to overcome common problems such as overfitting and underfitting. The ensemble method can be a solution to such problems that arise when training machine learning algorithms. Cross-validation is one of the methods used in dealing with overfitting.

One of the most favorite algorithm when it comes to using the ensemble technique is the Decision trees algorithms where we several decision trees are used for coming up with a better prediction that just a using a single decision tree.

Ensemble learning is widely classified into groups: bagging(bootstrap aggregation), stacking, and cost methods

a) Bagging.

This ensemble method aims at improving the overall accuracy and stability of the model while avoiding overfitting.

Several models are trained to predict the output and the average of the overall estimations is considered to be the optimal prediction.

Random forest is the most common algorithm implemented using this method where the average of the predictions for the unseen data is considered to be the most accurate prediction.

b) Boosting.

By leveraging computing power and time the training data may be split and used to train different algorithms sequentially until a more powerful ensemble model is achieved the data across the series of algorithms being trained may be homogenous or heterogenous consecutively generating homogenous and heterogenous base learners.

In the process of training the models and combining predictions, weak learners are in the processes converted to strong algorithms with more accurate predictions.

c) Max Voting

This technique is mostly applied in classification problems whereby the prediction output from the majority of the base algorithms(multiple machine learning algorithms involved) is considered to be the most accurate and final one.

Although this technique is widely used in classification problems it is also used in regression, the only difference between the two is that for the case of regression the average of the predictions from the base algorithms is considered while in classification problems the prediction that has the highest number of votes is considered.

For the case of classification problems, the total sum of the votes or the total probability can be used instead, in the former scenario we refer that to as hard voting while for the latter it is known as soft voting.

For algorithms to be considered as base models in voting ensembles it is recommended that they should have almost the same performance in a given similar problem.

The latest Scikit Learn versions provide amazing tools for the case of classification and regression. You can refer to their official documentation for more on the same.

A case in the example can be a food outlet that is most recommended by your close friends is most likely to be offering the best meals as compared to the one recommended by a few.

d) Stacking.

Both the blending and stacking ensemble techniques use almost the same approach the only difference being that blending uses a smaller percentage of the training data as a validation set(not used during training) while stacking uses predictions of the base-models.

Stacking simply involves using a selection of algorithms to come up with base-level models whose predictions after training and testing are used as features and consequently as inputs in the ultimate final model being trained often referred to as the meta-model.

The prediction accuracy and stability of the meta-model should be better than any of the base-models used in the initial stage of the stacking process.

Scikit learn is one of my most favorite libraries in implementing some of the above methods you can check out their official documentation and write some code.

isaactonyloi@gmail.com

Thank you

Isaac Tonyloi
Isaac Tonyloi

Written by Isaac Tonyloi

Software Engineer. Fascinated by Tech and Productivity. Writing mostly for myself, sharing some of it with you