langfair.metrics.classification.metrics.baseclass.metrics.Metric#

class langfair.metrics.classification.metrics.baseclass.metrics.Metric#

Bases: ABC

Abstract base class of all recommendation metrics. Serves as a template for creating new metric functions.

__init__()#

Methods

__init__()

binary_confusion_matrix(y_true, y_pred)

Method for computing binary confusion matrix

evaluate(groups, y_pred[, y_true, ratio])

Abstract method that needs to be implemented by the user when creating a new metric function.

static binary_confusion_matrix(y_true, y_pred)#

Method for computing binary confusion matrix

Parameters:
  • y_true (Array-like) – Binary labels (ground truth values)

  • y_pred (Array-like) – Binary model predictions

Returns:

2x2 confusion matrix

Return type:

List[List[float]]

abstract evaluate(groups, y_pred, y_true=None, ratio=False)#

Abstract method that needs to be implemented by the user when creating a new metric function.

Return type:

float