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 = np.empty(n_spectrum)
      for rank in range(n_spectrum):
          ll[rank] = _assess_dimension_(
              spectrum, rank, n_samples, n_features
          )
      return ll.argmax()
  
imports: import inspect
  import operator
  import os
  import warnings
  from contextlib import contextmanager
  from io import StringIO
  from math import log
  from pprint import pprint
  import numpy
label_desc: Use image node_id 12 for calling a global function with example usage: _infer_dimension_(spectrum, n_samples, n_features) and returns: ll