Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

recommender-evaluation

БесплатноБез исполняемых скриптовНе проверен

Evaluate recommender system quality for the CSX4207 Vinyl Record Store. Use whenever you must compute or report recommender metrics (Precision@k, Recall@k…

PracticalSwanот PracticalSwan★ 25 звёзд на GitHub

Об этом скилле

Recommender Evaluation

This skill defines how the Vinyl Record Store recommender is measured. It exists because recommender quality is judged on ranking and catalog health, not MSE/RMSE — applying regression metrics to a top-k recommender is a classic, grade-costing mistake.

When to use

  • You are about to compute or report a number about recommendation quality.
  • You are designing the train/test split or deciding what counts as "relevant."
  • You are comparing two algorithms and need a fair, side-by-side table.
  • You are writing the Evaluation section of a CSX4207 report or slide.

Step 0 — Define "relevant" before touching metrics

Pin this down explicitly and write it in the report:

  • Explicit ratings: "relevant" usually = rating ≥ threshold (e.g., ≥ 4 of 5).
  • Implicit feedback: "relevant" = user interacted (play/purchase) in the held-out period; for ranking metrics, consider only items the user hasn't already consumed from training.

Ambiguity here invalidates every downstream number.

Step 1 — Split without leakage

  • Leave-one-out per user (small data): hold out each user's most recent (or a random one) interaction for test; train on the rest. Standard for HitRate@k / NDCG@k on sparse academic datasets.
  • Temporal split (preferred when timestamps exist): train on interactions before time T, test on after T. Closest to production reality.
  • Never random row-shuffle split that lets a user appear in both train and test with overlapping context — it leaks and inflates every metric.
  • For top-k ranking eval, sample negatives (items the user didn't interact with) to rank against the held-out positive, or rank against the full catalog (more honest, more expensive). State which.

Step 2 — Ranking-accuracy metrics (report at least NDCG@k + MAP@k)

For a user u, let the top-k recommendation list be R_k(u) and the set of relevant items be Rel(u).

  • Precision@k = |Rel(u) ∩ R_k(u)| / k
  • Recall@k = |Rel(u) ∩ R_k(u)| / |Rel(u)|
  • HitRate@k = 1 if |Rel(u) ∩ R_k(u)| ≥ 1 else 0 (mean over users)
  • MRR (Mean Reciprocal Rank) = mean over users of 1 / rank_of_first_relevant
  • AP@k (Average Precision) = (1 / min(k, |Rel(u)|)) · Σ_{i=1..k} Precision@i · rel(i), where rel(i)=1 if item at rank i is relevant. MAP@k = mean of AP@k over users.
  • DCG@k = Σ_{i=1..k} rel_i / log2(i + 1) (use 2^rel − 1 if graded relevance). IDCG@k = DCG of the ideal ordering. NDCG@k = DCG@k / IDCG@k ∈ [0,1].

Aggregate by mean over users (macro-average). NDCG and MAP reward putting relevant items high in the list — prefer them over plain precision.

Step 3 — Beyond-accuracy metrics (report coverage + at least one of novelty/diversity/serendipity)

A model can win on NDCG by recommending only the 10 most popular items, killing discovery. Always pair accuracy with:

  • Catalog coverage = |∪_u R_k(u)| / |all items| — fraction of catalog ever surfaced.
  • Gini coefficient (diversity of recommendation frequency) = G = (Σ_i (2i − n − 1) · f_i) / (n · Σ_i f_i) over items sorted by recommendation frequency f; lower G = more equitable distribution.
  • Novelty = mean self-information of recommended items: − (1/|R_k|) Σ_{i∈R_k} log2 p(i), where p(i) = item popularity (fraction of users who interacted with i). Higher = more obscure items surfaced.
  • Serendipity = mean over recommended items of relevant(i) AND surprising(i), where surprising = low similarity to items in the user's training history (e.g., below a content-similarity threshold). Reward relevant + unexpected.
  • Personalization = 1 − average pairwise cosine similarity of users' binary recommendation indicator vectors. Higher = lists differ more across users.

Step 4 — Always report against baselines

Every table needs, at minimum:

  1. Random baseline (sanity floor).
  2. Popularity baseline (the model that must be beaten).
  3. Your candidate model(s).

Report format:

Model NDCG@10 MAP@10 HitRate@10 Coverage Novelty
Random … … … … …
Popularity … … … … …
Content-based … … … … …
SVD (ours) … … … … …

One sentence of interpretation per model row (e.g., "SVD beats popularity on NDCG@10 but halves catalog coverage").

JavaScript reference (matches the Next.js backend)

Place in vinyl_record_store_backend/src/lib/recommender/evaluate.js. Pure functions, no I/O, unit-testable.

// rel = Set of relevant item ids for one user; rec = ordered list of top-k item ids
export const precisionAtK = (rel, rec, k) => hits(rel, rec, k) / k;
export const recallAtK = (rel, rec, k) => (rel.size ? hits(rel, rec, k) / rel.size : 0);
export const hitRateAtK = (rel, rec,
Полный SKILL.md на GitHub

Установить recommender-evaluation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

CHANGELOG.md

FAQ

Что делает скилл recommender-evaluation?

Evaluate recommender system quality for the CSX4207 Vinyl Record Store. Use whenever you must compute or report recommender metrics (Precision@k, Recall@k, HitRate@k, MRR, MAP@k, NDCG@k, coverage, diversity, novelty, serendipity, personalization), design an evaluation protocol/split, run a baseline comparison, or write the evaluation section of a course deliverable. Covers formulas, JavaScript reference implementations, and the reporting checklist.

Как установить скилл recommender-evaluation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл recommender-evaluation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить recommender-evaluation с