code: def test_compare_with_categorical_hmm(self, implementation):
      n_components = 2  # ['Rainy', 'Sunny']
      n_features = 3  # ['walk', 'shop', 'clean']
      n_trials = 1
      startprob = np.array([0.6, 0.4])
      transmat = np.array([[0.7, 0.3], [0.4, 0.6]])
      emissionprob = np.array([[0.1, 0.4, 0.5], [0.6, 0.3, 0.1]])
      h1 = hmm.MultinomialHMM(
          n_components=n_components,
          n_trials=n_trials,
          implementation=implementation,
      )
      h2 = hmm.CategoricalHMM(
          n_components=n_components, implementation=implementation
      )
  
      h1.startprob_ = startprob
      h2.startprob_ = startprob
  
      h1.transmat_ = transmat
      h2.transmat_ = transmat
  
      h1.emissionprob_ = emissionprob
      h2.emissionprob_ = emissionprob
  
      X1 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
      X2 = [[0], [1], [2]]  # different input format for CategoricalHMM
      log_prob1, state_sequence1 = h1.decode(X1, algorithm="viterbi")
      log_prob2, state_sequence2 = h2.decode(X2, algorithm="viterbi")
      assert round(np.exp(log_prob1), 5) == 0.01344
      assert round(np.exp(log_prob2), 5) == 0.01344
  
      assert_allclose(state_sequence1, [1, 0, 0])
      assert_allclose(state_sequence2, [1, 0, 0])
  
      posteriors1 = h1.predict_proba(X1)
      assert_allclose(
          posteriors1,
          [
              [0.23170303, 0.76829697],
              [0.62406281, 0.37593719],
              [0.86397706, 0.13602294],
          ],
          rtol=0,
          atol=1e-6,
      )
  
      posteriors2 = h2.predict_proba(X2)
      assert_allclose(
          posteriors2,
          [
              [0.23170303, 0.76829697],
              [0.62406281, 0.37593719],
              [0.86397706, 0.13602294],
          ],
          rtol=0,
          atol=1e-6,
      )
  
file_path: hmmlearn/lib/hmmlearn/tests/test_multinomial_hmm.py
imports: import numpy
  from numpy.testing import assert_allclose
  import pytest
  from hmmlearn import hmm
  from .None import assert_log_likelihood_increasing, normalized
label_desc: Use image node_id 9 for calling the TestMultinomialHMM obj's underlying member method code with example usage: obj.test_compare_with_categorical_hmm(implementation) without return types