Ensemble Learning (Free Preview)

Classification trees are considered weak learners, meaning that they are highly sensitive to the data used to train them. Thus, two slightly different sets of training data can produce two completely different trees and, consequently, different predictions.


However, this weakness can be harnessed as a strength by creating several trees (or, following the analogous naming, a forest). New observations can then be applied to all the trees and the resulting predictions can be compared.


This lesson focuses on ensemble learning methods.


Fit Ensemble Models

Use the fitensemble function to create ensembles for weak learners.

>> mdl = fitensemble(data,responseVarName,Method,N,Learner)
Outputs Inputs 
mdlEnsemble learning model variable.dataTable containing the predictors and response values.
responseVarNameResponse variable name
MethodEnsemble learning method.
N Number of ensemble learning cycles.
LearnerLearning method.



  • Method  – Bagging (bootstrap aggregation) and boosting are two most common approaches used in ensemble modeling. The fitensemble function provides several bagging and boosting methods.

  • Learner  Different learning methods can be used depending on the ensemble method used. One of the most common methods is tree.



Lesson tags: Ensemble Learning, Machine Learning, Reducing Predictors
Back to: Machine Learning using MATLAB > Module 5: Improving Predictive Models