AGENT SKILL

pomegranate

Guides pomegranate probabilistic modeling workflows: distributions, mixture models, Bayesian classifiers, Bayesian networks, factor graphs, HMMs, Markov chains, KMeans, and PyTorch-backed training features.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
pomegranate
license
MIT
metadata
{ "disco-role": "operating" }
description
Guides pomegranate probabilistic modeling workflows: distributions, mixture models, Bayesian classifiers, Bayesian networks, factor graphs, HMMs, Markov chains, KMeans, and PyTorch-backed training features.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

pomegranate

Use this skill when

Use this repo skill when a task needs package-specific guidance for pomegranate v1.x probabilistic modeling: distribution fitting/scoring, mixture models, Bayesian classifiers, Bayesian networks, factor graphs, hidden Markov models, Markov chains, KMeans initialization/clustering, missing values, priors, out-of-core updates, or PyTorch device/dtype behavior.

Pomegranate v1.x is a PyTorch-backed rewrite. Prefer current imports such as from pomegranate.distributions import Normal and from pomegranate.hmm import DenseHMM; do not rely on pre-v1 Cython-era names such as NormalDistribution, HiddenMarkovModel, State, Node, or bake.

Install and import check

For a published install, use:

python -m pip install pomegranate

For a local checkout of this package, use:

python -m pip install -e .

Then verify imports with the bundled helper:

python scripts/check_env.py
# optional CUDA allocation check when a CUDA torch build is installed:
python scripts/check_env.py --cuda

Core dependencies are numpy, scipy, scikit-learn, torch, apricot-select, and networkx. There are no repository-defined console entry points; use the Python APIs directly.

Route by task

User task or signal Read next
Fit, score, sample, weight, freeze, or compose individual distributions such as Normal, Categorical, ConditionalCategorical, Gamma, Poisson, IndependentComponents, or ZeroInflated sub-skills/distributions/SKILL.md
Build unsupervised mixture models, Gaussian or heterogeneous mixtures, Bayes classifiers, posterior probabilities, or prior-weighted component inference sub-skills/mixtures-and-classifiers/SKILL.md
Build Bayesian networks, run factor-graph inference, learn categorical network structures, or impute discrete missing values from graph evidence sub-skills/graph-models/SKILL.md
Work with Markov chains, dense/sparse HMMs, sequence likelihoods, variable-length sequence batches, Baum-Welch fitting, posterior decoding, or Viterbi sub-skills/sequence-models/SKILL.md
Use pomegranate KMeans as a standalone clusterer or as an initialization helper for probabilistic models sub-skills/clustering/SKILL.md
Need a compact class-to-subskill map before routing references/model-catalog.md
Need missing-value, GPU, mixed precision, priors, out-of-core, serialization, or torch.compile behavior references/feature-guide.md
Encounter install, import, legacy API, shape, dtype, masked tensor, or backend errors references/troubleshooting.md and the nearest sub-skill troubleshooting file
Need to check whether this skill matches a repository version references/repo-provenance.md

Common API pattern

Most pomegranate models either subclass torch.nn.Module directly or subclass the pomegranate Distribution abstraction. Expect these recurring methods where implemented:

  • fit(...) performs one-shot training, often by calling summarize(...) followed by from_summaries().
  • summarize(...) accumulates sufficient statistics for mini-batch or out-of-core updates.
  • from_summaries() applies accumulated statistics and resets caches.
  • probability(...) and log_probability(...) score complete examples.
  • Composite models add predict(...), predict_proba(...), and predict_log_proba(...) for posterior assignments or missing-value inference.

Use check_data=False only when inputs are already known to satisfy the documented shapes and ranges, or when following torch.compile guidance. Otherwise leave validation enabled while debugging.

Guardrails

  • Keep current v1.x import paths and class names in generated code.
  • Move both model and tensors to the same PyTorch device before using CUDA.
  • Use torch.masked.MaskedTensor for missing values where supported; read the feature guide first because not every distribution supports missingness.
  • Treat optional GPU and mixed-precision workflows as PyTorch-device workflows, not pomegranate-specific installs.
  • Do not tell users to run original repository notebooks or tests as runtime steps. Use the bundled smoke scripts and references instead.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351