funziona and e or solo se metto bias < -1 in uno dei percettroni input
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from percettrone import Percettrone
|
||||
|
||||
x = [(0,0),(0,1),(1,0),(1,1)] # Combinazioni
|
||||
output = (0,0,0,1) # AND Logico
|
||||
#output = (0,0,0,1) # AND Logico
|
||||
output = (0,1,1,1) # OR Logico
|
||||
|
||||
p = Percettrone()
|
||||
corrette = 0 #Fermo le epoche se termina prima
|
||||
@@ -30,7 +31,7 @@ for i in range(1,100): #Epoche
|
||||
|
||||
for j in range(0,4): #Combinazioni
|
||||
y = p.funzione_gradino(x[j][0], x[j][1])
|
||||
errore = p.valuta(x[j][0], x[j][1], output[j])
|
||||
errore = output[j] - y
|
||||
stampa_operazione(p, y, x[j][0], x[j][1])
|
||||
if errore != 0:
|
||||
p.correggi_pesi(x[j][0], x[j][1], errore)
|
||||
|
||||
Reference in New Issue
Block a user