Precision
- class rectools.metrics.classification.Precision(k: int)[source]
Bases:
SimpleClassificationMetric
Ratio of relevant items among top-k recommended items.
The precision@k equals to
tp / k
wheretp
is the number of relevant recommendations among firstk
items in the top of recommendation list.- 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