Distribution

class negmas.helpers.Distribution(dtype: str, **kwargs)[source]

Bases: object

Any distribution from scipy.stats with overloading of addition and multiplication.

Parameters
  • dtype (str) – Data type of the distribution as a string. It must be one defined in scipy.stats

  • loc (float) – The location of the distribution (corresponds to mean in Gaussian)

  • scale (float) – The _scale of the distribution (corresponds to standard deviation in Gaussian)

  • multipliers – An iterable of other distributon to multiply with this one

  • adders – An iterable of other utility_priors to add to this one

  • **kwargs

Examples

>>> d2 = Distribution('uniform')
>>> print(d2.mean())
0.5
>>> try:
...     d = Distribution('something crazy')
... except ValueError as e:
...     print(str(e))
Unknown distribution something crazy

Attributes Summary

loc

scale

Methods Summary

around([value, range, uncertainty])

Generates a uniform distribution around the input value in the given range with given uncertainty

max()

mean()

min()

prob(val)

Returns the probability for the given value

sample([size])

Attributes Documentation

loc
scale

Methods Documentation

classmethod around(value: float = 0.5, range: Tuple[float, float] = (0.0, 1.0), uncertainty: float = 0.5)negmas.helpers.Distribution[source]

Generates a uniform distribution around the input value in the given range with given uncertainty

Parameters
  • value – The value to generate the distribution around

  • range – The range of possible values

  • uncertainty – The uncertainty level required. 0.0 means no uncertainty and 1.0 means full uncertainty

Returns

Distribution A uniform distribution around value with uncertainty (scale) uncertainty

max()[source]
mean()float[source]
min()[source]
prob(val: float)float[source]

Returns the probability for the given value

sample(size: int = 1)numpy.ndarray[source]