domain
Continuous(feature_name, min_value, max_value, *, distribution='uniform', mean=None, stddev=None)
Bases: Domain
A domain of continuous values.
This domain describes a continuous distribution of values between a minimum and maximum value for a feature.
Initialize the uniform feature domain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_name
|
str
|
The name of the feature the domain belongs to. |
required |
min_value
|
float
|
The minimum value of the domain. |
required |
max_value
|
float
|
The maximum value of the domain. |
required |
distribution
|
Distribution
|
The distribution of values inside the domain. Can be either "uniform" or "normal". Defaults to "uniform". |
'uniform'
|
mean
|
float | None
|
The mean of the normal distribution. Required if distribution is "normal". |
None
|
stddev
|
float | None
|
The standard deviation of the normal distribution. Required if distribution is "normal". |
None
|
Source code in src/flowcean/core/tool/testing/domain/continuous.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
get_value()
Get a random value from the domain.
Returns:
Type | Description |
---|---|
float
|
A random value uniformly distributed between min_value and |
float
|
max_value. |
Source code in src/flowcean/core/tool/testing/domain/continuous.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
to_discrete(sampling_distance)
Discretize the continuous domain into a discrete domain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sampling_distance
|
float
|
The distance between two discrete values. |
required |
Returns:
Type | Description |
---|---|
Discrete
|
A discrete domain with the same feature name and a list of |
Discrete
|
uniformly distributed values. |
Source code in src/flowcean/core/tool/testing/domain/continuous.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
Discrete(feature_name, values)
Bases: Domain
, Iterable[tuple[str, float]]
A domain of discrete values.
This domain describes a discrete set of values for a feature.
Initialize the discrete domain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_name
|
str
|
The name of the feature the domain belongs to. |
required |
values
|
list[float]
|
The list of values of the domain. |
required |
Source code in src/flowcean/core/tool/testing/domain/discrete.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
__len__()
Get the number of discrete values in the domain.
Returns:
Type | Description |
---|---|
int
|
The number of discrete values in the domain. |
Source code in src/flowcean/core/tool/testing/domain/discrete.py
31 32 33 34 35 36 37 |
|
get_value()
Get a random value from the domain.
Source code in src/flowcean/core/tool/testing/domain/discrete.py
39 40 41 |
|
__iter__()
Iterate over the values of the range.
Source code in src/flowcean/core/tool/testing/domain/discrete.py
46 47 48 49 |
|
Domain(feature_name)
Bases: ABC
An abstract base class for describing the value domain for a feature.
Initialize the domain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_name
|
str
|
The name of the feature the domain belongs to. |
required |
Source code in src/flowcean/core/tool/testing/domain/domain.py
9 10 11 12 13 14 15 16 17 18 |
|
get_value()
abstractmethod
Get a random value from the domain for the feature.
Source code in src/flowcean/core/tool/testing/domain/domain.py
20 21 22 |
|
__call__()
Get a random value from the domain for the feature.
Source code in src/flowcean/core/tool/testing/domain/domain.py
24 25 26 |
|
set_seed(seed)
Set the seed for the random number generator.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
seed
|
int
|
The seed to set. |
required |
Source code in src/flowcean/core/tool/testing/domain/domain.py
28 29 30 31 32 33 34 35 36 37 38 |
|
Fixed(feature_name, value)
Bases: Discrete
A domain with a single value.
This domain contains a single fixed value for a feature.
Initialize the fixed domain.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_name
|
str
|
The name of the feature the domain belongs to. |
required |
value
|
float
|
The fixed value to return. |
required |
Source code in src/flowcean/core/tool/testing/domain/fixed.py
10 11 12 13 14 15 16 17 |
|
get_value()
Get the fixed value.
Source code in src/flowcean/core/tool/testing/domain/fixed.py
19 20 21 |
|