代写 C python Homework Programming Assignment

Homework Programming Assignment
Due: Tuesday, February 26th at 11:00pm

In this assignment, you will be implementing a support vector machine to classify an Australian weather dataset.

Part 0: Data Preprocessing
The data set has features of related weather metrics per day and your goal is to predict whether or not it will rain the next day. We have already processed the data for you (for part 1). You only need to split the data into training and testing (for part 2). You will be using the same data for parts 1 and 2 of this assignment.

Part 1: Support Vector Machine
Your task will be to implement a support vector machine from scratch only in python.

We have provided a file called svm.py that contains a minimal amount of stencil. Do not modify the stencil; otherwise, your submission will be incompatible with the autograder. You are permitted to add additional class variables and functions, but do not edit the existing class variables. You can check your implementation using keras, sklearn or another python library. However, when we grade your implementation, we will remove libraries that provide pre-built implementations.

Support Vector Machine (svm.py):
You will see three functions and a two classes with a predict method: LinearSVM and SVM. Your SVM will take the kernel function (linear, radial basis function/gaussian, and polynomial), and C as input. Similar to the logistic regression, we will be using the predict method in your model to evaluate the accuracy. We have also provided you with a quadratic program solver that you can use inside the train function. Although you should implement both SVM and LinearSVM, you will want to use LinearSVM on this data set, because forming the kernel matrix is very computationally expensive when there are tens of thousands of rows.

Tips and Hints
• Test your implementation against other implementations and see how it compares (e.g., SVM from sklearn).
• Split up functions in a logical way that makes it easy to write unit tests. Test that each of your functions is outputting the correct information given known input/output.
• Use small inputs to test and debug your models. Try creating your own dataset.
• Try visualizing the output of your model; is it what you expected?

Grading:
• SVM:
• Linear Kernel Accuracy >= 84%
• Radial Basis Kernel Accuracy >= 83%
• Polynomial Kernel Accuracy >= 76%
• Code Review (PEP8 style and some comments)

Handin:
For the programming assignment, run the cells that save your models as .h5 files.