constant_distribution
ConstantDistribution
Bases: BaseDistribution
This class represents a constant distribution, a type of statistical distribution where all outcomes are equally likely. A constant distribution is defined by a single value that is returned for all inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
|
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the 'value' argument is negative. |
Example
Create a ConstantDistribution object.
cd = ConstantDistribution(5)
The value attribute can be accessed and updated.
cd.value 5 cd.value = 10 cd.value 10
Source code in emod_api/utils/distributions/constant_distribution.py
get_demographic_distribution_parameters()
Yield the flag and relevant values necessary for setting a demographics constant distribution
Returns:
| Type | Description |
|---|---|
dict
|
a dict of the form: {'flag': X, 'value1': Y, 'value2': Z} |
Source code in emod_api/utils/distributions/constant_distribution.py
set_intervention_distribution(intervention_object, prefix)
Set the distribution parameters to the object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intervention_object
|
ReadOnlyDict
|
|
required |
prefix
|
str
|
|
required |