fairness aware
FAIRNESS_AWARE
Source code in engines/contentFilterEngine/fairness_explainability/fairness_aware.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
__init__()
Initialize the fairness-aware module.
Attributes:
Name | Type | Description |
---|---|---|
fairness_metrics |
dict
|
A dictionary to store calculated fairness metrics, |
Source code in engines/contentFilterEngine/fairness_explainability/fairness_aware.py
6 7 8 9 10 11 12 13 14 |
|
ensure_fairness(recommendations, user_attributes)
Adjust recommendations to ensure fairness across user groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recommendations
|
dict
|
A dictionary mapping user IDs to lists of recommended item IDs. |
required |
user_attributes
|
DataFrame
|
A DataFrame containing user demographic information, |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict[int, List[int]]
|
Adjusted recommendations ensuring fairness, potentially modifying the original |
Dict[int, List[int]]
|
recommendations to achieve a more balanced distribution across user groups. |
Source code in engines/contentFilterEngine/fairness_explainability/fairness_aware.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
evaluate_fairness(recommendations, user_attributes)
Evaluate the fairness of the recommendations across different user groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recommendations
|
dict
|
A dictionary mapping user IDs to lists of recommended item IDs. |
required |
user_attributes
|
DataFrame
|
A DataFrame containing user demographic information, |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
Dict[str, float]
|
A dictionary of fairness metrics, providing insights into how recommendations |
Dict[str, float]
|
are distributed across different user groups. For example, it may include the |
|
Dict[str, float]
|
distribution of recommendations by gender or age group. |
Source code in engines/contentFilterEngine/fairness_explainability/fairness_aware.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|