src.canns.models.basic¶
Submodules¶
Classes¶
A standard 1D Continuous Attractor Neural Network (CANN) model. |
|
A 1D CANN model that incorporates Spike-Frequency Adaptation (SFA). |
|
A 2D Continuous Attractor Neural Network (CANN) model. |
|
A 2D Continuous Attractor Neural Network (CANN) model with a specific |
|
A full hierarchical network composed of multiple grid modules. |
Package Contents¶
- class src.canns.models.basic.CANN1D(num, tau=1.0, k=8.1, a=0.5, A=10, J0=4.0, z_min=-u.math.pi, z_max=u.math.pi, **kwargs)[source]¶
Bases:
BaseCANN1DA 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 base 1D CANN model.
- Parameters:
num (int) – The number of neurons in the network.
tau (float) – The synaptic time constant, controlling how quickly the membrane potential changes.
k (float) – A parameter controlling the strength of the global inhibition.
a (float) – The half-width of the excitatory connection range. It defines the “spread” of local connections.
A (float) – The magnitude (amplitude) of the external stimulus.
J0 (float) – The maximum connection strength between neurons.
z_min (float) – The minimum value of the feature space (e.g., -pi for an angle).
z_max (float) – The maximum value of the feature space (e.g., +pi for an angle).
**kwargs – Additional keyword arguments passed to the parent BasicModel.
- 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=-u.math.pi, z_max=u.math.pi, m=0.3, **kwargs)[source]¶
Bases:
BaseCANN1DA 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:
- init_state(*args, **kwargs)[source]¶
Initializes the state variables of the model, including the adaptation variable.
- 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.
- m = 0.3¶
- tau_v = 50.0¶
- class src.canns.models.basic.CANN2D(length, tau=1.0, k=8.1, a=0.5, A=10, J0=4.0, z_min=-u.math.pi, z_max=u.math.pi, **kwargs)[source]¶
Bases:
BaseCANN2DA 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 base 2D CANN model.
- Parameters:
length (int) – The number of neurons in one dimension of the network (the network is square).
tau (float) – The synaptic time constant, controlling how quickly the membrane potential changes.
k (float) – A parameter controlling the strength of the global inhibition.
a (float) – The half-width of the excitatory connection range. It defines the “spread” of local connections.
A (float) – The magnitude (amplitude) of the external stimulus.
J0 (float) – The maximum connection strength between neurons.
z_min (float) – The minimum value of the feature space (e.g., -pi for an angle).
z_max (float) – The maximum value of the feature space (e.g., +pi for an angle).
**kwargs – Additional keyword arguments passed to the parent BasicModel.
- 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=-u.math.pi, z_max=u.math.pi, m=0.3, **kwargs)[source]¶
Bases:
BaseCANN2DA 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.
- init_state(*args, **kwargs)[source]¶
Initializes the state variables of the model, including the adaptation variable.
- 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.
- m = 0.3¶
- tau_v = 50.0¶
- 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=u.math.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 * u.math.pi, nonrec_tau=0.1)[source]¶
Bases:
src.canns.models.basic._base.BasicModelGroupA 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.
- place_center¶
The center locations of the place cells.
- Type:
brainunit.math.ndarray
- grid_fr¶
The firing rates of the grid cell population.
- Type:
brainstate.HiddenState
- band_x_fr¶
The firing rates of the x-oriented band cell population.
- Type:
brainstate.HiddenState
- band_y_fr¶
The firing rates of the y-oriented band cell population.
- Type:
brainstate.HiddenState
- place_fr¶
The firing rates of the place cell population.
- Type:
brainstate.HiddenState
- decoded_pos¶
The final decoded 2D position.
- Type:
brainstate.State
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.
- MEC_model_list = []¶
- num_module¶
- num_place¶
- place_center¶