code: def test_minibatch_nmf_partial_fit():
      # Check fit / partial_fit equivalence. Applicable only with fresh restarts.
      rng = np.random.mtrand.RandomState(42)
      X = np.abs(rng.randn(100, 5))
  
      n_components = 5
      batch_size = 10
      max_iter = 2
  
      mbnmf1 = MiniBatchNMF(
          n_components=n_components,
          init="custom",
          random_state=0,
          max_iter=max_iter,
          batch_size=batch_size,
          tol=0,
          max_no_improvement=None,
          fresh_restarts=False,
      )
      mbnmf2 = MiniBatchNMF(
          n_components=n_components, init="custom", random_state=0
      )
  
      # Force the same init of H (W is recomputed anyway) to be able to compare results.
      W, H = nmf._initialize_nmf(
          X, n_components=n_components, init="random", random_state=0
      )
  
      mbnmf1.fit(X, W=W, H=H)
      for i in range(max_iter):
          for j in range(batch_size):
              mbnmf2.partial_fit(
                  X[j : j + batch_size], W=W[:batch_size], H=H
              )
  
      assert mbnmf1.n_steps_ == mbnmf2.n_steps_
      assert_allclose(mbnmf1.components_, mbnmf2.components_)
  
imports: import re
  import sys
  import warnings
  from io import StringIO
  import numpy
  import pytest
  from scipy import linalg
  from sklearn.base import clone
  from sklearn.decomposition import NMF, MiniBatchNMF, non_negative_factorization
  from sklearn.decomposition import _nmf
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils._testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, assert_array_equal, ignore_warnings
  from sklearn.utils.extmath import squared_norm
  from sklearn.utils.fixes import CSC_CONTAINERS, CSR_CONTAINERS
label_desc: Use image node_id 32 for calling a global function with example usage: test_minibatch_nmf_partial_fit() without return types