Kernel: Python 3
context
.random_weight(params)
Generate a random weight.
Arguments:
params
: a string that controls the random generation of the weight such asmin
andmax
range value, or elements of the weightset with associated densities.
See also:
Examples
In [1]:
In [2]:
[-404620562, -133711905, -1579004998, -1944672731, -1946129057, -15198492, 676943009, -81133257, 2084672536, 1275731771]
Densities associated with elements form a Bernoulli distribution with the rest of the weightset's elements.
For example, here "0
" has 1 in 2 chances to appear, otherwise a uniform distribution is performed on the weightSet, in the range [0-10].
In [3]:
[0, 9, 8, 0, 0, 0, 0, 0, 2, 0, 0, 7, 1, 0, 0, 8, 0, 8, 8, 0]