Beta

Contents

Beta#

class braintools.init.Beta(alpha, beta, low, high, unit=None)#

Beta distribution initialization (rescaled to desired range).

Generates values from a beta distribution and rescales them to [low, high].

Parameters:
  • alpha (float) – Alpha shape parameter (must be > 0).

  • beta (float) – Beta shape parameter (must be > 0).

  • low (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Lower bound of the output range.

  • high (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Upper bound of the output range.

Examples

>>> import numpy as np
>>> import brainunit as u
>>> from braintools.init import Beta
>>>
>>> init = Beta(alpha=2.0, beta=5.0, low=0.0 * u.siemens, high=1.0 * u.siemens)
>>> rng = np.random.default_rng(0)
>>> weights = init(1000, rng=rng)