<ipython-input-21-d853d9208eef> in predict(self, X)
36
37 def predict(self, X):
---> 38 return np.where(self,net_input(X) >= 0.0 , 1, -1)
39 pass
40 pass
NameError: name 'net_input' is not defined
36
37 def predict(self, X):
---> 38 return np.where(self,net_input(X) >= 0.0 , 1, -1)
39 pass
40 pass
NameError: name 'net_input' is not defined
2017-07-24
1.对象初始化 def __init__(self,eta=0.01,n_iter=10):
2.AttributeError 'Precetron' object has no attribute 'predict'
把def net_input(self, X),def predict(self, X)移到fit的外面
2.AttributeError 'Precetron' object has no attribute 'predict'
把def net_input(self, X),def predict(self, X)移到fit的外面
2017-07-21
AttributeError: module 'numpy' has no attribute 'zero'
2017-07-20
in[5] 运行后,报错:
----> 2 ppn.fit(X,y)
---> 45 update=self.eta*(target-self.predict(xi))
46
47 """
AttributeError: 'Perceptron' object has no attribute 'predict'
----> 2 ppn.fit(X,y)
---> 45 update=self.eta*(target-self.predict(xi))
46
47 """
AttributeError: 'Perceptron' object has no attribute 'predict'
2017-07-19