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 27 28 29 30 31 32 33 | import numpy as np import matplotlib.pyplot as plt %matplotlib inline import nengo from nengo.dists import Uniform model = nengo.Network(label='Many Neurons') with model: A = nengo.Ensemble(100, dimensions=1) sin = nengo.Node(lambda t: np.sin(8 * t)) nengo.Connection(sin, A, synapse=0.01) sin_probe = nengo.Probe(sin) A_probe = nengo.Probe(A, synapse=0.01) # 10ms filter A_spikes = nengo.Probe(A.neurons) with nengo.Simulator(model) as sim: sim.run(1) from nengo.utils.matplotlib import rasterplot # Plot the decoded output of the ensemble plt.figure() plt.plot(sim.trange(), sim.data[A_probe], label="A output") plt.plot(sim.trange(), sim.data[sin_probe], 'r', label="Input") plt.xlim(0, 1) plt.legend() # Plot the spiking output of the ensemble plt.figure() rasterplot(sim.trange(), sim.data[A_spikes]) plt.xlim(0, 1); | cs |
'Deep Learning Tools > Nengo' 카테고리의 다른 글
Nengo 음성 데이터를 neural network에 입력으로 넣기 (0) | 2018.11.07 |
---|---|
Nengo neuron에 특정한 값 input으로 넣기 (0) | 2018.11.06 |
Nengo로 구현하는 MNIST CNN spiking neural network 예제 (5) | 2018.10.26 |
Nengo tutorial - neuron 만들기 예제 (0) | 2018.10.26 |
Nengo Python 환경설정 (0) | 2018.10.23 |