UI はローカライズ済みです。スキルの紹介と説明文書は選択した言語へ AI が自動翻訳し、コード・コマンド・パス・専門用語は原文のままです。原作者の文書が優先されます。
スキルを探す
生産性・共同作業 · SKILL.md

sequence-models

sequence-models

Guides pomegranate sequence workflows with MarkovChain, DenseHMM, and SparseHMM, including sequence shapes, variable-length batches, transition setup, Baum-Welch fitting, priors, posterior decoding, and Viterbi.

Independent GitHub snapshot · Automated classification · Original documentation governs

スキルの説明

GitHub

name: sequence-models description: "Guides pomegranate sequence workflows with MarkovChain, DenseHMM, and SparseHMM, including sequence shapes, variable-length batches, transition setup, Baum-Welch fitting, priors, posterior decoding, and Viterbi." disable-model-invocation: true metadata: disco-role: operating license: MIT

sequence-models

Use this sub-skill when

Use this sub-skill for pomegranate sequence models: k-th order categorical MarkovChain, dense-transition DenseHMM, sparse-transition SparseHMM, sequence likelihood scoring, sequence sampling, hidden-state posterior decoding, Viterbi paths, variable-length sequence training, and prior-weighted/semi-supervised HMM learning.

Start here

Typical imports:

from pomegranate.distributions import Categorical, ConditionalCategorical, Exponential, Normal
from pomegranate.markov_chain import MarkovChain
from pomegranate.hmm import DenseHMM, SparseHMM

Read references/api-reference.md for constructors, sequence data shapes, dense/sparse edge formats, and examples. Run scripts/smoke_sequence_models.py to verify tiny MarkovChain, DenseHMM, and SparseHMM workflows.

Core workflow

  1. Choose the model. Use MarkovChain for observed categorical sequences. Use DenseHMM when hidden state transitions are dense. Use SparseHMM when only a few state transitions are possible.
  2. Shape input as sequences. Most HMM/Markov-chain scoring uses (n, length, d). HMM fitting can also accept lists of sequences or grouped tensors for variable lengths.
  3. Create emissions. HMM states are pomegranate distributions such as Normal, Exponential, or richer distributions.
  4. Define starts, ends, and transitions. Dense HMMs use a transition matrix; sparse HMMs use [start_distribution, end_distribution, probability] edge triples plus optional starts/ends.
  5. Train or score. Use fit for Baum-Welch/EM, summarize/from_summaries for chunked updates, and log_probability for sequence likelihoods.
  6. Decode states. Use predict, predict_proba, predict_log_proba, or viterbi depending on whether you need posterior marginals or a best path.

Route elsewhere when

Guardrails

  • HMMs are over sequences; do not pass ordinary (n, d) arrays to HMM scoring/fitting unless the method specifically documents that format.
  • SparseHMM needs explicit nonzero edges; if every state connects to every state, use DenseHMM.
  • Sampling from HMMs requires either fixed sample_length or usable end probabilities.
  • Prior tensors for HMMs must align with sequence shape and state count.
  • Read references/troubleshooting.md when variable-length data, edge formats, start/end probabilities, priors, or sampling fail.
保存したスキル