explainable
EXPLAINABLE
Source code in engines/contentFilterEngine/fairness_explainability/explainable.py
4 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 |
|
__init__()
Initialize the explainable module.
Attributes:
Name | Type | Description |
---|---|---|
explanations |
dict
|
A dictionary to store explanations with keys as |
Source code in engines/contentFilterEngine/fairness_explainability/explainable.py
5 6 7 8 9 10 11 12 13 |
|
generate_explanation(user_id, item_id, context=None)
Generate an explanation for why a particular item was recommended to a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id
|
int
|
The ID of the user for whom the recommendation was made. |
required |
item_id
|
int
|
The ID of the recommended item. |
required |
context
|
dict
|
Additional context in which the recommendation was made, |
None
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A textual explanation of the recommendation, detailing the factors that |
str
|
influenced the recommendation decision. |
Source code in engines/contentFilterEngine/fairness_explainability/explainable.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
get_explanation(user_id, item_id)
Retrieve a previously generated explanation for a recommendation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id
|
int
|
The ID of the user for whom the recommendation was made. |
required |
item_id
|
int
|
The ID of the recommended item. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The explanation of the recommendation if available, otherwise a default |
str
|
message indicating that no explanation is available. |
Source code in engines/contentFilterEngine/fairness_explainability/explainable.py
36 37 38 39 40 41 42 43 44 45 46 47 48 |
|