F1Beta
- class rectools.metrics.classification.F1Beta(k: int, debias_config: DebiasConfig = None, beta: float = 1.0)[source]
Bases:
SimpleClassificationMetricFbeta score for k first recommendations. See more: https://en.wikipedia.org/wiki/F-score
The f1_beta equals to
(1 + beta_sqr) * p@k * r@k / (beta_sqr * p@k + r@k)wherebeta_sqr equals to beta ** 2
- p@k: precision@k equals to
tp / kwhere - -
tpis the number of relevant recommendations among first
kitems in the top of recommendation list.
- -
- p@k: precision@k equals to
- r@k: recall@k equals to
tp / likedwhere tpis the number of relevant recommendationsamong first
kitems in the top of recommendation list;
likedis the number of items the user has interacted(bought, liked) with (in period after recommendations were given).
- r@k: recall@k equals to
- Parameters
k (int) – Number of items in top of recommendations list that will be used to calculate metric.
beta (float) – Weight of recall. Default value: beta = 1.0
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
beta