Distance dependent structural plasticity #3369
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces new functionality to handle distance-dependent connection probabilities in the
SPManager
class. The following methods have been added or modified:New Features
gather_global_positions_and_ids()
Collects and verifies global neuron positions and IDs.
Ensures that neurons are spatially distributed, raising an error if positions are undefined while distance dependency is enabled.
gaussian_kernel()
Computes a probability based on the Gaussian distance kernel between two neuron positions.
build_probability_list()
Constructs a probability list for all neuron pairs based on their spatial positions.
Supports caching for efficient repeated lookups.
get_neuron_pair_index()
Maps two neuron IDs to a unique index for accessing pair-specific probabilities in the
probability_list
.global_shuffle_spatial()
Implements distance-dependent shuffling for pairing neurons based on spatial proximity and probability.
roulette_wheel_selection()
Performs a weighted random selection of post-synaptic neurons based on precomputed probabilities.
Modified Methods
enable_structural_plasticity()
Integrates calls to
gather_global_positions_and_ids()
andbuild_problist()
when distance dependency is enabled.Distance-Dependent Features
Enable Distance Dependency
Distance dependency can be enabled by setting
structural_plasticity_gaussian_kernel_sigma
to a positive value. This parameter controls the width of the Gaussian kernel used for connection probabilities. Higher values result in reduced sensitivity to distance, making distant neurons more likely to connect.Caching Connection Probabilities
If
structural_plasticity_cache_probabilities
is set totrue
, connection probabilities will be precomputed and cached. This can improve performance, particularly in long-running simulations.Testing
The following tests have been added to validate the new functionality:
C++ Tests:
test_gaussian_kernel
Tests Gaussian kernel computations for various distances and sigma values.
test_get_neuron_pair_index
Confirms correct mapping of neuron pairs to unique indices.
test_global_shuffle_spatial
Validates spatially aware shuffling logic.
Ensures connections favor spatial proximity and prevent self-connections.
Python Tests:
test_distance_dependent_without_positions()
Ensures an error is raised when distance dependency is enabled, but positions are not provided.
test_gaussian_kernel()
Tests probability computation using Gaussian distance dependency.
test_probability_list_building()
Verifies the correct initialization and population of the probability list.
test_roulette_wheel_selection()
Confirms that weighted random selection behaves as expected.
test_structural_plasticity_with_positions()
Ensures structural plasticity works correctly when neuron positions are defined.
test_synapse_creation_distance_dependent()
Validates distance-dependent synapse formation using position data.
Related Issue:
Incorporate Distance-Dependent Connection Probability in Structural Plasticity Module #3209