| 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
|
from pyrobot.brain.conx import *
n = SRN()
n.addSRNLayers(3,2,3) # input of 3, hidden/context of 2, output of 3
n.setPatterns({"A":[1, 0, 0], # symbols we will use during training
"B":[0, 1, 0],
"C":[0, 0, 1]})
n.setInputs([['A','B','C'], # sequences will be presented in random order
['A','C','B']])
n.crossValidationCorpus = ({"input" : ['A','B','C','A','C','B']},
{"input" : ['A','C','B','A','B','C']} )
n.predict('input','output') # task is to predict next input
n.setReportRate(100)
n.setEpsilon(0.1)
n.setMomentum(0)
n.setTolerance(0.2)
n.setStopPercent(0.75) # not all inputs are predictable
n.setResetEpoch(8000)
n.setResetLimit(0)
n.setSequenceType("random-segmented")
n.train()
n.setLearning(0)
n.setInteractive(1)
n.sweep() |