這是什么錯誤?
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('錯誤份分類次數')<ipython-input-5-5380c51dbd83> in fit(self, X, y) ? ? 24 ? ? ? ? 加1 是因為前面算法提到的w0,也就是步調函數閾值 ? ? 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
應該是zeros