参考代码:https://www.cnblogs.com/bsdr/p/5405082.html """ 我爱薯条 """ import numpy as np class Perceptron(): def __init__(self,lr): self.lr=lr #学习率 def sign(self,func): if func > 0: return 1 else: return -1 def fit(self,x_train,y_train): #x_train是特