predicate
Predicate
Bases: ABC
Base class for predicates.
A predicate is a function that takes the prediction of an model and returns a boolean value indicating whether the prediction satisfies a certain condition. Predicates can be combined using logical operators (AND, OR, NOT) to create more complex predicates.
__call__(input_data, prediction)
abstractmethod
Evaluate the predicate on a model prediction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_data
|
Data
|
The input data used to generate the prediction. |
required |
prediction
|
Data
|
The prediction to evaluate. |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if the prediction satisfies the predicate, False otherwise. |
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
15 16 17 18 19 20 21 22 23 24 25 26 |
|
__and__(other)
Combine two predicates with a logical AND operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Predicate
|
The other predicate to combine with. |
required |
Returns:
Name | Type | Description |
---|---|---|
Predicate |
AndPredicate
|
A new predicate that is the logical AND of this and other. |
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
28 29 30 31 32 33 34 35 36 37 38 |
|
__or__(other)
Combine two predicates with a logical OR operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
Predicate
|
The other predicate to combine with. |
required |
Returns:
Name | Type | Description |
---|---|---|
Predicate |
OrPredicate
|
A new predicate that is the logical OR of this and other. |
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
40 41 42 43 44 45 46 47 48 49 50 |
|
__invert__()
Negate the predicate.
Returns:
Name | Type | Description |
---|---|---|
Predicate |
NotPredicate
|
A new predicate that is the negation of the original. |
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
52 53 54 55 56 57 58 |
|
AndPredicate(*predicates)
Bases: Predicate
Combine multiple predicates with a logical AND operation.
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
64 65 |
|
OrPredicate(*predicates)
Bases: Predicate
Combine multiple predicates with a logical OR operation.
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
76 77 |
|
NotPredicate(predicate)
Bases: Predicate
Negate a predicate.
Source code in src/flowcean/core/tool/testing/predicates/predicate.py
88 89 |
|