Metric

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

Bases: etna.metrics.base.AbstractMetric, 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

Methods

set_params(**params)

Return new object instance with modified parameters.

to_dict()

Collect all information about etna object in dict.

Attributes

greater_is_better

Whether higher metric value is better.

name

Name of the metric for representation.

property name: str

Name of the metric for representation.