Bias Metrics - API Reference¶
Auto-generated documentation for bias metric classes.
warprec.evaluation.metrics.bias.aclt.ACLT
¶
Bases: UserAverageTopKMetric
ACLT (Average Coverage of Long-Tail items) is a metric that evaluates the extent to which a recommendation system provides recommendations from the long-tail of item popularity. The long-tail is determined based on a given popularity percentile threshold.
This metric is designed to assess recommendation diversity by measuring the proportion of recommended long-tail items relative to all recommendations. A higher ACLT value indicates a system that effectively recommends less popular items.
Attributes:
| Name | Type | Description |
|---|---|---|
long_tail |
Tensor
|
The lookup tensor of long tail items. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The cutoff for recommendations. |
required |
num_users
|
int
|
Number of users in the training set. |
required |
item_interactions
|
Tensor
|
The counts for item interactions in training set. |
required |
pop_ratio
|
float
|
The percentile considered popular. |
0.8
|
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
The keyword argument dictionary. |
{}
|
Source code in warprec/evaluation/metrics/bias/aclt.py
name
property
¶
The name of the metric.
warprec.evaluation.metrics.bias.aplt.APLT
¶
Bases: UserAverageTopKMetric
APLT (Average Proportion of Long-Tail items) is a metric that evaluates the proportion of long-tail items present in the top-k recommendations. Unlike APLT, which focuses on the number of long-tail recommendations, APLT normalizes by the total number of recommended items, providing a proportional measure.
This metric helps analyze how well a recommendation system balances diversity by incorporating less popular items into recommendations while maintaining relevance.
Attributes:
| Name | Type | Description |
|---|---|---|
long_tail |
Tensor
|
The lookup tensor of long tail items. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The cutoff for recommendations. |
required |
num_users
|
int
|
Number of users in the training set. |
required |
item_interactions
|
Tensor
|
The counts for item interactions in training set. |
required |
pop_ratio
|
float
|
The percentile considered popular. |
0.8
|
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
The keyword argument dictionary. |
{}
|
Source code in warprec/evaluation/metrics/bias/aplt.py
name
property
¶
The name of the metric.
warprec.evaluation.metrics.bias.arp.ARP
¶
Bases: UserAverageTopKMetric
ARP (Average Recommendation Popularity) is a metric that evaluates the average popularity of the top-k recommendations.
Attributes:
| Name | Type | Description |
|---|---|---|
pop |
Tensor
|
The lookup tensor of item popularity. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The cutoff for recommendations. |
required |
num_users
|
int
|
Number of users in the training set. |
required |
item_interactions
|
Tensor
|
The counts for item interactions in training set. |
required |
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
The keyword argument dictionary. |
{}
|
Source code in warprec/evaluation/metrics/bias/arp.py
warprec.evaluation.metrics.bias.pop_reo.PopREO
¶
Bases: TopKMetric
Popularity-based Ranking-based Equal Opportunity (PopREO) metric.
This metric evaluates the fairness of a recommender system by comparing the proportion of recommended items from the short head (most popular items) and long tail (less popular items) to their respective proportions in the ground truth. It calculates the standard deviation of these proportions divided by their mean, providing a measure of how equally the system recommends items across different popularity groups.
Attributes:
| Name | Type | Description |
|---|---|---|
short_head |
Tensor
|
The lookup tensor of short head items. |
long_tail |
Tensor
|
The lookup tensor of long tail items. |
short_recs |
Tensor
|
The short head recommendations. |
long_recs |
Tensor
|
The long tail recommendations. |
short_gt |
Tensor
|
The short head items in the target. |
long_gt |
Tensor
|
The long tail items in the target. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The cutoff for recommendations. |
required |
item_interactions
|
Tensor
|
The counts for item interactions in training set. |
required |
pop_ratio
|
float
|
The percentile considered popular. |
0.8
|
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
The keyword argument dictionary. |
{}
|
Source code in warprec/evaluation/metrics/bias/pop_reo.py
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | |
name
property
¶
The name of the metric.
warprec.evaluation.metrics.bias.pop_rsp.PopRSP
¶
Bases: TopKMetric
Popularity-based Ranking-based Statistical Parity (PopRSP) metric.
This metric evaluates the disparity in recommendation performance between popular (short head) and less popular (long tail) items. It calculates the standard deviation of precision across these two groups, normalized by their mean, to assess the balance in recommendation exposure.
Attributes:
| Name | Type | Description |
|---|---|---|
short_head |
Tensor
|
The lookup tensor of short head items. |
long_tail |
Tensor
|
The lookup tensor of long tail items. |
total_short |
Tensor
|
The total number of short head items. |
total_long |
Tensor
|
The total number of long tail items. |
short_recs |
Tensor
|
The short head recommendations. |
long_recs |
Tensor
|
The long tail recommendations. |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
int
|
The cutoff for recommendations. |
required |
item_interactions
|
Tensor
|
The counts for item interactions in training set. |
required |
pop_ratio
|
float
|
The percentile considered popular. |
0.8
|
dist_sync_on_step
|
bool
|
Torchmetrics parameter. |
False
|
**kwargs
|
Any
|
The keyword argument dictionary. |
{}
|
Source code in warprec/evaluation/metrics/bias/pop_rsp.py
name
property
¶
The name of the metric.
compute()
¶
Computes the final metric value.