Hi,
I'm writing today because I'm afraid I've made something more
complicated than it needs to be.
I have successfully trained a network using cross validation (wrote
my own train method loosely using some of Lisa's examples so I could
control the termination conditions very finely). Now I want to
display what's learned (its a 1-d input, fitting a polynomial, with a
1-d output and several hidden units) in the form of a curve. But I
wasn't sure the easiest way to propagate a bunch of new values
through the net.
Here's what I ended up using. Its pretty icky; I'd have liked a "test
network with these inputs" function, but couldn't find one. Any tips
greatly appreciated.
Thx,
--b
# estimate curve
network.loadWeightsFromFile(__name__+'.weights')
network.setLearning(0)
network.setOrderedInputs(True)
global gridRes
_tmpX = pylab.linspace(mn,mx,gridRes)
tmpX = [[float(x)] for x in _tmpX]
tmpY = [[0.0] for x in _tmpX] # some bogus thing so we can
sweep
network.setInputs(tmpX)
network.setOutputs(tmpY) # w/o same number of targets, can't
sweep
for layer in network.layers :
name = layer.name
network.logLayer(name,__name__+'.est.'+name+'s')
network.sweep()
for layer in network.layers :
name = layer.name
network.closeLog(name)
_tmpY = []
try :
f = open(__name__+'.est.outputs')
for line in f :
o = float(line)
_tmpY += [o]
f.close()
except:
assert False, "bogus"
pylab.figure(f1.number)
pylab.plot(_tmpX,_tmpY,'--')
_______________________________________________
Pyro-users mailing list
[email protected]
http://emergent.brynmawr.edu/mailman/listinfo/pyro-users