Accuracy
- class rectools.metrics.classification.Accuracy(k: int, debias_config: Optional[DebiasConfig] = None)[source]
Bases:
ClassificationMetricRatio of correctly recommended items among all items.
- The accuracy@k equals to
(tp + tn) / n_itemswhere tpis the number of relevant recommendations among the firstkitems in recommendation list;tnis the number of items with which user has not interacted (bought, liked) with (in period after recommendations were given) and we do not recommend to him (in the topkitems of recommendation list);n_items- an overall number of items that could be used for recommendations.
- Parameters
k (int) – Number of items at the top of recommendations list that will be used to calculate metric.
debias_config (DebiasConfig, optional, default None) – Config with debias method parameters (iqr_coef, random_state).
- Inherited-members
Methods
calc(reco, interactions, catalog)Calculate metric value.
calc_from_confusion_df(confusion_df, catalog)Calculate metric value from prepared confusion matrix.
calc_per_user(reco, interactions, catalog)Calculate metric values for all users.
calc_per_user_from_confusion_df(...[, ...])Calculate metric values for all users from prepared confusion matrix.
Attributes
- The accuracy@k equals to