code: def test_n_features(self, implementation):
      sequences, lengths = self.get_from_one_beal(7, 100, None)
      # Learn n_Features
      model = vhmm.VariationalCategoricalHMM(
          4, implementation=implementation
      )
      assert_log_likelihood_increasing(model, sequences, lengths, 10)
      assert model.n_features == 3
      # Respect n_features
      model = vhmm.VariationalCategoricalHMM(
          4, implementation=implementation, n_features=5
      )
  
      assert_log_likelihood_increasing(model, sequences, lengths, 10)
      assert model.n_features == 5
  
      # Too few features
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              implementation=implementation,
          )
          model.n_features = 2
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # No Negative Values
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              implementation=implementation,
          )
          sequences[0] = -1
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
      # Must be integers
      with pytest.raises(ValueError):
          model = vhmm.VariationalCategoricalHMM(
              4,
              n_iter=500,
              random_state=1984,
              implementation=implementation,
          )
          sequences = sequences.astype(float)
          assert_log_likelihood_increasing(
              model, sequences, lengths, 10
          )
  
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 5 for calling the TestVariationalCategorical obj's underlying member method code with example usage: obj.test_n_features(implementation) without return types