code: def test_fit_transform(global_random_seed, global_dtype):
      """Test unit variance of transformed data using FastICA algorithm.
  
      Check that `fit_transform` gives the same result as applying
      `fit` and then `transform`.
  
      Bug #13056
      """
      # multivariate uniform data in [0, 1]
      rng = np.random.RandomState(global_random_seed)
      X = rng.random_sample((100, 10)).astype(global_dtype)
      max_iter = 300
      for whiten, n_components in [["unit-variance", 5], [False, None]]:
          n_components_ = (
              n_components if n_components is not None else X.shape[1]
          )
  
          ica = FastICA(
              n_components=n_components,
              max_iter=max_iter,
              whiten=whiten,
              random_state=0,
          )
          with warnings.catch_warnings():
              # make sure that numerical errors do not cause sqrt of negative
              # values
              warnings.simplefilter("error", RuntimeWarning)
              # XXX: for some seeds, the model does not converge.
              # However this is not what we test here.
              warnings.simplefilter("ignore", ConvergenceWarning)
              Xt = ica.fit_transform(X)
          assert ica.components_.shape == (n_components_, 10)
          assert Xt.shape == (X.shape[0], n_components_)
  
          ica2 = FastICA(
              n_components=n_components,
              max_iter=max_iter,
              whiten=whiten,
              random_state=0,
          )
          with warnings.catch_warnings():
              # make sure that numerical errors do not cause sqrt of negative
              # values
              warnings.simplefilter("error", RuntimeWarning)
              warnings.simplefilter("ignore", ConvergenceWarning)
              ica2.fit(X)
          assert ica2.components_.shape == (n_components_, 10)
          Xt2 = ica2.transform(X)
  
          # XXX: we have to set atol for this test to pass for all seeds when
          # fitting with float32 data. Is this revealing a bug?
          if global_dtype:
              atol = np.abs(Xt2).mean() / 1e6
          else:
              atol = 0.0  # the default rtol is enough for float64 data
          assert_allclose(Xt, Xt2, atol=atol)
  
imports: import itertools
  import os
  import warnings
  import numpy
  import pytest
  from scipy import stats
  from sklearn.decomposition import PCA, FastICA, fastica
  from sklearn.decomposition._fastica import _gs_decorrelation
  from sklearn.exceptions import ConvergenceWarning
  from sklearn.utils._testing import assert_allclose
label_desc: Use image node_id 9 for calling a global function with example usage: test_fit_transform(global_random_seed, global_dtype) without return types