loadNet ("win17-20relu-8relu-3softmax.net")
#loadNet ("tmp.net")
loadPattern ("/home/reczko/snns/tra.pat")
loadPattern ("/home/reczko/snns/val.pat")
resfile := "test2.res"
ep := 0
done := 0
lr := 0
setInitFunc( "Randomize_Weights", 0.05, -0.05)
initNet ()
setLearnFunc( "RpropMAP", 0.005, 0.1, 6, 50, 2)
repeat

 saveNet("best2.net")
 if ( ep > 1 ) then  execute("cp test2.res best2.res") endif

 setPattern ("/home/reczko/snns/tra.pat")
 for i := 1 to 2 do
  trainNet ()
  print(SSE)
 endfor

 setPattern ("/home/reczko/snns/val.pat")
#testNet ()
 saveResult (resfile, 1, PAT, FALSE, TRUE, "create")
 command := "/home/reczko/snns/SNNSv4.3/tools/sources/analyze -s -e WTA -i " + resfile + " | awk -f /home/reczko/snns/SNNSv4.3/tools/sources/analyze.gawk"
 execute(command, w, r, u, e)
 print("ep: ",ep, " wrong: ",w, " right: ",r, " unknown: ",u, " error: ",e)

 if ( (ep > 9) && (r < lr) ) then
   done := 1
 else
    lr := r
 endif
 ep := ep + 1
until ((done == 1) or (SIGNAL == 2))
if (done == 1) then execute("rm test2.res") endif
print("best right: ",lr)

