extending-pgmpy
Extend pgmpy with canonical algorithms, CI tests, scores, metrics, datasets, and example models.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- extending-pgmpy
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Extend pgmpy with canonical algorithms, CI tests, scores, metrics, datasets, and example models.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/contributor-workflows.md6.0 KB
- 参考文档references/extension-templates.md8.4 KB
- 参考文档references/troubleshooting.md6.2 KB
- 脚本scripts/extension_template_check.py16.9 KB
03 SKILL.md 正文
Extending pgmpy
Use this sub-skill when the task is to add or review a new public pgmpy extension surface: a causal discovery algorithm, conditional independence test, structure score, metric, dataset, or example model. The goal is a focused contribution that follows pgmpy's canonical package layout and template contracts.
Do not use this sub-skill for routine package usage. Route ordinary modeling/factors, structure learning, inference/simulation, causal effects, and data/I/O tasks to their dedicated pgmpy sub-skills. Do not use it for release automation, broad repository maintenance, or R-based bnRep model conversion.
Read first
- Extension templates and base contracts: category-by-category destination, base class, required methods/tags, registry hooks, and template responsibilities.
- Contributor workflows: TDD workflow, focused pytest selection, docs/examples updates, optional dependency guards, and no-commit/no-push guidance.
- Troubleshooting: deprecated estimator routing, registration failures, template/base-class drift, optional dependencies, schema validation, and test selection.
- Static extension check script: safe, read-only helper for checking expected template files, package placement, class/tag/method hints, and registry/test-list reminders.
Operating procedure
- Classify the extension category and pick the canonical package destination from extension-templates.md. If the user proposes
pgmpy.estimatorsfor new functionality, reroute to the canonical package instead and keep legacy estimator compatibility separate. - Start from the matching
devtools/extension_templatesscaffold in the user's pgmpy checkout, but do not copy template text into this skill. Fill every TODO, follow existing implementations, and update the matching template whenever a base-class API or required tag changes. - Implement the public class contract: methods and fitted attributes for discovery algorithms,
_CITestResultpayloads for CI tests, cached_local_scorefor scores,_evaluatefor metrics, loader/tag contracts for datasets and example models. - Register/export where the package expects it, update tests and public docs/examples when a user-facing API appears, and guard optional torch/Pyro, litellm/provider, plotting, or network-bound behavior.
- Validate narrowly first: run the relevant new test file or selected existing family tests, then broaden only as needed. Run pre-commit when available. Never run
git commitorgit pushfor the user.
Useful static check
From any working directory, after installing pgmpy or while editing a checkout, run the bundled helper with a checkout path when checking new files:
python <path-to-extending-pgmpy>/scripts/extension_template_check.py --repo <pgmpy-checkout> --category structure-score --module-name my_score --class-name MyScore --registry-name my-score
For a quick read-only inventory of template/package/test directories:
python <path-to-extending-pgmpy>/scripts/extension_template_check.py --repo <pgmpy-checkout> --category all
The script does not mutate files. Treat it as a placement/contract reminder; still inspect source and run focused tests.
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).