SAModel
- class spikeometric.models.SAModel[source]
Bases:
spikeometric.models.base_model.BaseModelThe Synaptic Activation model (SAModel) is a base model for models that use the synaptic activation as the state of the network and has an update rule for based on previous synaptic activation and spikes.
In addition to the input, non_linearity and emit_spikes methods, SAModels must implement the update_activation method.
- simulate(data: torch_geometric.data.data.Data, n_steps: int, verbose: bool = True, equilibration_steps: int = 100, store_as_dtype: torch.dtype = torch.int32)[source]
Simulates the network for n_steps time steps given the connectivity. Returns the state of the network at each time step.
- Parameters
data (torch_geometric.data.Data) – The data containing the connectivity.
n_steps (int) – The number of time steps to simulate
verbose (bool) – If True, a progress bar is shown
equilibration (int) – The number of time steps to simulate before starting to record the state of the network.
store_as_dtype (torch.dtype) – The dtype to store the state of the network
- Returns
x – The state of the network at each time step. The state is a binary tensor where 1 means that the neuron is active.
- Return type
torch.Tensor[n_neurons, n_steps]
- tune(data, firing_rate, tunable_parameters='all', lr=0.1, n_steps=100, n_epochs=100, verbose=True)[source]
Tunes the model parameters to match a desired firing rate.
- Parameters
data (torch_geometric.data.Data) – The training data containing the connectivity.
firing_rate (torch.Tensor) – The target firing rate of the network
tunable_parameters (list or str) – The list of parameters to tune, can be “all”, “stimulus”, “model” or a list of parameter names
lr (float) – The learning rate
n_steps (int) – The number of time steps to simulate for each epoch
n_epochs (int) – The number of epochs
verbose (bool) – If True, a progress bar is shown
- equilibrate(edge_index: torch.Tensor, W: torch.Tensor, initial_state: torch.Tensor, n_steps=100, store_as_dtype: torch.dtype = torch.int32) torch.Tensor[source]
Equilibrate the network to a given connectivity matrix.
- Parameters
edge_index (torch.Tensor) – The connectivity of the network
W (torch.Tensor) – The connectivity filter
initial_state (torch.Tensor) – The initial state of the network
n_steps (int) – The number of time steps to equilibrate for
store_as_dtype (torch.dtype) – The dtype to store the state of the network as
- Returns
x – The state of the network at each time step
- Return type
torch.Tensor