Metric

class Metric(metric_fn: Callable[[...], float], mode: str = MetricAggregationMode.per_segment, **kwargs)[source]

Bases: etna.core.mixins.BaseMixin

Base class for all the multi-segment metrics.

How it works: Metric computes metric_fn value for each segment in given forecast dataset and aggregates it according to mode.

Init Metric.

Parameters
  • metric_fn (Callable[[...], float]) – functional metric

  • mode (str) –

    “macro” or “per-segment”, way to aggregate metric values over segments:

    • if “macro” computes average value

    • if “per-segment” – does not aggregate metrics

  • kwargs – functional metric’s params

Raises

NotImplementedError: – it non existent mode is used

Inherited-members

Attributes

name

Name of the metric for representation.

property name: str

Name of the metric for representation.