external_measurement
Base class for measurements calculated by external functions.
ExternalMeasurement
Bases: Measurement
Base measurement class when the evaluated function is an external function.
Source code in mlte/measurement/external_measurement.py
16 17 18 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
EXTERNAL_FUNCTION_KEY = 'function'
class-attribute
instance-attribute
Key to store external function used by this measurement.
function = function
instance-attribute
Store the callable function itself.
output_evidence_type = output_evidence_type
instance-attribute
The output Evidence type that calls to evaluate will return.
__call__(*args, **kwargs)
Evaluate a measurement and return values without semantics.
Source code in mlte/measurement/external_measurement.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
__eq__(other)
Test instance for equality.
Source code in mlte/measurement/external_measurement.py
103 104 105 106 107 108 109 110 111 112 | |
__init__(test_case_id=None, output_evidence_type=Opaque, function=None)
Initialize a new ExternalMeasurement measurement.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
test_case_id
|
Optional[str]
|
A unique identifier for the instance |
None
|
output_evidence_type
|
type[Evidence]
|
The type of the Evidence this measurement will return. |
Opaque
|
function
|
Optional[Callable[..., Any]]
|
The function to be used when evaluating. |
None
|
Source code in mlte/measurement/external_measurement.py
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 | |
additional_setup(model)
Optional method to be overriden by subclasses needing additional setup from metadata.
Source code in mlte/measurement/external_measurement.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
generate_metadata()
Returns Measurement metadata with additional info.
Source code in mlte/measurement/external_measurement.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
get_output_type()
Object method with proper results, similar to the class level get_output_type method, which will always return Opaque for this class.
Source code in mlte/measurement/external_measurement.py
99 100 101 | |