After a great tutorial of NetPyNE done by Salvador Dura I wanted to extend my question from the chat :)
I would like to make a simulation where I will stimulate a network in a closed-loop with external stimulation similar to Reinforcement Learning paradigm.
So let's say I have:
- The network called the Agent
- The Agent is implemented in NetPyNE
- I would like to to simulate the network, on demand in 2 ways: 1) as a regular run for n ms; 2) as the observation run for n ms, during which the Agent receives an external stimulation
- I would like to collect spikes from the output neurons
eg. pseudocode:
Code: Select all
# input (10,10) matrix which means 100 input cells, output -> 2 cells
agent = NetPyNEAgent(input_shape=(10,10), output_shape=2)
while True:
obs = environment.get_observation()
# make a external stimulation and run simulation for 100 ms
agent.observe(observation=obs, time=100)
# run the agent just for 100 ms without stimulation
agent.run(time=100)
# number of output spike
spikes = agent.get_output_spikes()
environment.make_action(spikes)
- The method observe() is the most critical one, since I don't know how to make an external stimulation in NetPyNE
- I have seen only NetPyNE examples where simulation were entirely defined and run without interruption. I don't know how to make run(), stim() and another run()