IS5126 Hands-On with Applied Analytics (Jan-May 2024)Homework 2Handed out: 11 Mar 2024 Due: 31 Mar 2024 (11:59 PM)You are to work on this homework individually. Please do NOT post your code for this and other course assignments publicly online (e.g., on GitHub or Google Drive) to avoid unwittingly (or wilfully) facilitating plagiarism (see Week 1’s handout “wk1 admin.pdf ” for the consequences of cheating).For your submission, clearly indicate your name and ID, compress your code and answers into a single zipped ile, and submit it on Canvas. Please ensure that your code actually runs; the TA cannot give you any points otherwise. If a piece of your code is not working, clearly state so in your submission.Download MachineLearningCourse.zip from Piazza and unzip it into a folder (preferably a diferent folder from the one you used for your guided project so as to avoid overwriting your previous iles). For the ease of exposition, I shall assume that the zipped lie is uncom- pressed into the folder mydir and MachineLearningCourse/ is the only item in it. I suggest you spend some time exploring the contents of mydir/MachineLearningCourse/ to familiar- ize yourself with the ile structure of the project (it is largely the same as that of guided project). You can peruse the Blink data (originally from a Kaggle competition) in the folder mydir/MachineLearningCourse/MLProjectSupport/Blink/dataset/. (Here, I assume you are using a Mac or Linux machine that uses the forward slash / as the ile separator. If you have a Windows machine, please use the backslash / as the ile separator instead.)You need to install the Python packages Pillow (for reading and creating of images), matplotlib (for plotting graphs), and joblib. (You should have already installed these for the guided project.) Finally, please note that you are ultimately responsible for setting up your own Python environment.Question 1. (6 points)For this question, you have to apply the AdaBoost algorithm to the Blink dataset.In Assignments/Module03/BlinkFeaturize.py, look through the BlinkFeaturize class, es- pecially its CreateFeatureSet method. When that method’s includeAssignmentFeatures parameter is set to True, the FeaturizeX method applies a Sobel gradient ilter (described in Geof’s computer vision lecture slides) on a 24 × 24 image in the Blink dataset to create a 3 ×3 grid. Then it calculates the maximum and average gradient values (2 features) in both horizontal and vertical directions, giving 2 × 2 = 4 features per grid region. For the 9 grid regions, the method returns a total of 9 × 4 = 36 features per image. These features will be those used by the AdaBoost algorithm. Similarly, when the includeEdgeFeatures parameter is set to True, the FeaturizeX method calculates the average Sobel gradient 代 写IS5126 Hands-On with Applied Analytics 2024 Homework 2Python in the horizontal and vertical directions for the entire image, returning 2 features per image. (At the bottom of BlinkFeaturize.py, please (un)comment the relevant code depending on whether you want to use the joblib library for parallelization.)(Why is the parameter includeAssignmentFeatures named as such? You may ask. Well, that is because we initially wanted you to write the code corresponding to that parameter for this assignment, but decided to give you the code instead to reduce your homework load.)In MLUtilities/Learners, scrutinize the code for BoostedTrees.py that implements the Ad- aBoost algorithm using decision trees as base learners (see DecisionTreeWeighted.py). Like the LogisticRegression model you have implemented in the guided project, the two main methods of BoostedTrees are fit and predict. Note that you do NOT need to write the code for AdaBoost or for decision trees. The code has already been implemented for you; you just need to read the code to understand how to use it correctly.In Assignments/Module03/Framework-1-Blink.py, you have to add your code to complete this question. (We cannot hold your hand any more than this; otherwise, we might as well do this homework question for you.)(a) (2 points) Set includeEdgeFeatures to True as below (already done so in Framework-1-Blink.py).featurizer = BlinkFeaturize.BlinkFeaturize()featurizer.CreateFeatureSet(xTrainRaw, yTrain, includeEdgeFeatures=True)Train BoostedTrees on the Blink dataset. Via the maxDepth parameter of the BoostedTrees.fit method, vary the maximum depth of the (weighted) decision trees used by BoostedTrees from 0 to 10. For each maximum depth, determine BoostedTrees’s accuracies on the training set and validation set. On the same graph, plot the training accuracy and validation accuracy (y-axis) versus the maximum depth (x-axis). Clearly label the two curves corresponding to the training accuracy and validation accuracy and submit the graph.To help you plot the graph, you may consider using the PlotSeries method in MLUtilities/Visualizations/Charting.py (you need to specify where to output your plots via the parameter outputDirectory).(b) (2 points) Now set includeAssignmentFeatures to True as shown below and repeat the process in (a).featurizer = BlinkFeaturize.BlinkFeaturize()featurizer.CreateFeatureSet(xTrainRaw, yTrain, includeAssignmentFeatures=True)Train BoostedTrees on the Blink dataset. For each maximum depth from 0 to 10, deter- mine BoostedTrees’s accuracies on the training set and validation set. Then plot on the same graph the training accuracy and validation accuracy (y-axis) versus the maximum depth (x-axis). Clearly label the two curves corresponding to the training accuracy and validation accuracy. Compare the graph with that in (a). What can you conclude from the comparison? Su WX:codehelp