Fairness¶
Fairness metrics aim to ensure that recommender systems provide equitable recommendations across different user groups, particularly those defined by sensitive attributes (e.g., gender, age, socioeconomic status). These metrics help detect and mitigate disparate impact or treatment in recommendation outcomes.
API Reference
For class signatures and source code, see the Fairness Metrics API Reference.
BiasDisparityBD¶
Bias Disparity (BiasDisparityBD@K). Measures the difference in recommendation bias between user groups, indicating how much one group is favored over another.
where \(\text{BR}\) is the bias in recommendations and \(\text{BS}\) is the bias in the training source. Positive values indicate bias amplification; negative values indicate bias reduction.
Note
This metric requires the user to provide clustering information (i.e., user group definitions).
For further details, please refer to this link.
BiasDisparityBR¶
Bias Disparity - Bias Recommendations (BiasDisparityBR@K). Quantifies the disparity in the frequency of biased (e.g., popular) items recommended to different user groups within their top-K recommendations.
where \(P_{\text{rec}}(u, c)\) is the proportion of items from cluster \(c\) recommended to user cluster \(u\), and \(P_{\text{global}}(c)\) is the global proportion of items in cluster \(c\).
Note
This metric requires the user to provide clustering information.
For further details, please refer to this link.
BiasDisparityBS¶
Bias Disparity - Bias Scores (BiasDisparityBS). Measures the disparity in the average bias scores of recommended items across user groups, assessing score-level bias.
where \(P_{\text{train}}(u, c)\) is the proportion of interactions from user cluster \(u\) with items in cluster \(c\) in the training set.
Note
This metric requires the user to provide clustering information.
For further details, please refer to this link.
ItemMADRanking¶
Item MAD Ranking (ItemMADRanking@K). Computes the Mean Absolute Deviation of item ranks across user groups, measuring fairness in item exposure in rankings.
where \(\bar{g}_c\) is the average discounted gain (DCG) for items in cluster \(c\) and \(m\) is the number of item clusters.
Note
This metric requires the user to provide clustering information.
For further details, please refer to this link.
ItemMADRating¶
Item MAD Rating (ItemMADRating@K). Computes the Mean Absolute Deviation of predicted item ratings across user groups, assessing fairness in predicted preferences.
where \(\bar{r}_c\) is the average rating/score for items in cluster \(c\).
Note
This metric requires the user to provide clustering information.
For further details on the concept, please refer to this link.
REO¶
Ranking-based Equal Opportunity (REO@K). Assesses whether relevant items are ranked similarly across user groups, ensuring fair visibility of relevant content.
where \(P(R@K \mid g_a, y{=}1)\) is the probability that a relevant item from group \(g_a\) appears in the top-K recommendations.
Note
This metric requires the user to provide clustering information.
For further details, please refer to this paper.
RSP¶
Ranking-based Statistical Parity (RSP@K). Measures whether the ranking positions of items (regardless of relevance) are equally distributed across user groups, ensuring fairness in exposure.
where \(P(R@K \mid g_a)\) is the probability that an item from group \(g_a\) is recommended in top-K.
Note
This metric requires the user to provide clustering information.
For further details, please refer to this paper.
UserMADRanking¶
User MAD Ranking (UserMADRanking@K). Measures the Mean Absolute Deviation of item ranking positions for each user group, focusing on rank consistency across users.
where \(\text{nDCG}_c\) is the average nDCG score for users in cluster \(c\).
Note
This metric requires the user to provide clustering information.
For further details, please refer to this link.
UserMADRating¶
User MAD Rating (UserMADRating@K). Measures the Mean Absolute Deviation of predicted item ratings for each user group, capturing disparities in predicted relevance.
where \(\bar{s}_c\) is the average of top-K recommendation scores for users in cluster \(c\).
Note
This metric requires the user to provide clustering information.
For further details on the concept, please refer to this link.