這是什么錯(cuò)誤?
AttributeError ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last)<ipython-input-10-1d89fbca2738> in <module>() ? ? ?1 ppn = Perceptron(eta=0.1, n_iter=10)----> 2 ppn.fit(X, y) ? ? ?3 plt.plot(range(1, len(ppn.errors_) + 1), ppn.errors_ , marker = 'o') ? ? ?4 plt.xlabel('Epochs') ? ? ?5 plt.ylabel('錯(cuò)誤份分類次數(shù)')<ipython-input-5-5380c51dbd83> in fit(self, X, y) ? ? 24 ? ? ? ? 加1 是因?yàn)榍懊嫠惴ㄌ岬降膚0,也就是步調(diào)函數(shù)閾值 ? ? 25 ? ? ? ? """---> 26 ? ? ? ? self.w_ = np.zero(1 + X.shape[1]) ? ? 27 ? ? ? ? self.errors_ = [] ? ? 28 ? ? ? ? for _ in range(self.n_iter) :AttributeError: module 'numpy' has no attribute 'zero'
2017-10-14
應(yīng)該是zeros