code: def _compute_loadings(components, data):
      ridge = Ridge(fit_intercept=False, alpha=1e-8)
      ridge.fit(components.T, np.asarray(data.T))
      loadings = ridge.coef_.T
  
      S = np.sqrt(np.sum(loadings**2, axis=0))
      S[S == 0] = 1
      loadings /= S[np.newaxis, :]
      return loadings
  
file_path: nilearn/nilearn/decomposition/dict_learning.py
imports: import warnings
  import numpy
  import sklearn
  from joblib import Memory
  from sklearn.decomposition import dict_learning_online
  from sklearn.linear_model import Ridge
  from nilearn._utils import fill_doc
  from nilearn._utils.helpers import _transfer_deprecated_param_vals
  from ._base import _BaseDecomposition
  from .canica import CanICA
label_desc: Use image node_id 1 for calling a global function with example usage: _compute_loadings(components, data) and returns: loadings