$30
In the following two problems, you are asked to implement Perceptron algorithm and Linear Regression algortithm in Python. To set up the environment, install the following software & packages:
• python (https://www.python.org/downloads/)
• numpy (http://www.numpy.org/)
• scipy (http://www.scipy.org/)
• matplotlib (http://matplotlib.org/)
• scikit-learn (http://scikit-learn.org/stable/)
Note that, you are allowed to use other programming languages for your implementation. If so, you may need to create an csv data loader yourself and read the data from ./data/*.csv. Make sure to submit your source code to CCLE. Your answer will NOT be graded if we didn’t see your submission.
7. (15 Points) Implement the Perceptron algorithm on Iris Dataset for the task of binary classification. The skeleton code is given in iris.py.
1
• Run the skeleton code, report the testing error obtained by the Perceptron model implemented in scikit-learn.
• Replace skeleton code line 45-47 with your implementation.
• Report your error on the testing set. Report the number of iterations it took the algorithm to converge on the training set.
8. (15 Points) Implement the linear regression algorithm on Boston House Dataset for the task of regression. The skeleton code is given in boston.py.
• Run the skeleton code, report the mean squared testing error obtained by the LinearRegression model implemented in scikit-learn.
• Replace skeleton code line 47-49 with your implementation.
• Report your mean squared error on the testing set.