def _infer_dimension_(spectrum, n_samples, n_features):
 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()

def _infer_dimension_ ( spectrum , n_samples , n_features ) : 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 ( )
infers the dimension of a dataset of shape the dataset is described by its spectrum spectrum .