# Restc Sbr Eval

> 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. Use when the user wants to benchmark on Tmall, Diginetica, Gowalla, RetailRocket, Nowplaying, LastFM, or asks about evaluating this task. Reports cross-entropy.

- Skill: `qhjqhj00/restc-sbr-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/restc-sbr-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/restc-sbr-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/restc-sbr-eval

---


# 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

```python
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

```bibtex
@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

