Hi Doug,
A while ago we talked about giving networks named inputs and outputs
for training and propagation. You mentioned this was implemented, but
I've been having problems using this feature.
As a test I've tried creating a network for simulating a simple
logical AND. The two inputs are named 'a' and 'b', and the output is
named 'f'. Below is my sample code, and the error it generates. Am I
using this feature correctly?
Regards,
Chris
from pyrobot.brain.conx import *
# create network
net = Network()
# create layers
net.addLayer('a', 1)
net.addLayer('b', 1)
net.addLayer('f', 1)
net.connect('a', 'f')
net.connect('b', 'f')
# set patterns
patterns = [
[dict(a=0.0, b=0.0), dict(f=0.0)],
[dict(a=0.0, b=1.0), dict(f=0.0)],
[dict(a=0.0, b=0.0), dict(f=0.0)],
[dict(a=0.0, b=0.0), dict(f=1.0)],
]
net.setInputsAndTargets(patterns)
# set learning parameters
net.setEpsilon(0.5)
net.setTolerance(0.2)
net.setReportRate(1)
# learn
net.train()
Conx, version 1.229 (regular speed)
Conx using seed: 1164933601.75
Traceback (most recent call last):
File "C:\Documents and Settings\TEMP\Desktop\nntest.py", line 37, in ?
net.train()
File "C:\Program
Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1685, in
train
(tssErr, totalCorrect, totalCount, totalPCorrect) = self.sweep()
File "C:\Program
Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1820, in
sweep
(error, correct, total, pcorrect) = self.step( **datum )
File "C:\Program
Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1752, in
step
self.propagate(**args)
File "C:\Program
Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1964, in
propagate
self.copyActivations(layer, args[key])
File "C:\Program
Files\Python24\lib\site-packages\pyrobot\brain\conx.py", line 1415, in
copyActivations
layer.copyActivations(vector[start:start+layer.size])
TypeError: unsubscriptable object
_______________________________________________
Pyro-users mailing list
[email protected]
http://emergent.brynmawr.edu/mailman/listinfo/pyro-users