class_docstr: Hidden Markov Model with categorical (discrete) emissions.
  
  Attributes
  ----------
  n_features : int
      Number of possible symbols emitted by the model (in the samples).
  
  monitor_ : ConvergenceMonitor
      Monitor object used to check the convergence of EM.
  
  startprob_ : array, shape (n_components, )
      Initial state occupation distribution.
  
  transmat_ : array, shape (n_components, n_components)
      Matrix of transition probabilities between states.
  
  emissionprob_ : array, shape (n_components, n_features)
      Probability of emitting a given symbol when in each state.
  
  Examples
  --------
  >>> from hmmlearn.hmm import CategoricalHMM
  >>> CategoricalHMM(n_components=2)  #doctest: +ELLIPSIS
  CategoricalHMM(algorithm='viterbi',...
class_docstr_tok: ["Hidden","Markov","Model","with","categorical","(","discrete",")","emissions",".","Attributes","--","--","--","--","--","n_features",":","int","Number","of","possible","symbols","emitted","by","the","model","(","in","the","samples",")",".","monitor_",":","ConvergenceMonitor","Monitor","object","used","to","check","the","convergence","of","EM",".","startprob_",":","array",",","shape","(","n_components",",",")","Initial","state","occupation","distribution",".","transmat_",":","array",",","shape","(","n_components",",","n_components",")","Matrix","of","transition","probabilities","between","states",".","emissionprob_",":","array",",","shape","(","n_components",",","n_features",")","Probability","of","emitting","a","given","symbol","when","in","each","state",".","Examples","--","--","--","--",">",">",">","from","hmmlearn.hmm","import","CategoricalHMM",">",">",">","CategoricalHMM","(","n_components=2",")","#","doctest",":","+ELLIPSIS","CategoricalHMM","(","algorithm='viterbi","'",",","..."]
docstr: Parameters
  ----------
  n_components : int
      Number of states.
  
  startprob_prior : array, shape (n_components, ), optional
      Parameters of the Dirichlet prior distribution for
      :attr:`startprob_`.
  
  transmat_prior : array, shape (n_components, n_components), optional
      Parameters of the Dirichlet prior distribution for each row
      of the transition probabilities :attr:`transmat_`.
  
  emissionprob_prior : array, shape (n_components, n_features), optional
      Parameters of the Dirichlet prior distribution for
      :attr:`emissionprob_`.
  
  n_features: int, optional
      The number of categorical symbols in the HMM.  Will be inferred
      from the data if not set.
  
  algorithm : {"viterbi", "map"}, optional
      Decoder algorithm.
  
      - "viterbi": finds the most likely sequence of states, given all
        emissions.
      - "map" (also known as smoothing or forward-backward): finds the
        sequence of the individual most-likely states, given all
        emissions.
  
  random_state: RandomState or an int seed, optional
      A random number generator instance.
  
  n_iter : int, optional
      Maximum number of iterations to perform.
  
  tol : float, optional
      Convergence threshold. EM will stop if the gain in log-likelihood
      is below this value.
  
  verbose : bool, optional
      Whether per-iteration convergence reports are printed to
      :data:`sys.stderr`.  Convergence can also be diagnosed using the
      :attr:`monitor_` attribute.
  
  params, init_params : string, 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 'e' for
      emissionprob.  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 compatability.
docstr_tok: ["Parameters","--","--","--","--","--","n_components",":","int","Number","of","states",".","startprob_prior",":","array",",","shape","(","n_components",",",")",",","optional","Parameters","of","the","Dirichlet","prior","distribution","for",":","attr",":","`","startprob_","`",".","transmat_prior",":","array",",","shape","(","n_components",",","n_components",")",",","optional","Parameters","of","the","Dirichlet","prior","distribution","for","each","row","of","the","transition","probabilities",":","attr",":","`","transmat_","`",".","emissionprob_prior",":","array",",","shape","(","n_components",",","n_features",")",",","optional","Parameters","of","the","Dirichlet","prior","distribution","for",":","attr",":","`","emissionprob_","`",".","n_features",":","int",",","optional","The","number","of","categorical","symbols","in","the","HMM",".","Will","be","inferred","from","the","data","if","not","set",".","algorithm",":","{","``","viterbi","''",",","``","map","''","}",",","optional","Decoder","algorithm",".","-","``","viterbi","''",":","finds","the","most","likely","sequence","of","states",",","given","all","emissions",".","-","``","map","''","(","also","known","as","smoothing","or","forward-backward",")",":","finds","the","sequence","of","the","individual","most-likely","states",",","given","all","emissions",".","random_state",":","RandomState","or","an","int","seed",",","optional","A","random","number","generator","instance",".","n_iter",":","int",",","optional","Maximum","number","of","iterations","to","perform",".","tol",":","float",",","optional","Convergence","threshold",".","EM","will","stop","if","the","gain","in","log-likelihood","is","below","this","value",".","verbose",":","bool",",","optional","Whether","per-iteration","convergence","reports","are","printed","to",":","data",":","`","sys.stderr","`",".","Convergence","can","also","be","diagnosed","using","the",":","attr",":","`","monitor_","`","attribute",".","params",",","init_params",":","string",",","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","'","e","'","for","emissionprob",".","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","compatability","."]
code: def __init__(
      self,
      n_components=1,
      startprob_prior=1.0,
      transmat_prior=1.0,
      *,
      emissionprob_prior=1.0,
      n_features=None,
      algorithm="viterbi",
      random_state=None,
      n_iter=10,
      tol=1e-2,
      verbose=False,
      params="ste",
      init_params="ste",
      implementation="log",
  ):
      """
      Parameters
      ----------
      n_components : int
          Number of states.
  
      startprob_prior : array, shape (n_components, ), optional
          Parameters of the Dirichlet prior distribution for
          :attr:`startprob_`.
  
      transmat_prior : array, shape (n_components, n_components), optional
          Parameters of the Dirichlet prior distribution for each row
          of the transition probabilities :attr:`transmat_`.
  
      emissionprob_prior : array, shape (n_components, n_features), optional
          Parameters of the Dirichlet prior distribution for
          :attr:`emissionprob_`.
  
      n_features: int, optional
          The number of categorical symbols in the HMM.  Will be inferred
          from the data if not set.
  
      algorithm : {"viterbi", "map"}, optional
          Decoder algorithm.
  
          - "viterbi": finds the most likely sequence of states, given all
            emissions.
          - "map" (also known as smoothing or forward-backward): finds the
            sequence of the individual most-likely states, given all
            emissions.
  
      random_state: RandomState or an int seed, optional
          A random number generator instance.
  
      n_iter : int, optional
          Maximum number of iterations to perform.
  
      tol : float, optional
          Convergence threshold. EM will stop if the gain in log-likelihood
          is below this value.
  
      verbose : bool, optional
          Whether per-iteration convergence reports are printed to
          :data:`sys.stderr`.  Convergence can also be diagnosed using the
          :attr:`monitor_` attribute.
  
      params, init_params : string, 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 'e' for
          emissionprob.  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 compatability.
      """
      BaseHMM.__init__(
          self,
          n_components,
          startprob_prior=startprob_prior,
          transmat_prior=transmat_prior,
          algorithm=algorithm,
          random_state=random_state,
          n_iter=n_iter,
          tol=tol,
          verbose=verbose,
          params=params,
          init_params=init_params,
          implementation=implementation,
      )
      self.emissionprob_prior = emissionprob_prior
      self.n_features = n_features
  
imports: import logging
  import numpy
  from scipy import linalg
  from sklearn import cluster
  from sklearn.utils import check_random_state
  from .None import _emissions, _utils
  from .base import BaseHMM
  from .utils import fill_covars, normalize
label_desc: Use image node_id 1 to create a new CategoricalHMM object from inherited base classes: _emissions, BaseHMM with example: obj = CategoricalHMM(n_components, startprob_prior, transmat_prior)