code: def _init(X, Y, settings):
      """Initialize HDMR variables."""
      N, d, maxorder, maxiter, m, K, R, alpha, lambdax = settings
  
      # Setup Bootstrap (if K > 1)
      if K == 1:
          # No Bootstrap
          idx = np.arange(0, N).reshape(N, 1)
      else:
          # Now setup the bootstrap matrix with selection matrix, idx, for samples
          idx = np.argsort(np.random.rand(N, K), axis=0)[:R]
  
      # Compute normalized X-values
      X_n = (X - np.tile(X.min(0), (N, 1))) / np.tile(
          (X.max(0)) - X.min(0), (N, 1)
      )
  
      # DICT Em: Important variables
      n2 = 0
      n3 = 0
      c2 = np.empty
      c3 = np.empty
  
      # determine all combinations of parameters (coefficients) for each order
      c1 = np.arange(0, d)
      n1 = d
  
      # now return based on maxorder used
      if maxorder > 1:
          c2 = np.asarray(
              list(itertools.combinations(np.arange(0, d), 2))
          )
          n2 = c2.shape[0]
      if maxorder == 3:
          c3 = np.asarray(
              list(itertools.combinations(np.arange(0, d), 3))
          )
          n3 = c3.shape[0]
  
      # calculate total number of coefficients
      n = n1 + n2 + n3
  
      # Initialize m1, m2 and m3 - number of coefficients first, second, third
      # order
      m1 = m + 3
      m2 = m1**2
      m3 = m1**3
  
      # STRUCTURE Em: Initialization
      Em = {
          "nterms": np.zeros(K),
          "RMSE": np.zeros(K),
          "m": m,
          "Y_e": np.zeros((R, K)),
          "f0": np.zeros(K),
          "c1": c1,
          "C1": np.zeros((m1, n1, K)),
          "C2": np.zeros((1, 1, K)),
          "C3": np.zeros((1, 1, K)),
          "n": n,
          "n1": n1,
          "n2": n2,
          "n3": n3,
          "maxorder": maxorder,
          "select": np.zeros((n, K)),
          "B1": np.zeros((N, m1, n1)),
      }
  
      if maxorder >= 2:
          Em.update(
              {
                  "c2": c2,
                  "B2": np.zeros((N, m2, n2)),
                  "C2": np.zeros((m2, n2, K)),
              }
          )
      if maxorder >= 3:
          Em.update(
              {
                  "c3": c3,
                  "B3": np.zeros((N, m3, n3)),
                  "C3": np.zeros((m3, n3, K)),
              }
          )
  
      # Compute cubic B-spline
      Em["B1"] = B_spline(X_n, m, d)
  
      # Now compute B values for second order
      if maxorder > 1:
          beta = np.array(list(itertools.product(range(m1), repeat=2)))
          for k, j in itertools.product(range(n2), range(m2)):
              Em["B2"][:, j, k] = np.multiply(
                  Em["B1"][:, beta[j, 0], Em["c2"][k, 0]],
                  Em["B1"][:, beta[j, 1], Em["c2"][k, 1]],
              )
  
      # Compute B values for third order
      if maxorder == 3:
          # Now compute B values for third order
          beta = np.array(list(itertools.product(range(m1), repeat=3)))
          EmB1 = Em["B1"]
  
          for k, j in itertools.product(range(n3), range(m3)):
              Emc3_k = Em["c3"][k]
              beta_j = beta[j]
              Em["B3"][:, j, k] = np.multiply(
                  np.multiply(
                      EmB1[:, beta_j[0], Emc3_k[0]],
                      EmB1[:, beta_j[1], Emc3_k[1]],
                  ),
                  EmB1[:, beta_j[2], Emc3_k[2]],
              )
  
      # DICT SA: Sensitivity analysis and analysis of variance decomposition
      em_k = np.zeros((Em["n"], K))
      SA = {
          "S": em_k,
          "Sa": em_k.copy(),
          "Sb": em_k.copy(),
          "ST": np.zeros((d, K)),
          "V_Y": np.zeros((K, 1)),
      }
  
      # Return runtime
      RT = np.zeros(K)
  
      # Initialize emulator matrix
      Y_em = np.zeros((R, Em["n"]))
  
      # Initialize index of first, second and third order terms (columns of Y_em)
      j1 = range(n1)
      j2 = range(n1, n1 + n2)
      j3 = range(n1 + n2, n1 + n2 + n3)
  
      # Initialize temporary Y_id for bootstrap
      Y_id = np.zeros(R)
  
      return [Em, idx, SA, RT, Y_em, Y_id, m1, m2, m3, j1, j2, j3]
  
imports: from typing import Dict
  from types import MethodType
  import itertools
  import time
  import warnings
  import numpy
  from numpy.linalg import solve
  from numpy.linalg import svd
  from numpy import identity
  import pandas
  from scipy import stats, special, interpolate
  from .None import common_args
  from ..util import read_param_file, ResultDict
  from SALib.plotting.hdmr import plot
  from SALib.util.problem import ProblemSpec
label_desc: Use image node_id 4 for calling a global function with example usage: _init(X, Y, settings) and returns: list