restc-sbr-eval
Spatio-Temporal Contrastive Learning Enhanced GNNs for Session-based Recommendation — Wan et al. (2022) (arXiv:2209.11461, 2022)
What this evaluates
Evaluates a model's ability to perform session-based next-item recommendation by capturing both spatial graph structures and temporal dynamics. It probes how well the model aggregates collaborative filtering signals and session-specific sequences to predict the subsequent item in a user's browsing session.
Datasets
- Tmall — total 377166; splits: train (351268), test (25898)
- Diginetica — total 780328; splits: train (719470), test (60858)
- Gowalla — total 574532; splits: train (419200), test (155332)
- RetailRocket — total 448780; splits: train (433648), test (15132)
- Nowplaying — total 915128; splits: train (825304), test (89824)
- LastFM — total 3510163; splits: train (2837330), test (672833)
Metrics
cross-entropy(primary) — range: [0, 1]- Cross-entropy loss between the predicted probability distribution over candidate items and the ground truth next item: $\mathcal{L}{main} = -\sum{i=1}^{N} y_i \log(\hat{y}_i) + (1-y_i)\log(1-\hat{y}_i)$.
Input / output format
Input: A session sequence consisting of ordered item IDs and their corresponding timestamps.
Output: A probability distribution vector of size N (number of items) representing the likelihood of each candidate item being the next click.
Scoring recipe
def compute_loss(predictions, targets):
loss = -torch.sum(targets * torch.log(predictions + 1e-9)) / targets.shape[0]
return loss
Common pitfalls
- Data leakage when constructing the global Collaborative Filtering Graph (CFG) if future session interactions are inadvertently included in the training graph.
- Handling of directed cycles and high in-degree items, which can distort message passing in the graph encoder if not properly regularized.
- Session sparsity: short sessions (avg length ~3-7) may lack sufficient temporal signals, making spatial graph aggregation critical but prone to noise.
Evidence (verbatim from paper)
Then, we apply cross-entropy as our objective function of the main task with the ground truth ${\mathbf{y}{1},\mathbf{y}{2},\mathbf{y}{3},\ldots,\mathbf{y}{N}}:
Citation
@misc{wan2022restc,
title={Spatio-Temporal Contrastive Learning Enhanced GNNs for Session-based Recommendation},
author={Wan et al. (2022)},
year={2022},
note={arXiv:2209.11461}
}
- arXiv: 2209.11461