UserPreferences

PyroSRNExample


  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 
 34 
 35 
 36 
 37 

from pyrobot.brain.conx import *

# Create network:

srn = SRN()
srn.addSRNLayers(1, 6, 1)
srn.setSequenceType("random-segmented")
srn.predict('input', 'output')

# An input, followed by neutral symbol,
# followed by a prediction of the first symbol:

srn.setInputs([[0.0, 0.0],
               [1.0, 0.0],
               ])

# Network learning parameters:
srn.setReportRate(50)
srn.setEpsilon(0.1)
srn.setMomentum(0.0)
srn.setBatch(1)

# Ending criteria:
srn.setTolerance(0.4)
srn.setStopPercent(1.0)
srn.setResetEpoch(60000)
srn.setResetLimit(0)

# Train:
srn.train()

# Test:
srn.setLearning(0)
srn.setInteractive(1)
srn.sweep()
srn.saveWeightsToFile("srn.wts")