code: def test_non_negative_factorization_consistency(
      init, solver, alpha_W, alpha_H
  ):
      # Test that the function is called in the same way, either directly
      # or through the NMF class
      max_iter = 500
      rng = np.random.mtrand.RandomState(42)
      A = np.abs(rng.randn(10, 10))
      A[:, 2 * np.arange(5)] = 0
  
      W_nmf, H, _ = non_negative_factorization(
          A,
          init=init,
          solver=solver,
          max_iter=max_iter,
          alpha_W=alpha_W,
          alpha_H=alpha_H,
          random_state=1,
          tol=1e-2,
      )
      W_nmf_2, H, _ = non_negative_factorization(
          A,
          H=H,
          update_H=False,
          init=init,
          solver=solver,
          max_iter=max_iter,
          alpha_W=alpha_W,
          alpha_H=alpha_H,
          random_state=1,
          tol=1e-2,
      )
  
      model_class = NMF(
          init=init,
          solver=solver,
          max_iter=max_iter,
          alpha_W=alpha_W,
          alpha_H=alpha_H,
          random_state=1,
          tol=1e-2,
      )
      W_cls = model_class.fit_transform(A)
      W_cls_2 = model_class.transform(A)
  
      assert_allclose(W_nmf, W_cls)
      assert_allclose(W_nmf_2, W_cls_2)
  
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 17 for calling a global function with example usage: test_non_negative_factorization_consistency(init, solver, alpha_W, alpha_H) without return types