metric
Metric
Bases: Named
, Protocol
Minimal template for metrics.
Call flow
call -> prepare(true), prepare(predicted) -> compute(true, predicted)
prepare(data)
Hook to normalize/collect/select data before computing metric.
Default: identity. Mixins override and call super().prepare(...)
Source code in src/flowcean/core/metric.py
25 26 27 28 29 30 |
|
__call__(true, predicted)
Execute metric: prepare inputs then compute.
Source code in src/flowcean/core/metric.py
36 37 38 39 40 41 42 43 |
|
compute(true, predicted)
Implement metric logic on prepared inputs.
Source code in src/flowcean/core/metric.py
45 46 47 48 49 |
|
ActiveMetric
Bases: Named
, Protocol
Base class for metrics for active environments.
__call__(observations, actions)
abstractmethod
Calculate the metric value based on the observations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
observations
|
list[Observation]
|
list of observations of the environment |
required |
actions
|
list[Action]
|
list of actions of the learner |
required |
Returns:
Type | Description |
---|---|
Reportable | dict[str, Reportable]
|
Metric value |
Source code in src/flowcean/core/metric.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|