code: def compute_alpha_max(emp_covs, n_samples):
      """Compute the critical value of the regularization parameter.
  
      Above this value, the precisions matrices computed by
      group_sparse_covariance are diagonal (complete sparsity)
  
      This function also returns the value below which the precision
      matrices are fully dense (i.e. minimal number of zero coefficients).
  
      The formula used in this function was derived using the same method
      as in :footcite:t:`Duchi2012`.
  
      Parameters
      ----------
      emp_covs : array-like, shape (n_features, n_features, n_subjects)
          covariance matrix for each subject.
  
      n_samples : array-like, shape (n_subjects,)
          number of samples used in the computation of every covariance matrix.
          n_samples.sum() can be arbitrary.
  
      Returns
      -------
      alpha_max : float
          minimal value for the regularization parameter that gives a
          fully sparse matrix.
  
      alpha_min : float
          minimal value for the regularization parameter that gives a fully
          dense matrix.
  
      References
      ----------
      .. footbibliography::
  
      """
      A = np.copy(emp_covs)
      n_samples = np.asarray(n_samples).copy()
      n_samples /= n_samples.sum()
  
      for k in range(emp_covs.shape[-1]):
          # Set diagonal to zero
          A[..., k].flat[:: A.shape[0] + 1] = 0
          A[..., k] *= n_samples[k]
  
      norms = np.sqrt((A**2).sum(axis=-1))
  
      return np.max(norms), np.min(norms[norms > 0])
  
imports: import collections.abc
  import itertools
  import operator
  import warnings
  import numpy
  import scipy.linalg
  from joblib import Memory, Parallel, delayed
  from sklearn.base import BaseEstimator
  from sklearn.covariance import empirical_covariance
  from sklearn.model_selection import check_cv
  from sklearn.utils.extmath import fast_logdet
  from .._utils import CacheMixin, logger
  from .._utils.extmath import is_spd
label_desc: Use image node_id 1 for calling a global function with example usage: compute_alpha_max(emp_covs, n_samples) and returns: np,  np