init commit

This commit is contained in:
2024-11-12 17:41:10 +01:00
parent 1e4f1f955b
commit 20bc9108d3
146 changed files with 24465 additions and 0 deletions

31
python/xor.py Normal file
View File

@@ -0,0 +1,31 @@
import backprop
patterns=[
[[0,0], [0]],
[[0,1], [1]],
[[1,0], [1]],
[[1,1], [0]],
]
print 'Init Network ....'
nn=backprop.NN(2,2,1)
print 'Done ....'
cpt=0
while 1:
cpt=cpt+1;
error=nn.trainAll(patterns)
if error<0.01: break
if cpt>10: break
# if nn.epochs%100==0:
print '%d: 100 step error=%1.6f'%(nn.epochs,error)
print '%d: Total Error = %1.6f'%(nn.epochs,error)
for input,target in patterns:
error,output=nn.testOne(input,target)
print '%1.6f'%error,input,target,output