Question: CODE IN PYTHON DONT USE ANY INBUILT LIBRARY IMPLEMENT EVERYTHINF FROM SCRATCH,Note you are not allowed to use libraries which can take data, fit the
CODE IN PYTHON DONT USE ANY INBUILT LIBRARY IMPLEMENT EVERYTHINF FROM SCRATCH,Note you are not allowed to use libraries which can take data, fit the
model, predict the labels and give final evaluation metrics.
Use MNIST
dataset for this question you can get it from google and select two digits and Label them as and
In this exercise you will be implementing AdaBoost.M Perform following
tasks.
Divide the train set into train and val set. Keep samples from each
class for val. Note val should be used to evaluate the performance of the
classifier. Must not be used in obtaining PCA matrix.
Apply PCA and reduce the dimension to p You can use the train set
of the two classes to obtain PCA matrix. For the remaining parts, use the
reduced dimension dataset.
Now learn a decision tree using the train set. You need to grow a deci
sion stump. For each dimension, find the unique values and sort them
in ascending order. The splits to be evaluated will be midpoint of two
consecutive unique values. Find the best split by minimizing weighted
missclassification error. Denote this as hx Note as we are dealing
with real numbers, each value may be unique. So just sorting them and
taking midpoint of consecutive values may also result in similar tree.
Compute alpha and update weights.
Now build another tree hx using the train set but with updated weights.
Compute alpha and update weights. Similarly grow such stumps.
After every iteration find the accuracy on val set and report. You should
show a plot of accuracy on val set vs number of trees. Use the tree that
gives highest accuracy and evaluate that tree on test set. Report test
accuracy.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
