Back to models
Detector

PoissonHMM

Hidden Markov Model with Poisson emissions.

Quickstart

python
from sktime.detection.hmm_learn.poisson import PoissonHMM

estimator = PoissonHMM(n_components: int=1, startprob_prior: float=1.0, transmat_prior: float=1.0, lambdas_prior: float=0.0, lambdas_weight: float=0.0, algorithm: str='viterbi', random_state: int=None, n_iter: int=10, tol: float=0.01, verbose: bool=False, params: str='stl', init_params: str='stl', implementation: str='log')

Parameters(11)

n_componentsint
Number of states.
startprob_priorarray, shape (n_components,), optional

Parameters of the Dirichlet prior distribution for startprob_.

transmat_priorarray, shape (n_components, n_components), optional

Parameters of the Dirichlet prior distribution for each row of the transition probabilities transmat_.

lambdas_prior, lambdas_weightarray, shape (n_components,), optional
The gamma prior on the lambda values using alpha-beta notation, respectively. If None, will be set based on the method of moments.
algorithm{“viterbi”, “map”}, optional
Decoder algorithm.
random_state: RandomState or an int seed, optional
A random number generator instance.
n_iterint, optional
Maximum number of iterations to perform.
tolfloat, optional
Convergence threshold. EM will stop if the gain in log-likelihood is below this value.
verbosebool, optional

Whether per-iteration convergence reports are printed to sys.stderr. Convergence can also be diagnosed using the monitor_ attribute.

params, init_paramsstring, optional

The parameters that get updated during (params) or initialized before (init_params) the training. Can contain any combination of ‘s’ for startprob, ‘t’ for transmat, and ‘l’ for lambdas. Defaults to all parameters.

implementation: string, optional
Determines if the forward-backward algorithm is implemented with logarithms (“log”), or using scaling (“scaling”). The default is to use logarithms for backwards compatibility.

Examples

>>> from sktime.detection.hmm_learn import PoissonHMM
>>> from sktime.detection.datagen import piecewise_poisson
>>> data = piecewise_poisson (
... lambdas = [1, 2, 3 ], lengths = [2, 4, 8 ], random_state = 7
... ). reshape ((- 1, 1))
>>> model = PoissonHMM (n_components = 3)
>>> model = model. fit (data)
>>> labeled_data = model. predict (data)