# sequential (simple recurrent or "Elman") network
# (letters come in one at a time)

set numHidden 40

addNet HS-seq -i 4
# run for 4 steps ("intervals" because ticks-per-interval=1)

addGroup input   18 INPUT
addGroup context $numHidden ELMAN
addGroup hidden  $numHidden
addGroup output  68 OUTPUT
elmanConnect hidden context
connectGroups { input context } hidden output

# seed random number generator
seed 12345
# randomize weights
resetNet
loadWeights HS-seq.init.wt

# has targets for every step
loadExamples HS-seq_ex.txt -s train-seq

# only has targets for last step
loadExamples HS-seq.test_ex.txt -s test-seq

setObj unitCellSize 40
resetPlot
plotRow * n output 17
plotRow 1 f
plotRow * n hidden 20
plotRow * b 2 n context 20
plotRow 1 f
plotRow n input 18
drawUnits

setObj input.unit(0).name  A 
setObj input.unit(1).name  B 
setObj input.unit(2).name  C 
setObj input.unit(3).name  D 
setObj input.unit(4).name  E 
setObj input.unit(5).name  G 
setObj input.unit(6).name  H 
setObj input.unit(7).name  I 
setObj input.unit(8).name  K 
setObj input.unit(9).name  L 
setObj input.unit(10).name M 
setObj input.unit(11).name N 
setObj input.unit(12).name O 
setObj input.unit(13).name P 
setObj input.unit(14).name R 
setObj input.unit(15).name T 
setObj input.unit(16).name U 
setObj input.unit(17).name W 

setObj learningRate 0.2
setObj numUpdates 1000
echo "numLinks =" [getObj numLinks]
# 5148
graphObject error
