src.canns.models.basic

Submodules

Classes

CANN1D

A standard 1D Continuous Attractor Neural Network (CANN) model.

CANN1D_SFA

A 1D CANN model that incorporates Spike-Frequency Adaptation (SFA).

CANN2D

A 2D Continuous Attractor Neural Network (CANN) model.

CANN2D_SFA

A 2D Continuous Attractor Neural Network (CANN) model with a specific

HierarchicalNetwork

A full hierarchical network composed of multiple grid modules.

Package Contents

class src.canns.models.basic.CANN1D(*args, **kwargs)[source]

Bases: BaseCANN1D

A standard 1D Continuous Attractor Neural Network (CANN) model. This model implements the core dynamics where a localized “bump” of activity can be sustained and moved by external inputs.

Reference:

Wu, S., Hamaguchi, K., & Amari, S. I. (2008). Dynamics and computation of continuous attractors. Neural computation, 20(4), 994-1025.

Initializes the 1D CANN model.

Parameters:

BaseCANN1D) ((Parameters are inherited from)

update(inp)[source]

The main update function, defining the dynamics of the network for one time step.

Parameters:

inp (Array) – The external input for the current time step.

inp
r
u
class src.canns.models.basic.CANN1D_SFA(num, tau=1.0, tau_v=50.0, k=8.1, a=0.3, A=0.2, J0=1.0, z_min=-bm.pi, z_max=bm.pi, m=0.3, **kwargs)[source]

Bases: BaseCANN1D

A 1D CANN model that incorporates Spike-Frequency Adaptation (SFA). SFA is a slow negative feedback mechanism that causes neurons to fire less over time for a sustained input, which can induce anticipative tracking behavior.

Reference:

Mi, Y., Fung, C. C., Wong, K. Y., & Wu, S. (2014). Spike frequency adaptation implements anticipative tracking in continuous attractor neural networks. Advances in neural information processing systems, 27.

Initializes the 1D CANN model with SFA.

Parameters:
  • tau_v (float) – The time constant for the adaptation variable ‘v’. A larger value means slower adaptation.

  • m (float) – The strength of the adaptation, coupling the membrane potential ‘u’ to the adaptation variable ‘v’.

  • BaseCANN1D) ((Other parameters are inherited from)

update(inp)[source]

The main update function for the SFA model. It includes dynamics for both the membrane potential and the adaptation variable.

Parameters:

inp (Array) – The external input for the current time step.

inp
m = 0.3
r
tau_v = 50.0
u
v
class src.canns.models.basic.CANN2D(*args, **kwargs)[source]

Bases: BaseCANN2D

A 2D Continuous Attractor Neural Network (CANN) model. This model extends the base CANN2D class to include specific dynamics and properties for a 2D neural network.

Reference:

Wu, S., Hamaguchi, K., & Amari, S. I. (2008). Dynamics and computation of continuous attractors. Neural computation, 20(4), 994-1025.

Initializes the 2D CANN model.

Parameters:

BaseCANN2D) ((Parameters are inherited from)

update(inp)[source]

The main update function, defining the dynamics of the network for one time step.

Parameters:

inp (Array) – The external input to the network, which can be a stimulus or other driving force.

inp
r
u
class src.canns.models.basic.CANN2D_SFA(length, tau=1.0, tau_v=50.0, k=8.1, a=0.3, A=0.2, J0=1.0, z_min=-bm.pi, z_max=bm.pi, m=0.3, **kwargs)[source]

Bases: BaseCANN2D

A 2D Continuous Attractor Neural Network (CANN) model with a specific implementation of the Synaptic Firing Activity (SFA) dynamics. This model extends the base CANN2D class to include SFA-specific dynamics.

Initializes the 2D CANN model with SFA dynamics.

update(inp)[source]

The main update function for the SFA model. It includes dynamics for both the membrane potential and the adaptation variable.

Parameters:

inp (Array) – The external input for the current time step.

inp
m = 0.3
r
tau_v = 50.0
u
v
class src.canns.models.basic.HierarchicalNetwork(num_module, num_place, spacing_min=2.0, spacing_max=5.0, module_angle=0.0, band_size=180, band_noise=0.0, band_w_L2S=0.2, band_w_S2L=1.0, band_gain=0.2, grid_num=20, grid_tau=0.1, grid_tau_v=10.0, grid_k=0.005, grid_a=bm.pi / 9, grid_A=1.0, grid_J0=1.0, grid_mbar=1.0, gauss_tau=1.0, gauss_J0=1.1, gauss_k=0.0005, gauss_a=2 / 9 * bm.pi, nonrec_tau=0.1)[source]

Bases: src.canns.models.basic._base.BasicModelGroup

A full hierarchical network composed of multiple grid modules.

This class creates and manages a collection of HierarchicalPathIntegrationModel modules, each with a different grid spacing. By combining the outputs of these modules, the network can represent position unambiguously over a large area. The final output is a population of place cells whose activities are used to decode the animal’s estimated position.

num_module

The number of grid modules in the network.

Type:

int

num_place

The number of place cells in the output layer.

Type:

int

place_center

The center locations of the place cells.

Type:

bm.math.ndarray

MEC_model_list

A list containing all the HierarchicalPathIntegrationModel instances.

Type:

list

grid_fr

The firing rates of the grid cell population.

Type:

bm.Variable

band_x_fr

The firing rates of the x-oriented band cell population.

Type:

bm.Variable

band_y_fr

The firing rates of the y-oriented band cell population.

Type:

bm.Variable

place_fr

The firing rates of the place cell population.

Type:

bm.Variable

decoded_pos

The final decoded 2D position.

Type:

bm.Variable

References

Anonymous Author(s) “Unfolding the Black Box of Recurrent Neural Networks for Path Integration” (under review).

Initializes the HierarchicalNetwork.

Parameters:
  • num_module (int) – The number of grid modules to create.

  • num_place (int) – The number of place cells along one dimension of a square grid.

  • spacing_min (float, optional) – Minimum spacing for grid modules. Defaults to 2.0.

  • spacing_max (float, optional) – Maximum spacing for grid modules. Defaults to 5.0.

  • module_angle (float, optional) – Base orientation angle for all modules. Defaults to 0.0.

  • band_size (int, optional) – Number of neurons in each BandCell group. Defaults to 180.

  • band_noise (float, optional) – Noise level for BandCells. Defaults to 0.0.

  • band_w_L2S (float, optional) – Weight from band cells to shifter units. Defaults to 0.2.

  • band_w_S2L (float, optional) – Weight from shifter units to band cells. Defaults to 1.0.

  • band_gain (float, optional) – Gain factor for velocity signal in BandCells. Defaults to 0.2.

  • grid_num (int, optional) – Number of neurons per dimension for GridCell. Defaults to 20.

  • grid_tau (float, optional) – Synaptic time constant for GridCell. Defaults to 0.1.

  • grid_tau_v (float, optional) – Adaptation time constant for GridCell. Defaults to 10.0.

  • grid_k (float, optional) – Global inhibition strength for GridCell. Defaults to 5e-3.

  • grid_a (float, optional) – Connection width for GridCell. Defaults to pi/9.

  • grid_A (float, optional) – External input magnitude for GridCell. Defaults to 1.0.

  • grid_J0 (float, optional) – Maximum connection strength for GridCell. Defaults to 1.0.

  • grid_mbar (float, optional) – Base adaptation strength for GridCell. Defaults to 1.0.

  • gauss_tau (float, optional) – Time constant for GaussRecUnits in BandCells. Defaults to 1.0.

  • gauss_J0 (float, optional) – Connection strength scaling for GaussRecUnits. Defaults to 1.1.

  • gauss_k (float, optional) – Global inhibition for GaussRecUnits. Defaults to 5e-4.

  • gauss_a (float, optional) – Connection width for GaussRecUnits. Defaults to 2/9*pi.

  • nonrec_tau (float, optional) – Time constant for NonRecUnits in BandCells. Defaults to 0.1.

update(velocity, loc, loc_input_stre=0.0)[source]
MEC_model_list = []
band_x_fr
band_y_fr
decoded_pos
grid_fr
num_module
num_place
place_center
place_fr