code: def _infer_dimension_(spectrum, n_samples, n_features):
      """Infers the dimension of a dataset of shape (n_samples, n_features)
  
      The dataset is described by its spectrum `spectrum`.
      """
      n_spectrum = len(spectrum)
      ll = np.empty(n_spectrum)
      for rank in range(n_spectrum):
          ll[rank] = _assess_dimension_(
              spectrum, rank, n_samples, n_features
          )
      return ll.argmax()
  
imports: from math import log, sqrt
  import numpy
  from scipy import linalg
  from scipy.special import gammaln
  from scipy.sparse import issparse
  from ..externals import six
  from .base import _BasePCA
  from ..base import BaseEstimator, TransformerMixin
  from ..utils import deprecated
  from ..utils import check_random_state, as_float_array
  from ..utils import check_array
  from ..utils.extmath import fast_dot, fast_logdet, randomized_svd, svd_flip
  from ..utils.validation import check_is_fitted
  from ..utils.arpack import svds
label_desc: Use image node_id 2 for calling a global function with example usage: _infer_dimension_(spectrum, n_samples, n_features) and returns: ll