Recall

class rectools.metrics.classification.Recall(k: int)[source]

Bases: SimpleClassificationMetric

Ratio of relevant recommended items among all items user interacted with after recommendations were made.

The recall@k equals to tp / liked where
  • tp is the number of relevant recommendations among first k items in the top of recommendation list;

  • liked is the number of items the user has interacted (bought, liked) with (in period after recommendations were given).

Parameters

k (int) – Number of items in top of recommendations list that will be used to calculate metric.

Inherited-members

Methods

calc(reco, interactions)

Calculate metric value.

calc_from_confusion_df(confusion_df)

Calculate metric value from prepared confusion matrix.

calc_per_user(reco, interactions)

Calculate metric values for all users.

calc_per_user_from_confusion_df(confusion_df)

Calculate metric values for all users from prepared confusion matrix.

Attributes