ML Lecture 7 - Ensemble Learning
ML Lecture 7 - Ensemble Learning
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Ensemble Learning
Random Forest
Bagging
Boosting
Ensemble of Trees
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Ensemble Classifier
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
New Data
Instances
Sub-Data1 Model, M1
Data, D Combine
Sub-Data 2 Model, M2 Prediction
Votes
Sub-Data k Model, Mk
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Random Forest
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Bagging
I Combining the decision of different mining models means the various
outputs into a single prediction. The simplest way to do this in the
case of classification is to take a vote (perhaps a weighted vote); in
the case of numeric prediction it is to calculate the average (perhaps
a weighted average).
I Bagging and boosting both adopt this approach, but they derive
the individual models in different ways. In bagging the models
receive the equal weight, whereas in boosting weighting is used to
give more influence to the more successful ones.
I To introduce bagging, suppose that several training datasets of the
same size are chosen at random for the problem domain. Imaging
using a particular machine learning technique to build a decision tree
for each dataset. We can combine the trees by having them vote on
each test instance. If one class receives more votes than any other,
it is taken as the correct one. Predictions made by voting become
more reliable as more votes are taken into account.
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Bagging (con.)
Bagging also known as Bootstrap Aggregation, combines different
classifiers into a single prediction model. It uses voting technique
(perhaps a weighted vote) for classifying a new instance.
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Boosting
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Boosting (con.)
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Boosting (con.)
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Boosting (con.)
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Error Rate
To compute the error rate of model Mi , we the sum the weights of each
of the instances in Di , that Mi misclassified. That is,
d
X
error (Mi ) = wj ∗ err (xj ) (1)
j=1
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Normalising Weight
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
AdaBoost Algorithm
Algorithm 2 AdaBoost Algorithm
Input: Training data, D, number of iterations, k, and a learning scheme.
Output: Ensemble model, M ∗
Method:
1: initialise weight, xi ∈ D to d1 ;
2: for i = 1 to k do
3: sample D with replacement according to instance weight to obtain
Di ;
4: use Di , and learning scheme to derive a model, Mi ;
5: compute error (Mi );
6: if error (Mi ) ≥ 0.5 then
7: go back to step 3 and try again;
8: end if
9: for each correctly classified xi ∈ D do
error (Mi )
10: multiply weight of xi by ( 1−error (Mi ) );
11: end for
12: normalise weight of instances;
13: end for
To use M ∗ to classify a new instance, xNew :
1: initialise weight of each class to zero;
2: for i = 1 to n do
3: wi = log 1−error (Mi )
error (Mi ) ; // weight of the classifier’s vote
4: c = Mi (xNew ); // class prediction by Mi
5: add wi to weight for class c;
6: end for
7: return class with largest weight;
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Ensemble of Trees
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU
Outline Ensemble Learning Random Forest Bagging Boosting Ensemble of Trees
Prof. Dr. Dewan Md. Farid: Ensemble Learning in Machine Learning Dept. of CSE, UIU