code: def test_init_incorrect_priors(self, implementation):
      sequences, lengths = self.get_from_one_beal(7, 100, None)
  
      # Test startprob shape
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="te",
              implementation=implementation,
          )
          model.startprob_prior_ = np.full((3,), 0.25)
          model.startprob_posterior_ = np.full((4,), 7 / 4)
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="te",
              implementation=implementation,
          )
          model.startprob_prior_ = np.full((4,), 0.25)
          model.startprob_posterior_ = np.full((3,), 7 / 4)
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # Test transmat shape
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="se",
              implementation=implementation,
          )
          model.transmat_prior_ = np.full((3, 3), 0.25)
          model.transmat_posterior_ = np.full((4, 4), 0.25)
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="se",
              implementation=implementation,
          )
          model.transmat_prior_ = np.full((4, 4), 0.25)
          model.transmat_posterior_ = np.full((3, 3), 7 / 4)
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # Test emission shape
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="st",
              implementation=implementation,
          )
          model.emissionprob_prior_ = np.full((3, 3), 1 / 3)
          model.emissionprob_posterior_ = np.asarray(
              [
                  [0.3, 0.4, 0.3],
                  [0.8, 0.1, 0.1],
                  [0.2, 0.2, 0.6],
                  [0.2, 0.6, 0.2],
              ]
          )
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # Test too many n_features
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="se",
              implementation=implementation,
          )
          model.emissionprob_prior_ = np.full((4, 4), 7 / 4)
          model.emissionprob_posterior_ = np.full((4, 4), 0.25)
          model.n_features_ = 10
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # Too small n_features
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              init_params="se",
              implementation=implementation,
          )
          model.emissionprob_prior_ = np.full((4, 4), 7 / 4)
          model.emissionprob_posterior_ = np.full((4, 4), 0.25)
  
          model.n_features_ = 1
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # Test that setting the desired prior value works
      model = vhmm.VariationalCategoricalHMM(
          4,
          n_iter=500,
          random_state=1984,
          init_params="ste",
          implementation=implementation,
          startprob_prior=1,
          transmat_prior=2,
          emissionprob_prior=3,
      )
      assert_log_likelihood_increasing(model, sequences, lengths, 10)
      assert np.all(model.startprob_prior_ == 1)
      assert np.all(model.transmat_prior_ == 2)
      assert np.all(model.emissionprob_prior_ == 3)
  
file_path: hmmlearn/lib/hmmlearn/tests/test_variational_categorical.py
imports: import numpy
  import pytest
  from sklearn.utils import check_random_state
  from hmmlearn import hmm, vhmm
  from .None import assert_log_likelihood_increasing, compare_variational_and_em_models, vi_uniform_startprob_and_transmat
label_desc: Use image node_id 6 for calling the TestVariationalCategorical obj's underlying member method code with example usage: obj.test_init_incorrect_priors(implementation) without return types