ml-recommendation-systems
Use when the user asks about a recommender system, collaborative filtering, matrix factorization, ALS with implicit feedback, two-tower retrieval, candidate…
от j4flmao★ 47 звёзд на GitHub
Установить ml-recommendation-systems в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Recommendation Systems
Purpose
Rank items for a user (or context) so that they engage, buy, or return. Production systems are usually two-stage: cheap candidate generation over the full catalog, then a richer ranking model over a few hundred candidates. Success is measured with time-split offline ranking metrics first, then with online experiments, because offline gains often fail to transfer.
Agent Protocol
Trigger
"recommendation system", "recommender", "collaborative filtering", "matrix factorization", "ALS", "implicit feedback", "two-tower", "candidate generation", "re-ranking", "cold start", "recall@k", "ndcg@k", "you may also like".
Input Context
- Interaction data (explicit ratings vs implicit clicks/views/purchases), volume, catalog size, user/item features.
- Business objective (CTR, conversion, watch time, diversity), latency budget, freshness needs.
Output Artifact
Architecture + model choice + evaluation protocol (+ code). No file unless requested.
Response Format
Feedback: {explicit|implicit} users={n} items={n} density={%}
Baseline: {popularity / item-item}
Candidate gen: {method} Ranker: {method}
Offline eval: {split} {Recall@K, NDCG@K, coverage}
Online: {A/B metric, guardrails}
Completion Criteria
- Popularity and item-item baselines reported.
- Time-based split; no future interactions leak into training features.
- Ranking metrics at the K actually shown in the UI.
- Cold-start path defined for new users and new items.
Model Choice
| Situation | Approach |
|---|---|
| Small data, need fast baseline | Popularity (global/segment), item-item co-occurrence or cosine similarity |
| Implicit feedback, medium/large | ALS / weighted matrix factorization, BPR |
| Explicit ratings | Biased matrix factorization (Funk-SVD style) |
| Rich features, large scale | Two-tower retrieval (user tower, item tower) + ANN index, then gradient-boosted or neural ranker |
| Sequence matters (sessions) | Sequential models (GRU4Rec, SASRec-style transformers) |
| New items with content | Content embeddings (text/image) blended with CF (hybrid) |
Implicit Feedback
Clicks/views are positive-only signals with noise; absence is not a negative. Weight by confidence (e.g. 1 + α·count), sample negatives for training, and debias for position/exposure when using logged data.
Example: ALS on Implicit Data (implicit library)
import numpy as np
import scipy.sparse as sp
from implicit.als import AlternatingLeastSquares
# interactions: arrays of user_idx, item_idx, counts (already mapped to 0..n-1)
user_items = sp.csr_matrix((counts.astype(np.float32), (user_idx, item_idx)),
shape=(n_users, n_items))
alpha = 20.0
model = AlternatingLeastSquares(factors=64, regularization=0.05, iterations=20)
model.fit(alpha * user_items) # rows = users, cols = items
ids, scores = model.recommend(user_id, user_items[user_id], N=10,
filter_already_liked_items=True)
similar_ids, sim_scores = model.similar_items(item_id, N=10)
Example: Explicit Ratings (Surprise)
from surprise import SVD, Dataset
from surprise.model_selection import cross_validate
data = Dataset.load_builtin("ml-100k") # downloads MovieLens 100k on first use
algo = SVD(n_factors=100, reg_all=0.02) # biased MF trained with SGD, not a true SVD
results = cross_validate(algo, data, measures=["RMSE", "MAE"], cv=5)
print(results["test_rmse"].mean())
RMSE on ratings rarely correlates with ranking quality; use it only when predicting a rating is the product requirement.
Two-Stage Architecture
user/context → candidate generators (two-tower ANN, item-item, popular, recent) → ~500 candidates
→ feature join (user, item, cross, real-time) → ranker (GBDT / DNN) → business rules
(dedupe, diversity, freshness, filters) → top-K shown → log impressions + outcomes
Log impressions (what was shown), not only clicks, so you can build unbiased training data and compute CTR.
Offline Evaluation
| Metric | Use |
|---|---|
| Recall@K / HitRate@K | Candidate generation: did the true item make the list? |
| NDCG@K, MAP@K, MRR | Ranking quality with position discount |
| Coverage, diversity, novelty | Catalog health; avoid popularity collapse |
| Calibration / AUC | Ranker click-probability models |
| Protocol: train on interactions before time T, evaluate on after T; rank against the full catalog (or a large, documented negative sample, since sampled metrics can change model rankings). |
Cold Start
- New users: popular-in-segment, onboarding preferences, context (device, location, referrer), fast session-based updates.
- New items: content-based embeddings, exploration slots (bandits), boost with decay.
Anti-Patterns
- Random train/test splits on time-ordered interactions (leaks the future).
- Reporting only RMSE for a top-K product.
- Not filte
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ml-recommendation-systems?
Use when the user asks about a recommender system, collaborative filtering, matrix factorization, ALS with implicit feedback, two-tower retrieval, candidate generation and ranking, cold start or recall@k and NDCG. Produces baselines, two-stage architecture and leakage-free offline evaluation. Not for search ranking (use data-search-engine).
Как установить скилл ml-recommendation-systems?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ml-recommendation-systems запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…