evaluation-splitting
Evaluate fitted LightFM recommenders and create leakage-safe train/test splits.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- evaluation-splitting
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Evaluate fitted LightFM recommenders and create leakage-safe train/test splits.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md7.9 KB
- 参考文档references/troubleshooting.md8.0 KB
- 参考文档references/workflows.md7.5 KB
- 脚本scripts/evaluate_lightfm_fixture.py8.5 KB
03 SKILL.md 正文
LightFM evaluation and splitting
Use this sub-skill when a task is about offline ranking metrics, train/test splits, or debugging leakage in a fitted LightFM recommender.
Read when
- Compute
precision_at_k,recall_at_k,auc_score,reciprocal_rank, orLightFM.predict_rankfor a fitted model. - Split an interactions matrix with
random_train_test_splitand validate that train and test interactions do not overlap. - Explain
train_interactions,check_intersections,preserve_rows, metric output shapes, top-k behavior, rank values, or tie handling. - Diagnose intersection
ValueError, suspiciously high test metrics, empty metric arrays, zero-row users, sparse matrix input problems, ornum_threadserrors.
Route elsewhere
- Training, tuning, resuming, serializing, direct
predictscoring, or loss selection: read model-training. - Dataset mappings, feature matrix construction, built-in dataset fetchers, cold-start feature design, or interaction schemas: read data-features.
- Repository build, editable install, compiled extension maintenance, native tests, or CI commands: read repo-development.
Fast workflow
- Start from a fitted
lightfm.LightFMmodel and SciPy sparse train/test matrices with identical(n_users, n_items)shape. If the model was fit with user or item features, pass compatible feature matrices into the metric call as well. - Treat non-zero entries in
test_interactionsas positives to rank. Remove or zero-out negative feedback before ranking metrics; LightFM evaluation treats any non-zero entry as an interaction. - Pass
train_interactions=trainfor test metrics so known training positives are excluded from the candidate ranking. Keepcheck_intersections=Trueunless performing an intentional diagnostic. - Choose
preserve_rows=Falsefor aggregate means over users with test positives, orpreserve_rows=Truewhen the output must stay aligned to the original user axis. - Inspect API details for signatures, return shapes, sparse matrix expectations, intersection checks, and tie semantics.
- Use workflows for leakage-safe split/evaluate
recipes, user-preserving metrics, and
predict_rankinterpretation. - Use troubleshooting when metrics error, look optimistic, contain zero/empty rows, or disagree with expected top-k behavior.
A deterministic, no-network fixture is bundled at scripts/evaluate_lightfm_fixture.py. It trains a tiny CPU model, computes all ranking metrics, validates a random split, and can intentionally demonstrate intersection handling.
Non-negotiables for leakage-safe evaluation
- Do not average test metrics without checking that train/test matrices are disjoint at non-zero coordinates.
- Do not silence intersection checks just to get a score; fix the split unless the task is explicitly evaluating training-set ranking behavior.
- Do not compare metrics across runs unless
k, split policy, feature matrices,preserve_rows, and train-interaction filtering are the same. - Do not interpret random splits as temporal validation. Use a chronological or user-aware holdout when production evaluation requires it, then still validate intersections before scoring.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).