code: def test_pca_zero_noise_variance_edge_cases(setup):
      # ensure that noise_variance_ is 0 in edge cases
      # when n_components == min(n_samples, n_features)
      n, p = 100, 3
  
      rng = np.random.RandomState(0)
      X = mt.tensor(rng.randn(n, p) * 0.1) + mt.array([3, 4, 5])
      # arpack raises ValueError for n_components == min(n_samples,
      # n_features)
      svd_solvers = ["full", "randomized"]
  
      for svd_solver in svd_solvers:
          pca = PCA(svd_solver=svd_solver, n_components=p)
          pca.fit(X)
          assert pca.noise_variance_ == 0
  
          pca.fit(X.T)
          assert pca.noise_variance_ == 0
  
imports: from itertools import product
  import numpy
  import pytest
  import scipy
  from sklearn import datasets
  from sklearn.utils._testing import assert_array_almost_equal, assert_almost_equal, assert_raises_regex, assert_raise_message, assert_raises
  from ....None import tensor
  from .._pca import PCA, _assess_dimension, _infer_dimension
label_desc: Use image node_id 23 for calling a global function with example usage: test_pca_zero_noise_variance_edge_cases(setup) without return types