main
Florian Babel 2026-10-19 12:28:46 +02:00
parent 21bdd9376a
commit 3aaba244d5
2 changed files with 8304 additions and 57 deletions

View File

@ -37,19 +37,23 @@ class SLN:
for it in range(maxIter):
Y = self.neuron(X) # nur ein Aufruf
err = ErrorRate(Y, T)
if (it % 20) == 0:
print('#{} err:{}\n{}\n{}'.format(it, err, self._W, self._b))
nnwplot.plotTwoFeatures(X, T, self.neuron)
plt.pause(0.05) # warte auf GUI event loop (je nach python Version notwendig oder nicht)
# if (it % 20) == 0:
print('#{} err:{}\n{}\n{}'.format(it, err, self._W, self._b))
nnwplot.plotTwoFeatures(X, T, self.neuron)
plt.pause(0.05) # warte auf GUI event loop (je nach python Version notwendig oder nicht)
if err <= maxErrorRate:
break
# update _W
total_to_learn = 0
for n in range(N):
error = T[n] - Y[n]
for j in range(self.dIn):
weighted_error = error * X[j, n]
to_learn = weighted_error * eta
self._W[j, 0] += to_learn
print("{:.2f} = {} * {} * {}".format(to_learn, error, X[j, n], eta))
total_to_learn += to_learn
print(total_to_learn)
self._W[j, 0] += total_to_learn
# update _b
...
print('#{} err:{}\n{}\n{}'.format(it, err, self._W, self._b))

File diff suppressed because one or more lines are too long