next up previous contents index
Next: Snnsbat -- The Up: Batchman Example Programs Previous: Example 2

Example 3

The last example program shows how the user can validate the training with a second pattern file. The net is trained with one training pattern file and the error, which is used to determine when training should be stopped, is measured on a second pattern file. Thereby it is possible to estimate if the net is able to classify unknown patterns correctly:

loadNet ("")
loadPattern ("validate.pat")
loadPattern ("training.pat")
initNet ()

  for i := 1 to 20 do
    trainNet ()
  saveNet ("test." + CYCLES + "")
  setPattern ("validate.pat")
  testNet ()
  valid_error := SSE
  setPattern ("training.pat")
until valid_error < 2.5

saveResult ("test.res")

The program trains a net for 20 cycles and saves it under a new name for every iteration of the repeat instruction. Each time the program tests the net with the validation pattern set. This process is repeated until the error of the validation set is smaller than 2.5
Tue Nov 28 10:30:44 MET 1995