代碼調試有屬性錯誤啊
有沒有源碼啊?照老師的代碼,有兩個屬性錯誤啊。 AttributeError ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last)
in() ? ? ?1 ppn = Perceptron(eta=0.1, n_iter=10) ----> 2 ppn.fit(X, y) AttributeError: 'Perceptron' object has no attribute 'predict'有沒有源碼啊?照老師的代碼,有兩個屬性錯誤啊。 AttributeError ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last)
in() ? ? ?1 ppn = Perceptron(eta=0.1, n_iter=10) ----> 2 ppn.fit(X, y) AttributeError: 'Perceptron' object has no attribute 'predict'2017-04-20
舉報
2017-04-30
那是因為函數?predict()的定義在fit()定義后邊了,你把net_input()和predict()的定義放到fit()之前就OK了