polarities_for
cards.polarities_for(metric_ids, registry=None)
Look up the polarity string for each metric id, in order.
A small bridge between the card registry and the MCDA pipeline. The facade beam.mcda.run takes a list of polarity strings, one per column of the score matrix. Rather than hand-type that list (and risk mismatching what the metric card actually says), pass the metric ids through this helper and feed the result to run.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
metric_ids |
Sequence[str] | Ordered list of metric ids matching the columns of the score matrix. | required |
registry |
Registry | None | Optional registry instance. Defaults to a fresh registry over the bundled metrics/ directory. | None |
Returns
| Type | Description |
|---|---|
| list of str | One polarity string per metric id, in the same order. |
Examples
>>> from beam.cards import polarities_for
>>> polarities_for(["ari", "runtime"])
['higher_is_better', 'lower_is_better']