Yes, that was a bit icky :)
You should be able to use the step() method passing in layernames and
activation values, like:
# estimate curve
network.loadWeightsFromFile(__name__+'.weights')
network.setLearning(0)
global gridRes
_tmpX = pylab.linspace(mn,mx,gridRes)
_tmpY = []
for x in _tmpX:
_tmpY += network.step(input = [float(x)])
pylab.figure(f1.number)
pylab.plot(_tmpX,_tmpY,'--')
I forget what step() will return with one output layer, with one unit, but
this should get you in the ballpark.
-Doug
On Tue, May 8, 2007 4:19 am, belinda thom said:
> 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
>
--
Douglas S. Blank
Associate Professor, Bryn Mawr College
http://cs.brynmawr.edu/~dblank/
Office: 610 526 6501
_______________________________________________
Pyro-users mailing list
[email protected]
http://emergent.brynmawr.edu/mailman/listinfo/pyro-users