Python机器学习代写 | ESE 417 HW3 Problem 1 (Perceptron algorithm)

本次美国代写是Python机器学习相关的一个assignment

a. Linearly separable case:

(1) Use Python to generate a 2D (𝒙𝑖 ∈ ℛ2) linearly separable data set with 50 positive
instances and 50 negative instances and create a scatter plot to visualize the data
set. Split the data set into training set (70%) and test set (30%).

(2) Use Python (not sklearn package) to create the Batch Perceptron training algorithm
and use the training data set in a.(1) to train a Perceptron model. Plot the error
function curve when the training process converges. Create a plot that shows the
training instances and the learnt decision boundary.

(3) Use the test set in a.(1) to test the trained model in a.(2) and show the accuracy of
the trained model.

(4) Use Python (not sklearn package) to create the sequential Perceptron training
algorithm and use the training data set in a.(1) to train a Perceptron model. Plot the
error function curve when the training process converges. Create a plot that shows
the training instances and the resulting decision boundary.

(5) Use the test set in a.(1) to test the trained model in a. (4) and show the accuracy of
the trained model.

(6) Show how you select learning rate during the training process of a.(2) or a.(4) and
demonstrate how the choice of the learning rate is affecting the convergence of the
training process.

(7) Use the Perceptron model in sklearn package to work on the synthetic data set in a.

(1) and compare the results with that in a. (3) and a. (5).

b. Nonlinearly separable case:

(1) Use Python to generate a 2D not linearly separable data set with 50 positive
instances and 50 negative instances and create a scatter plot to visualize the data
set.

(2) Modify the training algorithm you developed in a.(2) to have a training algorithm
that works on a nonseparable data set. Use the synthetic data set in b.(1) to test
your algorithm. Show the error function curve. Plot the decision boundary on the
scatter plot of the data set.