code: def _solve_cholesky(X, y, alpha):
      # w = inv(X^t X + alpha*Id) * X.T y
      n_samples, n_features = X.shape
      n_targets = y.shape[1]
  
      A = safe_sparse_dot(X.T, X, dense_output=True)
      Xy = safe_sparse_dot(X.T, y, dense_output=True)
  
      one_alpha = np.array_equal(alpha, len(alpha) * [alpha[0]])
  
      if one_alpha:
          A.flat[:: n_features + 1] += alpha[0]
          return linalg.solve(A, Xy, sym_pos=True, overwrite_a=True).T
      else:
          coefs = np.empty([n_targets, n_features])
          for coef, target, current_alpha in zip(coefs, Xy.T, alpha):
              A.flat[:: n_features + 1] += current_alpha
              coef[:] = linalg.solve(
                  A, target, sym_pos=True, overwrite_a=False
              ).ravel()
              A.flat[:: n_features + 1] -= current_alpha
          return coefs
  
imports: from abc import ABCMeta, abstractmethod
  import warnings
  import numpy
  from scipy import linalg
  from scipy import sparse
  from scipy.sparse import linalg
  from .base import LinearClassifierMixin, LinearModel, _rescale_data
  from .sag import sag_solver
  from ..base import RegressorMixin
  from ..utils.extmath import safe_sparse_dot
  from ..utils.extmath import row_norms
  from ..utils import check_X_y
  from ..utils import check_array
  from ..utils import check_consistent_length
  from ..utils import compute_sample_weight
  from ..utils import column_or_1d
  from ..preprocessing import LabelBinarizer
  from ..model_selection import GridSearchCV
  from ..externals import six
  from ..metrics.scorer import check_scoring
label_desc: Use image node_id 3 for calling a global function with example usage: _solve_cholesky(X, y, alpha) and returns: linalg, coefs