code: def _alpha_grid(
      X,
      y,
      Xy=None,
      l1_ratio=1.0,
      fit_intercept=True,
      eps=1e-3,
      n_alphas=100,
      normalize=False,
      copy_X=True,
  ):
      """Compute the grid of alpha values for elastic net parameter search
  
      Parameters
      ----------
      X : {array-like, sparse matrix}, shape (n_samples, n_features)
          Training data. Pass directly as Fortran-contiguous data to avoid
          unnecessary memory duplication
  
      y : ndarray, shape (n_samples,)
          Target values
  
      Xy : array-like, optional
          Xy = np.dot(X.T, y) that can be precomputed.
  
      l1_ratio : float
          The elastic net mixing parameter, with ``0 < l1_ratio <= 1``.
          For ``l1_ratio = 0`` the penalty is an L2 penalty. (currently not
          supported) ``For l1_ratio = 1`` it is an L1 penalty. For
          ``0 < l1_ratio <1``, the penalty is a combination of L1 and L2.
  
      eps : float, optional
          Length of the path. ``eps=1e-3`` means that
          ``alpha_min / alpha_max = 1e-3``
  
      n_alphas : int, optional
          Number of alphas along the regularization path
  
      fit_intercept : boolean, default True
          Whether to fit an intercept or not
  
      normalize : boolean, optional, default False
          If ``True``, the regressors X will be normalized before regression.
          This parameter is ignored when ``fit_intercept`` is set to ``False``.
          When the regressors are normalized, note that this makes the
          hyperparameters learnt more robust and almost independent of the number
          of samples. The same property is not valid for standardized data.
          However, if you wish to standardize, please use
          :class:`preprocessing.StandardScaler` before calling ``fit`` on an estimator
          with ``normalize=False``.
  
      copy_X : boolean, optional, default True
          If ``True``, X will be copied; else, it may be overwritten.
      """
      if l1_ratio == 0:
          raise ValueError(
              "Automatic alpha grid generation is not supported for"
              " l1_ratio=0. Please supply a grid by providing "
              "your estimator with the appropriate `alphas=` "
              "argument."
          )
      n_samples = len(y)
  
      sparse_center = False
      if Xy is None:
          X_sparse = sparse.isspmatrix(X)
          sparse_center = X_sparse and (fit_intercept or normalize)
          X = check_array(
              X, "csc", copy=(copy_X and fit_intercept and not X_sparse)
          )
          if not X_sparse:
              # X can be touched inplace thanks to the above line
              X, y, _, _, _ = _preprocess_data(
                  X, y, fit_intercept, normalize, copy=False
              )
          Xy = safe_sparse_dot(X.T, y, dense_output=True)
  
          if sparse_center:
              # Workaround to find alpha_max for sparse matrices.
              # since we should not destroy the sparsity of such matrices.
              _, _, X_offset, _, X_scale = _preprocess_data(
                  X, y, fit_intercept, normalize, return_mean=True
              )
              mean_dot = X_offset * np.sum(y)
  
      if Xy.ndim == 1:
          Xy = Xy[:, np.newaxis]
  
      if sparse_center:
          if fit_intercept:
              Xy -= mean_dot[:, np.newaxis]
          if normalize:
              Xy /= X_scale[:, np.newaxis]
  
      alpha_max = np.sqrt(np.sum(Xy**2, axis=1)).max() / (
          n_samples * l1_ratio
      )
  
      if alpha_max <= np.finfo(float).resolution:
          alphas = np.empty(n_alphas)
          alphas.fill(np.finfo(float).resolution)
          return alphas
  
      return np.logspace(
          np.log10(alpha_max * eps), np.log10(alpha_max), num=n_alphas
      )[::-1]
  
imports: import sys
  import warnings
  from abc import ABCMeta, abstractmethod
  import numpy
  from scipy import sparse
  from .base import LinearModel, _pre_fit
  from ..base import RegressorMixin
  from .base import _preprocess_data
  from ..utils import check_array, check_X_y, deprecated
  from ..utils.validation import check_random_state
  from ..model_selection import check_cv
  from ..externals.joblib import Parallel, delayed
  from ..externals import six
  from ..externals.six.moves import xrange
  from ..utils.extmath import safe_sparse_dot
  from ..utils.validation import check_is_fitted
  from ..utils.validation import column_or_1d
  from ..exceptions import ConvergenceWarning
  from .None import cd_fast
label_desc: Use image node_id 1 for calling a global function with example usage: _alpha_grid(X, y, Xy, l1_ratio, fit_intercept, eps, n_alphas, normalize, copy_X) and returns: np, alphas