import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) class Neuron: def _init_(self, weights, bias): self.weights = weights self.bias = bias def feedforward(self, inputs): total = np.dot(self.weights, inputs) + self.bias return sigmoid(total) weights = np.array([0, 1]) bias = 4 n = Neuron(weights, bias) x = np.array([2, 3]) print(n.feedforward(x))
Выдаёт ошибку: Traceback (most recent call last):
File “CUsers/* * */AppData/Local/Programs/Python/Python39/neural net new.py”, line 17, in <module>
n = Neuron(weights, bias)
TypeError: Neuron() takes no arguments
И я не могу понять - почему? IDLE Shell 3.9.1