Connection Weight Distributions

When creating a projection, you can specify the distribution from which the connection weights are drawn in the projection spec, using the dist parameter. Here is an example of adding a projection to the network net, from the layer named "input" to the layer named "output", with all weights set to the scalar value 0.6.

import leabra7 as lb

net.new_projn(name="input_to_output",
              pre="input",
              post="output",
              spec=lb.ProjnSpec(dist=lb.Scalar(0.6)))

Below is a list of all supported distributions:

class leabra7.Scalar(value: float)

A scalar “distribution” (i.e. a constant).

Parameters:value – The value of the scalar.
class leabra7.Uniform(low: float, high: float)

A uniform distribution.

Parameters:
  • low – The lower bound of the distribution’s interval, inclusive.
  • high – The upper bound of the distribution’s interval, inclusive.
Raises:

ValueError – If low > high.

class leabra7.Gaussian(mean: float, var: float)

A Gaussian distribution.

Parameters:
  • mean – The mean of the distribution.
  • var – The variance of the distribution.
Raises:

ValueError – If var is negative.

class leabra7.LogNormal(mean: float, var: float)

A lognormal distribution. The parameters mean and var are for the unique Gaussian random variable \(X\) such that \(Y = e^X\), where \(Y\) is the lognormal random variable.

Parameters:
  • mean – The mean of \(X\).
  • var – The variance of \(X\).
Raises:

ValueError – If var is negative.

class leabra7.Exponential(lambd: float)

An exponential distribution.

Parameters:lambd – The distribution’s rate parameter \(\lambda\). If \(\mu\) is the mean, then \(\lambda = 1 / \mu\).