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 -0 and 1. Label them as -1 and
1. In this exercise you will be implementing AdaBoost.M1. Perform following
tasks.
Divide the train set into train and val set. Keep 1000 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 =5. 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
miss-classification error. Denote this as h1(x). 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 1 and update weights.
Now build another tree h2(x) using the train set but with updated weights.
Compute alpha 2 and update weights. Similarly grow 300 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. [2]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!