code: def _infer_dimension_(spectrum, n_samples, n_features):
      """Infer the dimension of a dataset of shape (n_samples, n_features).
  
      The dataset is described by its spectrum `spectrum`.
      """
      n_spectrum = len(spectrum)
      ll = gs.empty(n_spectrum)
      for rank in range(n_spectrum):
          ll[rank] = _assess_dimension_(
              spectrum, rank, n_samples, n_features
          )
      return ll.argmax()
  
imports: import numbers
  from math import log
  from scipy.special import gammaln
  from sklearn.decomposition._base import _BasePCA
  from sklearn.utils.extmath import stable_cumsum, svd_flip
  import geomstats.backend
  from geomstats.geometry.matrices import Matrices
  from geomstats.geometry.symmetric_matrices import SymmetricMatrices
  from geomstats.learning.exponential_barycenter import ExponentialBarycenter
  from geomstats.learning.frechet_mean import FrechetMean
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