Question: PLEASE USE PYTHON Below is an outline of the PLA algorithm. Fill in the while loop part. The while loop should yield a weight vector
PLEASE USE PYTHON


Below is an outline of the PLA algorithm. Fill in the "while loop" part. The while loop should yield a weight vector w which makes the same decisions on X as the original decision boundary. Note: Your code should work regardless of the dimensions of X and y. Don't code in any magic numbers. If you find yourself writing a repeat loop in python (other than the given while loop) then you are doing something wrong You should be using a matrix operation instead, like X.dot(w) or something Use boolean indexing to find misclassified points. Hint: What is this? np.argmax( [False,True, False] ) def PLA(x,y,iterations-2000): x: an Nx(d+1) matrix of datapoints with bias column y: a Nxl vector of classifications in (-1,1) iterations: the maximum number of iterations description: Applies the perceptron learning algorithm to x,y for given number of iterations returns: learned weight vector assert(iterations0) w- np.randon . rand (.shape [1)) # random initial weights _iterations0 while(_iterations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
