model-fitting-internals
Inspect and control PyDESeq2 staged model-fitting internals, normalization helpers, VST, AnnData storage keys, Cooks refits, and DefaultInference behavior.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- model-fitting-internals
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Inspect and control PyDESeq2 staged model-fitting internals, normalization helpers, VST, AnnData storage keys, Cooks refits, and DefaultInference behavior.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/internals-reference.md9.8 KB
- 参考文档references/troubleshooting.md8.7 KB
- 参考文档references/vst-and-normalization.md8.0 KB
- 脚本scripts/check_normalization.py6.9 KB
- 脚本scripts/inspect_stepwise_pipeline.py8.2 KB
03 SKILL.md 正文
PyDESeq2 Model-Fitting Internals
Use this sub-skill when an agent must inspect, debug, or manually control PyDESeq2's staged internals instead of only running the high-level DeseqDataSet.deseq2() wrapper.
Use When
- You need the exact staged order for
fit_size_factors, dispersion fitting, MAP shrinkage, LFC fitting, Cooks distances, and outlier refits. - You need to inspect where PyDESeq2 stores fitted values in
obs,var,varm,layers,obsm, anduns. - You need leakage-safe train/test normalization with
deseq2_norm_fitanddeseq2_norm_transform. - You need to diagnose
vst,vst_fit, orvst_transformfailures and choose blind versus design-aware VST. - You need to reason about
DefaultInference,n_cpus, joblib backends, orlow_memoryside effects.
Read First
references/internals-reference.mdfor staged fitting order, method responsibilities, storage keys, and inference behavior.references/vst-and-normalization.mdfor size-factor modes, control genes, preprocessing helpers, VST order, and train/test patterns.references/troubleshooting.mdfor actionable fixes for common internals failures and warnings.
Bundled Scripts
scripts/inspect_stepwise_pipeline.pyruns a local synthetic stepwise fit with--n-cpus 1by default and prints expected AnnData keys after each stage.scripts/check_normalization.pydemonstratesdeseq2_norm_fiton training counts anddeseq2_norm_transformon held-out counts without network access.
Example commands:
python scripts/inspect_stepwise_pipeline.py --help
python scripts/inspect_stepwise_pipeline.py --n-cpus 1 --use-design-vst
python scripts/check_normalization.py --help
python scripts/check_normalization.py --as-json
If PyDESeq2 is missing, install it with a generic package command such as python -m pip install pydeseq2 in the active Python environment.
Routing Boundaries
- For standard end-to-end differential expression analysis with
DeseqDataSet.deseq2()andDeseqStats, route to../dea-workflows/SKILL.md. - For count/metadata schemas, CSV loading, AnnData construction, and validation failures, route to
../data-io-validation/SKILL.md. - For contrasts, p-values, adjusted p-values, LFC shrinkage, result tables, and plots, route to
../statistics-and-results/SKILL.md.
Safe Defaults
- Prefer
DefaultInference(n_cpus=1)in examples and verification unless the user explicitly asks to parallelize. - Prefer
fit_type="parametric"for DESeq2-like defaults, but switch tofit_type="mean"when parametric trend fitting repeatedly falls back or the user asks for the mean trend. - Prefer
size_factors_fit_type="ratio"when geometric means are valid; use"poscounts"for sparse positive-count settings and"iterative"only when the staged MLE behavior is intended. - For train/test workflows, fit ratio log means on training counts and transform held-out counts; do not recompute normalization facts on test counts unless the user explicitly accepts leakage.
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).