HitRate
- class rectools.metrics.classification.HitRate(k: int, debias_config: Optional[DebiasConfig] = None)[source]
Bases:
SimpleClassificationMetricHitRate calculates the fraction of users for which the correct answer is included in the recommendation list.
- The HitRate equals to
1 if tp > 0, otherwise 0where tpis the number of relevant recommendations among the firstkitems in recommendation list.
- Parameters
k (int) – Number of items in 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)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
- The HitRate equals to