code: def test_nmf_sparse_input(
      Estimator, solver, sparse_container, alpha_W, alpha_H
  ):
      # Test that sparse matrices are accepted as input
      rng = np.random.mtrand.RandomState(42)
      A = np.abs(rng.randn(10, 10))
      A[:, 2 * np.arange(5)] = 0
      A_sparse = sparse_container(A)
  
      est1 = Estimator(
          n_components=5,
          init="random",
          alpha_W=alpha_W,
          alpha_H=alpha_H,
          random_state=0,
          tol=0,
          max_iter=100,
          **solver,
      )
      est2 = clone(est1)
  
      W1 = est1.fit_transform(A)
      W2 = est2.fit_transform(A_sparse)
      H1 = est1.components_
      H2 = est2.components_
  
      assert_allclose(W1, W2)
      assert_allclose(H1, H2)
  
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 15 for calling a global function with example usage: test_nmf_sparse_input(Estimator, solver, sparse_container, alpha_W, alpha_H) without return types