Perceptron train #24
-
Hi! I have done the Perceptron as in 1.6 but when I do the training I have the error: TypeError: can't multiply sequence by non-int of type 'float' this is my code: class Perceptron:
def train(model, all_x, all_y, epochs):
ppn = Perceptron(num_features=2) train(model=ppn, all_x=X_train, all_y=y_train, epochs=5)TypeError Traceback (most recent call last) Cell In[11], line 7, in train(model, all_x, all_y, epochs) Cell In[9], line 20, in Perceptron.update(self, x, true_y) Cell In[9], line 10, in Perceptron.forward(self, x) TypeError: can't multiply sequence by non-int of type 'float |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hmm, to help finding out what's going on, can you modify this for i, _ in enumerate(self.weights):
weighted_sum_z += x[i] * self.weights[i] to for i, _ in enumerate(self.weights):
print(x[i])
weighted_sum_z += x[i] * self.weights[i] to find out what could be causing this? |
Beta Was this translation helpful? Give feedback.
Hmm, to help finding out what's going on, can you modify this
to
to find out what could be causing this?