Assignment-2_CS5710/Assignment-2_CS5710_Logistic-Regression.pdf Introduction to Machine Learning (CS 4710/5710) Assignment-2 (80 points) Logistic Regression Due by 23rd march (Monday) 11:59pm You are allowed to discuss the problem and solution design with others, but the code you submit must be your own. Your solution must include the certification of authenticity “I certify that the codes/answers of this assignment are entirely my own work.” Datasets The training and test files will follow the same format as the text files in the UCI datasets. Datasets and description of the datasets are uploaded with this assignment onto Blackboard. For each dataset, a training file and a test file are provided. The name of each file indicates what dataset the file belongs to, and whether the file contains training or test data. Your code should also work with ANY OTHER training and test files using the same format as the files in the UCI datasets. Logistic Regression You must implement a Python executable file called logistic_regression that uses logistic regression to fit a function to the given UCI datasets. Your code should work for all the three datasets (for different number of features). Your function should be invoked as follows: logistic_regression with following three command line arguments: <training_file> <test_file> • <training_file>: The first argument, <training_file> is the path name of the training file, where the training data is stored. The path name can specify any file stored on the local computer. • <test_file>: The second argument, <test_file> is the path name of the test file, where the test data is stored. The path name can specify any file stored on the local computer. Training Stage for Logistic Regression You need to apply gradient descent method at the training stage of your model. The hypothesis of the logistic regression is: Gradient Descent Method: At the end of the training stage, your program should print out the values of the weights that you have estimated. The output of the training phase should be a sequence of lines like this: 𝜃0=%.4f 𝜃1=%.4f 𝜃2=%.4f ... Test Stage for Logistic Regression After the training stage, you should apply the function that you have learned on the test data. For each test object (following the order in which each test object appears in the test file), you should print a line containing the following info: • Object ID. This is the line number where that object occurs in the test file. • Predicted class (the result of the classification). • True class (the last column on the line where the object occurs). • Accuracy. This is defined as follows: o If the predicted class is correct, the accuracy is 1. o If the predicted class is incorrect, the accuracy is 0. The output of the test stage should be a sequence of lines like this: ID=%5d, output=%14.4f, target value = %10.4f, Misclassification .