repositories
/
TP_AA.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TP3: print perceptron errors.
[TP_AA.git]
/
TP3
/
exo1
/
tp3_exo1.py
diff --git
a/TP3/exo1/tp3_exo1.py
b/TP3/exo1/tp3_exo1.py
index 02416ba46171c462dde7934537888c37661bdd3f..57312f2cce03a9af40692e3df7210057dc9f5186 100755
(executable)
--- a/
TP3/exo1/tp3_exo1.py
+++ b/
TP3/exo1/tp3_exo1.py
@@
-52,10
+52,11
@@
def perceptron_nobias(X, Y):
classification_error = 1
while not classification_error == 0:
classification_error = 0
classification_error = 1
while not classification_error == 0:
classification_error = 0
- for
i in range(X.shape[0]
):
- if
Y[i] * np.dot(w, X[i]
) <= 0:
+ for
x, y in zip(X, Y
):
+ if
y * np.dot(w, x
) <= 0:
classification_error += 1
classification_error += 1
- w = w + Y[i] * X[i]
+ w = w + y * x
+ print(classification_error)
return w
return w