code: def assert_log_likelihood_increasing(h, X, lengths, n_iter):
      h.n_iter = 1  # make sure we do a single iteration at a time
      h.init_params = ""  # and don't re-init params
      log_likelihoods = np.empty(n_iter, dtype=float)
      for i in range(n_iter):
          h.fit(X, lengths=lengths)
          log_likelihoods[i] = h.score(X, lengths=lengths)
  
      # XXX the rounding is necessary because LL can oscillate in the
      #     fractional part, failing the tests.
      diff = np.diff(log_likelihoods)
      value = np.finfo(float).eps ** (1 / 2)
      assert diff.max() > value, (
          f"Non-increasing log-likelihoods:\n"
          f"lls={log_likelihoods}\n"
          f"diff={diff}\n"
          f"diff.max() < value={diff.min() < value}\n"
          f"np.finfo(float).eps={value}\n"
      )
  
file_path: hmmlearn/lib/hmmlearn/tests/__init__.py
imports: import numpy
  import pytest
  from sklearn.datasets import make_spd_matrix
  from sklearn.utils import check_random_state
  from hmmlearn.utils import normalize
  from hmmlearn.base import DECODER_ALGORITHMS
label_desc: Use image node_id 3 for calling a global function with example usage: assert_log_likelihood_increasing(h, X, lengths, n_iter) without return types