import numpy as np import matplotlib.pyplot as plt X=np.array([[1,3,3], [1,4,3], [1,1,1]]) Y=np.array([1,1,-1]) W=(np.random.random(3)-0.5)*2 print(W) lr=0.11 n=0 O=0 def update(): global X,Y,W,lr,n n+=1 O=np.sign(np.dot(X,W.T)) W_C=lr*((Y-O.T).dot(X