Ensembles of Decision Trees

Module - 5 Classification
Ensembles of Decision Trees


Ensembles of Decision Tree (EoDT) are an ensemble learning technique that combines multiple decision trees to create a more accurate and powerful model. EoDT combines the predictions of multiple decision trees to create a single, unified prediction. This unified prediction is often more accurate than the individual predictions of the individual trees, resulting in a more robust and reliable model. EoDT can also be used to identify important features or predictors in a dataset. This can be used to help identify relationships between variables or to reduce the complexity of a dataset. EoDT is a powerful technique for building predictive models and can be used for both classification and regression tasks.

What are ensembles and why are they used?

Ensembles are a type of machine learning technique that combines multiple models to create a more powerful, accurate, and robust model. They are used in machine learning because they can produce more accurate and reliable results than a single model. Ensembles can also help reduce the risk of overfitting, which is when a model is too closely tailored to the training data and doesn’t generalize well to new data. Ensemble methods also have the advantage of being able to make use of the strengths of different models and to reduce the weaknesses of individual models.

Types of ensembles: bagging, boosting


  • When we want to decrease the variance of a decision tree, we employ bagging (Bootstrap Aggregation). The objective here is to generate different subsets of data from a training sample selected at random using replacement.
  • Each subset of data is now utilised to train their decision trees. As a consequence, we have an ensemble of many models. It is more resilient than a single decision tree to utilise the average of all forecasts from several trees.
  • Random Forest is a bagging extension. It adds an extra step in which, in addition to utilising a random subset of data, it also uses a random selection of features to create trees rather than using all features. When you have a lot of random trees. It's known as Random Forest.


  • Boosting is another ensemble strategy for generating a set of predictors. Learners are taught progressively in this method, with early learners fitting basic models to data and subsequently examining data for flaws. In other words, we fit subsequent trees (random sample) with the purpose of solving for net error from the previous tree at each step.
  • When a hypothesis incorrectly classifies an input, its weight is increased such that the following hypothesis is more likely to properly identify it. By mixing the entire collection at the end, weak learners are transformed into better performing models.
  • Gradient Boosting is an enhancement to the boosting approach.
       Gradient Boosting =Gradient Descent+Boosting.

It employs the gradient descent approach to optimise any differentiable loss function. Individual trees are totaled consecutively to form an ensemble of trees. The following tree attempts to recover the loss (difference between actual and predicted values).


  • Stacking or Stacked Generalization is an ensemble technique. It uses a meta-learning algorithm to learn how to best combine the predictions from two or more base machine learning algorithms.
  • The benefit of stacking is that it can harness the capabilities of a range of well-performing models on a classification or regression task and make predictions that have better performance than any single model in the ensemble.
  • Given multiple machine learning models that are skillful on a problem, but in different ways, how do you choose which model to use (trust)? The approach to this question is to use another machine learning model that learns when to use or trust each model in the ensemble.
  • Unlike bagging, in stacking, the models are typically different (e.g. not all decision trees) and fit on the same dataset (e.g. instead of samples of the training dataset).
  • Unlike boosting, in stacking, a single model is used to learn how to best combine the predictions from the contributing models (e.g. instead of a sequence of models that correct the predictions of prior models).
  • The architecture of a stacking model involves two or more base models, often referred to as level-0 models, and a meta-model that combines the predictions of the base models, referred to as a level-1 model.
  • The outputs from the base models used as input to the meta-model may be real value in the case of regression, and probability like values, or class labels in the case of classification.

Applications of ensemble models

  1. Classification: Ensemble models are commonly used for classification tasks, such as classifying emails as spam or legitimate, identifying customer segments, or predicting the outcome of a medical diagnosis. Ensemble models can combine multiple decision tree, neural network, support vector machine, and gradient boosting machine models to create a more powerful and accurate classification model.
  2. Regression: Ensemble models are also useful for regression tasks, such as predicting housing prices, stock prices, or customer churn rates. By combining multiple decision tree, neural network, support vector machine, and gradient boosting machine models, ensemble models can create a more powerful and accurate model to predict values.
  3. Anomaly Detection: Ensemble models are also useful for anomaly detection tasks, such as detecting fraudulent credit card transactions or identifying suspicious activity on social media. Ensemble models can combine multiple decision tree, neural network, support vector machine, and gradient boosting machine models to create a more powerful and accurate anomaly detection model.

