code: def _core_params(
      problem: Dict,
      N: int,
      d: int,
      f0: float,
      poly_order: int,
      max_order: int,
      bootstrap: int,
      subset: int,
      extended_base: bool,
  ) -> Tuple[namedtuple, ResultDict]:
      """This function establishes the core parameters of an HDMR
      (High Dimensional Model Representation) expansion and returns
      them in a namedtuple an ResultDict datatype. These parameters
      are used across all functions and procedures related to HDMR.
  
      Parameters
      ----------
      problem : Dict
          Problem definition
      N : int
          Number of samples in input matrix `X`.
      d : int
          Dimensionality of the problem.
      f0 : float
          Zero-th component function
      poly_order : int
          Polynomial order to be used to calculate orthonormal polynomial.
      max_order : int
          Maximum functional ANOVA expansion order.
      bootstrap : int
          Number of iteration to be used in bootstrap.
      subset : int
          Number of samples to be used in bootstrap.
      extended_base : bool
          Whether to use extended basis matrix or not.
  
      Returns
      -------
      hdmr : namedtuple
         Core parameters of hdmr expansion
  
      Si : ResultDict
          Sensitivity Indices
  
      HDMR Attributes
      ---------------
      N : int
          Number of samples in input matrix `X`.
      d : int
          Dimensionality of the problem.
      max_order : int
          Maximum functional ANOVA expansion order.
      ext_base : bool
          Whether to use extended basis matrix or not.
      subset : int
          Number of samples to be used in bootstrap.
      p_o : int
          Polynomial order to be used to calculated orthonormal polynomial.
      nc1 : int
          Number of component functions in 1st order.
      nc2 : int
          Number of component functions in 2nd order.
      nc3 int
          Number of component functions in 3rd order.
      nc_t : int
          Total number of component functions.
      nt1 : int
          Total number of terms(columns) for a given 1st order component function
      nt2 : int
          Total number of terms(columns) for a given 2nd order component function
      nt3 : int
          Total number of terms(columns) for a given 3rd order component function
      tnt1 : int
          Total number of terms(columns) for all 1st order component functions
      tnt2 : int
          Total number of terms(columns) for all 2nd order component functions
      tnt3 : int
          Total number of terms(columns) for all 3rd order component functions
      a_tnt : int
          All terms (columns) in a hdmr expansion
      x : numpy.array
          Solution of hdmr expansion
      idx : numpy.array
          Indexes of subsamples to be used for bootstrap
      beta : numpy.array
          Arrangement of second-order component functions
      gamma : numpy.array
          Arrangement of third-order component functions
      f0 : float
          Zero-th component function
  
      Si Keys
      -------
      - "S" : numpy.array
          Sensitivity index (total contribution)
      - "S_conf" : numpy.array
          Statistical confidence interval of `S`
      - "S_sum" : numpy.array
          Sum of sensitivity indexes (total contribution)
      - "S_sum_conf" : numpy.array
          Statistical confidence interval of sum of `S`
      - "Sa" : numpy.array
          Sensitivity index (uncorrelated contribution)
      - "Sa_conf" : numpy.array
          Statistical confidence interval of `Sa`
      - "Sa_sum" : numpy.array
          Sum of sensitivity indexes (uncorrelated contribution)
      - "Sa_sum_conf" : numpy.array
          Statistical confidence interval of sum of `Sa`
      - "Sb" : numpy.array
          Sensitivity index (correlated contribution)
      - "Sb_conf" : numpy.array
          Statistical confidence interval of `Sb`
      - "Sb_sum" : numpy.array
          Sum of sensitivity indexes (correlated contribution)
      - "Sb_sum_conf" : numpy.array
          Statistical confidence interval of sum of `Sb`
      - "ST" : numpy.array
          Total Sensitivity indexes of features/inputs
      - "ST_conf" : numpy.array
          Statistical confidence interval of `ST`
      - "Signf" : numpy.array
          Signigicancy for each bootstrap iteration
      - "Term" : numpy.array
          Component name
      """
  
      cp = defaultdict(int)
      cp["n_comp_func"], cp["n_coeff"] = [0] * 3, [0] * 3
      cp["n_comp_func"][0] = d
      cp["n_coeff"][0] = poly_order
  
      if max_order > 1:
          cp["n_comp_func"][1] = math.comb(d, 2)
          cp["n_coeff"][1] = poly_order**2
          if extended_base:
              cp["n_coeff"][1] += 2 * poly_order
  
      if max_order == 3:
          cp["n_comp_func"][2] = math.comb(d, 3)
          cp["n_coeff"][2] = poly_order**3
          if extended_base:
              cp["n_coeff"][2] += 3 * poly_order + 3 * poly_order**2
  
      # Setup Bootstrap (if bootstrap > 1)
      idx = (
          np.arange(0, N).reshape(-1, 1)
          if bootstrap == 1
          else np.argsort(np.random.rand(N, bootstrap), axis=0)[:subset]
      )
  
      CoreParams = namedtuple(
          "CoreParams",
          [
              "N",
              "d",
              "max_order",
              "ext_base",
              "subset",
              "p_o",
              "nc1",
              "nc2",
              "nc3",
              "nc_t",
              "nt1",
              "nt2",
              "nt3",
              "tnt1",
              "tnt2",
              "tnt3",
              "a_tnt",
              "x",
              "idx",
              "beta",
              "gamma",
              "f0",
          ],
      )
  
      n_comp_func = cp["n_comp_func"]
      n_coeff = cp["n_coeff"]
      hdmr = CoreParams(
          N,
          d,
          max_order,
          extended_base,
          subset,
          poly_order,
          n_comp_func[0],
          n_comp_func[1],
          n_comp_func[2],
          sum(n_comp_func),
          n_coeff[0],
          n_coeff[1],
          n_coeff[2],
          n_coeff[0] * n_comp_func[0],
          n_coeff[1] * n_comp_func[1],
          n_coeff[2] * n_comp_func[2],
          n_coeff[0] * n_comp_func[0]
          + n_coeff[1] * n_comp_func[1]
          + n_coeff[2] * n_comp_func[2],
          np.zeros(
              (
                  n_coeff[0] * n_comp_func[0]
                  + n_coeff[1] * n_comp_func[1]
                  + n_coeff[2] * n_comp_func[2],
                  bootstrap,
              )
          ),
          idx,
          np.array(list(comb(range(d), 2))),
          np.array(
              list(comb(range(d), 3))
          ),  # Returns empty list when d < 3
          f0,
      )
  
      # Create Sensitivity Indices Result Dictionary
      keys = (
          "Sa",
          "Sa_conf",
          "Sb",
          "Sb_conf",
          "S",
          "S_conf",
          "Signf",
          "Sa_sum",
          "Sa_sum_conf",
          "Sb_sum",
          "Sb_sum_conf",
          "S_sum",
          "S_sum_conf",
      )
      Si = ResultDict(
          (k, np.zeros((hdmr.nc_t, bootstrap)))
          if k in ("S", "Sa", "Sb", "Signf")
          else (k, np.zeros(hdmr.nc_t))
          for k in keys
      )
      Si["Term"] = problem["names"]
      Si["ST"] = np.full(hdmr.nc_t, np.nan)
      Si["ST_conf"] = np.full(hdmr.nc_t, np.nan)
  
      # Generate index column for printing results
      if max_order > 1:
          for i in range(hdmr.nc2):
              Si["Term"].extend(
                  [
                      "/".join(
                          [
                              problem["names"][hdmr.beta[i, 0]],
                              problem["names"][hdmr.beta[i, 1]],
                          ]
                      )
                  ]
              )
  
      if max_order == 3:
          for i in range(hdmr.nc3):
              Si["Term"].extend(
                  [
                      "/".join(
                          [
                              problem["names"][hdmr.gamma[i, 0]],
                              problem["names"][hdmr.gamma[i, 1]],
                              problem["names"][hdmr.gamma[i, 2]],
                          ]
                      )
                  ]
              )
  
      return (hdmr, Si)
  
imports: import math
  import warnings
  from typing import Dict, Tuple
  from types import MethodType
  from itertools import combinations, product
  from collections import defaultdict, namedtuple
  import numpy
  from pandas import DataFrame
  from numpy.linalg import det, pinv, matrix_rank
  from scipy.linalg import svd, LinAlgError, solve
  from scipy import stats, special
  from .None import common_args
  from ..util import read_param_file, ResultDict
label_desc: Use image node_id 3 for calling a global function with example usage: _core_params(problem, N, d, f0, poly_order, max_order, bootstrap, subset, extended_base) and returns: hdmr,  Si