Precision
- class rectools.metrics.classification.Precision(k: int)[source]
Bases:
SimpleClassificationMetricRatio of relevant items among top-k recommended items.
The precision@k equals to
tp / kwheretpis the number of relevant recommendations among firstkitems 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