Interpretation of ensemble models: feature importance, decision paths, and tree visualization

Ensemble models are composed of multiple models that are combined to provide better accuracy and predictive power than any single model alone. Feature importance is a measure of how much a given feature contributes to the overall accuracy or performance of the model. Decision paths are the sequence of decisions taken by the model to reach a particular outcome. Tree visualization is a graphical representation of the decision tree that helps to explain the underlying structure of the model and the decisions that it makes. Tree visualization can be used to interpret the decision paths and to understand the feature importance of the model, allowing us to better understand the model's behavior and make better decisions.


Ensembles of decision trees are powerful machine learning algorithms that can be used to solve a variety of problems. They are capable of making accurate predictions with minimal effort and have been shown to outperform more complex models in many cases. Ensembles can also help to improve the accuracy and robustness of a model. Additionally, they provide a way to reduce overfitting by combining the predictions of multiple models. With the right implementation, ensembles of decision trees can provide an effective solution for many machine learning tasks.

Key takeaways

  1. Ensembles of Decision Trees are powerful machine learning models that can make accurate predictions.
  2. Ensembles of Decision Trees combine multiple base learners to make more robust predictions.
  3. Ensembles of Decision Trees are less prone to overfitting than an individual Decision Tree.
  4. Bagging and boosting are two popular techniques for creating Ensembles of Decision Trees.
  5. Random forests are a type of ensemble method that use randomization to reduce variance and make more accurate predictions.


1.What is the major challenge of using Ensembles of Decision Trees? 

  1. Overfitting 
  2.  Underfitting 
  3.  Poor Performance
  4.  High Variance

Answer: d. High Variance

2. What type of algorithm is an Ensemble of Decision Trees? 

  1. Classification 
  2. Regression 
  3. Clustering 
  4. Reinforcement Learning

Answer: a. Classification

3. What is the main goal of an Ensemble of Decision Trees?

  1. To reduce variance 
  2. To increase accuracy 
  3. To reduce bias 
  4. To increase efficiency

Answer: b. To increase accuracy

4. What is the most common Ensemble of Decision Trees method? 

  1. Boosting 
  2. Bagging 
  3. Random Forest 
  4. AdaBoost

Answer: c. Random Forest

Recommended Courses
Masters in CS: Data Science and Artificial Intelligence
20,000 people are doing this course
Join India's only Pay after placement Master's degree in Data Science. Get an assured job of 5 LPA and above. Accredited by ECTS and globally recognised in EU, US, Canada and 60+ countries.
Certification in Full Stack Data Science and AI
20,000 people are doing this course
Become a job-ready Data Science professional in 30 weeks. Join the largest tech community in India. Pay only after you get a job above 5 LPA.

AlmaBetter’s curriculum is the best curriculum available online. AlmaBetter’s program is engaging, comprehensive, and student-centered. If you are honestly interested in Data Science, you cannot ask for a better platform than AlmaBetter.

Kamya Malhotra
Statistical Analyst
Fast forward your career in tech with AlmaBetter

Vikash SrivastavaCo-founder & CPTO AlmaBetter

Vikas CTO

Related Tutorials to watch

Top Articles toRead

Made with heartin Bengaluru, India
  • Official Address
  • 4th floor, 133/2, Janardhan Towers, Residency Road, Bengaluru, Karnataka, 560025
  • Communication Address
  • 4th floor, 315 Work Avenue, Siddhivinayak Tower, 152, 1st Cross Rd., 1st Block, Koramangala, Bengaluru, Karnataka, 560034
  • Follow Us
  • facebookinstagramlinkedintwitteryoutubetelegram

© 2023 AlmaBetter