Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Problem 2 (5 points)

Data: Given the following data points:

· Positive class(+1): (1,3)

· Negative class(-1): (-1,4)

Task: Determine the number of updates until convergence using the perceptron algorithm.You must iterate over data points in the order: [(1,3),(-1,4)]. Your output should be the sequence of updates in the form W;=[w₁,…,Wn]

You are only allowed to use basic mathematical tools(such as numpy in Python,MATLAB's basic functions,etc.).

Deliverables: Please show your work step by step and plot the points and final decision boundary.

Perceptron Algorithm:

1. Input: Training data set: {(x1, y1),.….,(xN,yx)}

2. Initialization:

Weight vector: w(s)=[0,.….,0]

Iteration count: s=0

3. Update Loop:

While there exists an instance i [N] such that the prediction is incorrect,i.e, yw(S)·x≤0:

Update  weight:

·For positive instances:w(s+1)=w(s)+x

·For negative instances:w(s+1)=w(s)-x

o Increment counter: s=s+1

4. Output:Final weight vector:w(s)