simet.parser.simple.metric¶
simet.parser.simple.metric ¶
MetricType ¶
Bases: StrEnum
Enum of supported metric identifiers (string-valued).
Values
FID: Frechet Inception Distance. PRECISIONRECALL: Precision/Recall in feature space. ROCAUC: ROC AUC score.
Notes
StrEnum(Python 3.11+) ensures enum values are strings, so they can be compared directly to input strings.
get_metric
staticmethod
¶
get_metric(metric_type)
Construct a metric instance for the given MetricType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric_type
|
MetricType
|
Enum value indicating which metric to build. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Metric |
Metric
|
An instance of the corresponding metric implementation. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the metric type is unknown (logged and re-raised). |
Source code in simet/parser/simple/metric.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
SimpleMetricParser ¶
Factory wrapper that instantiates metric objects from strings.
Converts a user-provided metric name into a MetricType enum and delegates
to MetricType.get_metric(...) to construct the corresponding metric
instance.
Example
SimpleMetricParser.parse_metric("FID").class.name 'FID' SimpleMetricParser.parse_metric("PrecisionRecall").class.name 'PrecisionRecall'
parse_metric
staticmethod
¶
parse_metric(metric)
Parse a metric name and return a concrete metric instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metric
|
str
|
Case-sensitive name matching |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Metric |
Metric
|
An instance of the corresponding metric class |
Metric
|
(e.g., |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in simet/parser/simple/metric.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |