Lesioning or perturbing existing network


I’m new to Nengo and I’m wondering if it’s possible to lesion existing neural networks. Specifically, if I define a network can I then randomly destroy some percentage of the synapses or neurons and see how it impacts the performance in some task?


I put together an example that does this for ensembles: nengo-examples/ablate

I believe it will only work on the normal Nengo core backend and not on other backends like NengoDL. It is likely possible to do this on most if not all backends, but it will have to be implemented separately for each backend.

Also, something similar is definitely possible for connections (i.e., synapses), but I haven’t had time to add that to the example yet. Perhaps someone else on the forum can suggest a similar ablate function for connections!

1 Like

Thanks! Is there a way to do this in the nengo gui? I have some code that runs in the gui, so my understanding is I cannot construct my own Simulator, but I see the ablation function here requires a Simulator.

There is currently an under-documented hooks system in the latest version of NengoGUI (0.47.0). You can use the on_start hook to get access to the simulator object and run the ablation function.

I have not done it myself, but I believe the way that you use it is like this:

# Create your model as usual, but do not construct a nengo.Simulator

# Then at the bottom of your model, add in this:
def on_start(sim):
    print("Ablating ensemble...")
    ablate_ensemble(ens, 0.01, sim)

The print statement there isn’t necessary, but I thought it would be useful to ensure that you are indeed running this hook function when you start the simulation in the GUI.

1 Like