code: def test_monotonic_likelihood():
      # We check that each step of the each step of variational inference without
      # regularization improve monotonically the training set of the bound
      rng = np.random.RandomState(0)
      rand_data = RandomData(rng, scale=20)
      n_components = rand_data.n_components
  
      for prior_type in PRIOR_TYPE:
          for covar_type in COVARIANCE_TYPE:
              X = rand_data.X[covar_type]
              bgmm = BayesianGaussianMixture(
                  weight_concentration_prior_type=prior_type,
                  n_components=2 * n_components,
                  covariance_type=covar_type,
                  warm_start=True,
                  max_iter=1,
                  random_state=rng,
                  tol=1e-3,
              )
              current_lower_bound = -np.inf
              # Do one training iteration at a time so we can make sure that the
              # training log likelihood increases after each iteration.
              for _ in range(600):
                  prev_lower_bound = current_lower_bound
                  current_lower_bound = bgmm.fit(X).lower_bound_
                  assert current_lower_bound >= prev_lower_bound
  
                  if bgmm.converged_:
                      break
              assert bgmm.converged_
  
imports: import copy
  import numpy
  import pytest
  from scipy.special import gammaln
  from sklearn.exceptions import ConvergenceWarning, NotFittedError
  from sklearn.metrics.cluster import adjusted_rand_score
  from sklearn.mixture import BayesianGaussianMixture
  from sklearn.mixture._bayesian_mixture import _log_dirichlet_norm, _log_wishart_norm
  from sklearn.mixture.tests.test_gaussian_mixture import RandomData
  from sklearn.utils._testing import assert_almost_equal, assert_array_equal, ignore_warnings
label_desc: Use image node_id 8 for calling a global function with example usage: test_monotonic_likelihood() without return types