hezar.metrics.metric module

class hezar.metrics.metric.Metric(config: MetricConfig, **kwargs)[source]

Bases: object

The base metric class for all metrics in Hezar.

Metrics are simple wrappers for casual ready-to-use metrics like in scikit-learn, etc. and it’s strongly recommended not to reinvent the wheel. If a metric is already implemented by some package, use it! The only reason to implement such a module, is to make sure the metrics are treated the same all over the framework.

compute(predictions=None, targets=None, **kwargs) Dict[source]

Compute metric value for the given predictions against the targets :param predictions: Prediction values :param targets: Ground truth values :param **kwargs: Extra arguments depending on the metric

Returns:

A dictionary of the results and scores

required_backends: List[str | Backends] = []