Abstract_Reranker¶
- class fairdiverse.recommendation.rerank_model.Abstract_Reranker.Abstract_Reranker(config, weights=None)[source]¶
Bases:
object
- rerank(ranking_score, k)[source]¶
Re-ranks the items based on the initial ranking scores and a fairness regularization term.
This function performs re-ranking of items for each user by incorporating a fairness regularization term (minimax_reg) that adjusts the ranking scores to promote fairness across groups. The re-ranked list of items is returned for each user.
- Parameters:
ranking_score – A 2D array (or tensor) of ranking scores for all items, with shape (user_size, item_num). Each row corresponds to the scores for a user and each column corresponds to an item.
k – The number of top-ranked items to return for each user.
- Returns:
A list of re-ranked item indices for each user, with the top k items for each user.