long-tail-session-rec-eval
Long-Tail Session-based Recommendation from Calibration — Chen et al. (2021) (arXiv:2112.02581, 2021)
What this evaluates
This evaluation probes a session-based recommendation model's ability to accurately predict the next item in a user's interaction sequence while mitigating popularity bias. It measures both standard ranking accuracy and the model's capacity to recommend long-tail items, ensuring recommendations align with user-specific item distribution preferences rather than just global popularity.
Datasets
- YOOCHOOSE — total ?; splits: train (-1), val (-1), test (-1)
- Last.fm — total ?; splits: train (-1), val (-1), test (-1)
Metrics
Recall@20 (primary) — range: [0, 1]
- Computes the proportion of sessions where the ground-truth next item appears in the top-20 recommended items. Formula: (1/|S_te|) * sum(1(x_{n+1} in RL_s)).
MRR@20 — range: [0, 1]
- Measures the mean reciprocal rank of the ground-truth item within the top-20 list. If the item is not in the top-20, the score is 0. Formula: (1/|S_te|) * sum(1/rank(x_{n+1}, RL_s)).
Coverage@20 — range: [0, 1]
- Represents the proportion of unique items recommended across all test sessions relative to the entire item catalog. Formula: |union(RL_s)| / |I|.
TailCoverage@20 — range: [0, 1]
- Similar to Coverage but restricted to long-tail items. Measures the proportion of tail items in the catalog that appear in the top-20 recommendations. Formula: |union(RL_s intersect I_Tail)| / |I_Tail|.
Tail@20 — range: [0, 1]
- Calculates the average proportion of tail items in each session's top-20 recommendation list. Formula: (1/|S_te|) * sum(|RL_s intersect I_Tail| / N).
IP — range: percent
- Improvement Percentage relative to a baseline model. Formula: (Metric_ourmethod - Metric_othermethod) / Metric_othermethod.
Input / output format
Input: A session sequence of user-item interactions (historical items) used to predict the next item.
Output: A ranked list of top-N (N=20) recommended items.
Scoring recipe
def compute_metrics(predictions, gold_items, tail_items, all_items, N=20):
recalls, mrrs, cov_items, tail_cov_items, tail_ratios = [], [], set(), set(), []
for pred_list, gold in zip(predictions, gold_items):
top_n = pred_list[:N]
recalls.append(1.0 if gold in top_n else 0.0)
rank = next((i+1 for i, item in enumerate(top_n) if item == gold), N+1)
mrrs.append(1.0/rank if rank <= N else 0.0)
cov_items.update(top_n)
tail_cov_items.update(top_n & tail_items)
tail_ratios.append(len(top_n & tail_items) / N)
return {
'Recall@20': sum(recalls) / len(recalls),
'MRR@20': sum(mrrs) / len(mrrs),
'Coverage@20': len(cov_items) / len(all_items),
'TailCoverage@20': len(tail_cov_items) / len(tail_items),
'Tail@20': sum(tail_ratios) / len(tail_ratios)
}
Common pitfalls
- Tail items are typically defined by purchase frequency (e.g., items with <2 purchases), but the exact threshold is not specified in the text, leading to inconsistent tail definitions across studies.
- The IP (Improvement Percentage) metric is relative to the chosen baseline, so reporting it without explicitly stating the baseline model makes cross-paper comparisons ambiguous.
- Using N=20 for all metrics is fixed here, but many recommendation papers use N=10 or N=50, causing direct numerical comparison issues if not normalized or explicitly noted.
Evidence (verbatim from paper)
Following previous work $ ^{[10, 13]} $ , we use Recall and MRR as evaluation metrics. • Recall@N (Rec@N) is a widely used metric in recommendation and information retrieval areas. Recall@N computes the proportion of correct items in the top-N items of the list. $$ Recall@N=\frac{1}{|S_{te}|}\sum_{s\in S_{te}}1(x_{n+1}\in RL_{s}) $$
Citation
@misc{chen2021longtail,
title={Long-Tail Session-based Recommendation from Calibration},
author={Chen et al. (2021)},
year={2021},
note={arXiv:2112.02581}
}
1---2name: long-tail-session-rec-eval3description: This evaluation probes a session-based recommendation model's ability to accurately predict the next item in a user's interaction sequence while mitigating popularity bias. It measures both standard ranking accuracy and the model's capacity to recommend long-tail items, ensuring recommendations align with user-specific item distribution preferences rather than just global popularity. Use when the user wants to benchmark on YOOCHOOSE, Last.fm, or asks about evaluating this task. Reports Recall@20.4metadata:5 source: https://skillmd.com/skills/qhjqhj00/long-tail-session-rec-eval6 skill_kind: dataset_eval7 source_arxiv: 2112.025818 bibtex_key: chen2021longtail9 confidence: high10---1112# long-tail-session-rec-eval1314> Long-Tail Session-based Recommendation from Calibration — Chen et al. (2021) (arXiv:2112.02581, 2021)1516## What this evaluates1718This evaluation probes a session-based recommendation model's ability to accurately predict the next item in a user's interaction sequence while mitigating popularity bias. It measures both standard ranking accuracy and the model's capacity to recommend long-tail items, ensuring recommendations align with user-specific item distribution preferences rather than just global popularity.1920## Datasets2122- **YOOCHOOSE** — total ?; splits: train (-1), val (-1), test (-1)23- **Last.fm** — total ?; splits: train (-1), val (-1), test (-1)2425## Metrics2627- `Recall@20` **(primary)** — range: [0, 1]28 - Computes the proportion of sessions where the ground-truth next item appears in the top-20 recommended items. Formula: (1/|S_te|) * sum(1(x_{n+1} in RL_s)).29- `MRR@20` — range: [0, 1]30 - Measures the mean reciprocal rank of the ground-truth item within the top-20 list. If the item is not in the top-20, the score is 0. Formula: (1/|S_te|) * sum(1/rank(x_{n+1}, RL_s)).31- `Coverage@20` — range: [0, 1]32 - Represents the proportion of unique items recommended across all test sessions relative to the entire item catalog. Formula: |union(RL_s)| / |I|.33- `TailCoverage@20` — range: [0, 1]34 - Similar to Coverage but restricted to long-tail items. Measures the proportion of tail items in the catalog that appear in the top-20 recommendations. Formula: |union(RL_s intersect I_Tail)| / |I_Tail|.35- `Tail@20` — range: [0, 1]36 - Calculates the average proportion of tail items in each session's top-20 recommendation list. Formula: (1/|S_te|) * sum(|RL_s intersect I_Tail| / N).37- `IP` — range: percent38 - Improvement Percentage relative to a baseline model. Formula: (Metric_ourmethod - Metric_othermethod) / Metric_othermethod.3940## Input / output format4142**Input**: A session sequence of user-item interactions (historical items) used to predict the next item.4344**Output**: A ranked list of top-N (N=20) recommended items.4546## Scoring recipe4748```python49def compute_metrics(predictions, gold_items, tail_items, all_items, N=20):50 recalls, mrrs, cov_items, tail_cov_items, tail_ratios = [], [], set(), set(), []51 for pred_list, gold in zip(predictions, gold_items):52 top_n = pred_list[:N]53 recalls.append(1.0 if gold in top_n else 0.0)54 rank = next((i+1 for i, item in enumerate(top_n) if item == gold), N+1)55 mrrs.append(1.0/rank if rank <= N else 0.0)56 cov_items.update(top_n)57 tail_cov_items.update(top_n & tail_items)58 tail_ratios.append(len(top_n & tail_items) / N)59 return {60 'Recall@20': sum(recalls) / len(recalls),61 'MRR@20': sum(mrrs) / len(mrrs),62 'Coverage@20': len(cov_items) / len(all_items),63 'TailCoverage@20': len(tail_cov_items) / len(tail_items),64 'Tail@20': sum(tail_ratios) / len(tail_ratios)65 }66```6768## Common pitfalls6970- Tail items are typically defined by purchase frequency (e.g., items with <2 purchases), but the exact threshold is not specified in the text, leading to inconsistent tail definitions across studies.71- The IP (Improvement Percentage) metric is relative to the chosen baseline, so reporting it without explicitly stating the baseline model makes cross-paper comparisons ambiguous.72- Using N=20 for all metrics is fixed here, but many recommendation papers use N=10 or N=50, causing direct numerical comparison issues if not normalized or explicitly noted.7374## Evidence (verbatim from paper)7576> Following previous work $ ^{[10, 13]} $ , we use Recall and MRR as evaluation metrics. • Recall@N (Rec@N) is a widely used metric in recommendation and information retrieval areas. Recall@N computes the proportion of correct items in the top-N items of the list. $$ Recall@N=\frac{1}{\|S_{te}\|}\sum_{s\in S_{te}}1(x_{n+1}\in RL_{s}) $$7778## Citation7980```bibtex81@misc{chen2021longtail,82 title={Long-Tail Session-based Recommendation from Calibration},83 author={Chen et al. (2021)},84 year={2021},85 note={arXiv:2112.02581}86}87```8889- arXiv: 2112.02581