2.1.2.4. enkie.distributions

Descriptions of probability distributions.

2.1.2.4.1. Module Contents

class enkie.distributions.UniformDistribution(lb: float = 0.0, ub: float = 1.0)[source]

Uniform distribution in a given interval.

Parameters:
  • lb (float, optional) – Lower bound of the interval, by default 0.0

  • ub (float, optional) – Upper bound of the interval, by default 1.0

property lb: float[source]

Gets the lower bound of the distribution.

property ub: float[source]

Gets the upper bound of the distribution.

copy() UniformDistribution[source]

Creates a copy of this object.

Returns:

Copy of this object.

Return type:

UniformDistribution

class enkie.distributions.NormalDistribution(mean: float = 0.0, std: float = 1.0)[source]

Normal distribution with given mean and standard deviation.

Parameters:
  • mean (float, optional) – Mean of the distribution, by default 0.0

  • std (float, optional) – Standard deviation, by default 1.0

property mean: float[source]

Gets the mean of the distribution.

property std: float[source]

Gets the standard deviation of the distribution.

copy()[source]

Creates a copy of this object.

Returns:

Copy of this object.

Return type:

NormalDistribution

class enkie.distributions.LogUniformDistribution(lb: float = 0.0, ub: float = 1.0)[source]

Log-uniform distribution in a given interval.

Parameters:
  • lb (float, optional) – Lower bound of the interval, by default 0.0

  • ub (float, optional) – Upper bound of the interval, by default 1.0

property lb: float[source]

Gets the lower bound of the distribution.

property ub: float[source]

Gets the upper bound of the distribution.

copy()[source]

Creates a copy of this object.

Returns:

Copy of this object.

Return type:

LogUniformDistribution

class enkie.distributions.LogNormalDistribution(log_mean: float = 0.0, log_std: float = 1.0)[source]

Log-normal distribution with given mean and standard deviation.

Parameters:
  • log_mean (float, optional) – Natural logarithm of the mean of the distribution, by default 0.0

  • log_std (float, optional) – Standard deviation of the distribution on the log scale, by default 1.0

property log_mean: float[source]

Gets the log-mean of the distribution.

property log_std: float[source]

Gets the log-standard deviation of the distribution.

copy()[source]

Creates a copy of this object.

Returns:

Copy of this object.

Return type:

LogNormalDistribution

enkie.distributions.distribution_from_string(parameters_string: str) Any[source]

Parses a distribution from a string. The format of the string is <distribution>|<data1>|<…>, where distribution is the type of the distribution and the remaining elements the arguments of the constructor of the distribution. For example, “Uniform|1.0|2.0”.

Parameters:

parameters_string (str) – String describing the distribution.

Returns:

The constructed distribution object.

Return type:

Any

Raises:

Exception – If the type of the distribution is not recognized.

enkie.distributions.distribution_to_string(distribution: Any) str[source]

Encodes a distribution in a string. The format of the string is <distribution>|<data1>|<…>, where distribution is the type of the distribution and the remaining elements the arguments of the constructor of the distribution. For example, “Uniform|1.0|2.0”.

Parameters:

distribution (Any) – Distribution object to be converted.

Returns:

String describing the distribution.

Return type:

str

Raises:

Exception – If the specified distribution is not supported by this method.