matchzoo.engine.base_metric

Metric base class and some related utilities.

Module Contents

Classes

BaseMetric

Metric base class.

RankingMetric

Ranking metric base class.

ClassificationMetric

Rangking metric base class.

Functions

sort_and_couple(labels: np.array, scores: np.array) → np.array

Zip the labels with scores into a single list.

class matchzoo.engine.base_metric.BaseMetric

Bases: abc.ABC

Metric base class.

ALIAS = base_metric
abstract __call__(self, y_true: np.array, y_pred: np.array) → float

Call to compute the metric.

Parameters
  • y_true – An array of groud truth labels.

  • y_pred – An array of predicted values.

Returns

Evaluation of the metric.

abstract __repr__(self)
Returns

Formated string representation of the metric.

__eq__(self, other)
Returns

True if two metrics are equal, False otherwise.

__hash__(self)
Returns

Hashing value using the metric as str.

class matchzoo.engine.base_metric.RankingMetric

Bases: matchzoo.engine.base_metric.BaseMetric

Ranking metric base class.

ALIAS = ranking_metric
class matchzoo.engine.base_metric.ClassificationMetric

Bases: matchzoo.engine.base_metric.BaseMetric

Rangking metric base class.

ALIAS = classification_metric
matchzoo.engine.base_metric.sort_and_couple(labels: np.array, scores: np.array) → np.array

Zip the labels with scores into a single list.