Ablating neurons¶
These examples emulate the ablation of neurons by setting the encoders of those neurons to 0, and setting the bias of those neurons to a large negative number.
The function of interest is:
def ablate_ensemble(ens, proportion, sim, bias=True):
"""Ablate a proportion of the neurons in an ensemble.
The ablation is done by setting the encoder and gain associated
with a neuron to zero. Since no input current being injected,
the neuron will generally be silent. However, if there is direct
current injected with a neuron-to-neuron connection, then the
cell may still fire. To counter that in most cases, we set the
bias associated with the neuron to a large negative value.
"""
n_neurons = min(int(ens.n_neurons * proportion), ens.n_neurons)
idx = np.random.choice(np.arange(ens.n_neurons), replace=False, size=n_neurons)
encoder_sig = sim.signals[sim.model.sig[ens]['encoders']]
encoder_sig.setflags(write=True)
encoder_sig[idx] = 0.0
encoder_sig.setflags(write=False)
if bias:
bias_sig = sim.signals[sim.model.sig[ens.neurons]['bias']]
bias_sig.setflags(write=True)
bias_sig[idx] = -1000
Examples¶
The follow examples show how this can be applied in a simple model and a more complicated SPA model.
Requirements¶
License¶
Copyright (c) 2017-2022 Applied Brain Research
These examples are made available under a proprietary license that permits using, copying, sharing, and making derivative works for any non-commercial purpose, as long as the above copyright notice and this permission notice are included in all copies or substantial portions of the software.
If you would like to use these examples commercially, licenses can be purchased from Applied Brain Research. Please contact info@appliedbrainresearch.com for more information.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.