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★ 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 =
1if|Rel(u) ∩ R_k(u)| ≥ 1else0(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), whererel(i)=1if item at rank i is relevant. MAP@k = mean of AP@k over users. - DCG@k =
Σ_{i=1..k} rel_i / log2(i + 1)(use2^rel − 1if 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), wherep(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 similarityof users' binary recommendation indicator vectors. Higher = lists differ more across users.
Step 4 — Always report against baselines
Every table needs, at minimum:
- Random baseline (sanity floor).
- Popularity baseline (the model that must be beaten).
- 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,
Установить recommender-evaluation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic