GaussianProb#
- class brainpy.connect.GaussianProb(sigma, encoding_values=None, normalize=True, include_self=True, periodic_boundary=False, seed=None, **kwargs)[source]#
Builds a Gaussian connectivity pattern within a population of neurons, where the connection probability decay according to the gaussian function.
Specifically, for any pair of neurons \((i, j)\),
\[p(i, j)=\exp(-\frac{\sum_{k=1}^n |v_k^i - v_k^j|^2 }{2\sigma^2})\]where \(v_k^i\) is the \(i\)-th neuron’s encoded value at dimension \(k\).
- Parameters:
sigma (float) – Width of the Gaussian function.
encoding_values (optional, list, tuple, int, float) –
The value ranges to encode for neurons at each axis.
If values is not provided, the neuron only encodes each positional information, i.e., \((i, j, k, ...)\), where \(i, j, k\) is the index in the high-dimensional space.
If values is a single tuple/list of int/float, neurons at each dimension will encode the same range of values. For example,
values=(0, np.pi)
, neurons at each dimension will encode a continuous value space[0, np.pi]
.If values is a tuple/list of list/tuple, it means the value space will be different for each dimension. For example,
values=((-np.pi, np.pi), (10, 20), (0, 2 * np.pi))
.
periodic_boundary (bool) – Whether the neuron encode the value space with the periodic boundary.
normalize (bool) – Whether normalize the connection probability .
include_self (bool) – Whether create the connection at the same position.
seed (int) – The random seed.
- build_mat(isOptimized=True)[source]#
Build a binary matrix connection data.
If users want to customize their connections, please provide one of the following functions:
build_mat()
: build a matrix binary connection matrix.build_csr()
: build a csr sparse connection data.build_coo()
: build a coo sparse connection data.build_conn()
: deprecated.
- Returns:
conn – A binary matrix with the shape
(num_pre, num_post)
.- Return type: