Programming留学生讲解、讲解python编程设计、python程序调试、辅导dataset

- 首页 >> OS编程
Homework Programming Assignment
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).
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
○ Radial Basis Kernel
○ Polynomial Kernel
LinearSVM accuracy > =80%
● Code Review (PEP8 style and some comments)
Handin:
The files to turn in is: svm.py. The autograder for the SVM will show if your submission
is compatible with our system
程序:

站长地图