code: def _orth_poly_coeff(X, hdmr):
      """Calculates the coefficients of orthonormal polynomials based on a given
      input matrix `X`
  
      Parameters
      ----------
      X : numpy.array
          Normalized Input matrix `X`
      hdmr : namedtuple
          Core parameters of hdmr expansion
  
      Returns
      -------
      coeff : numpy.array
          Orthonormal polynomial coefficients from highes degree to constant term
            with trailing zeros
  
      Notes
      ----------
      Please see the reference below
  
      .. [1] Szegő, G. 1975. . Orthogonal Polynomials. American Mathematical Society.
      """
      p_o_1 = hdmr.p_o + 1
      M = np.zeros((p_o_1, p_o_1, hdmr.d))
      for i in range(hdmr.d):
          k = 0
          for j in range(p_o_1):
              for z in range(p_o_1):
                  M[j, z, i] = sum(X[:, i] ** k) / X.shape[0]
                  k += 1
              k = j + 1
  
      coeff = np.zeros((hdmr.p_o, p_o_1, hdmr.d))
      for i, j in product(range(hdmr.d), range(hdmr.p_o)):
          z = range(j + 2)
          for k in z:
              z__k = list(z)
              z__k.pop(k)
              det_ij = det(M[: j + 1, : j + 1, i]) * det(
                  M[: j + 2, : j + 2, i]
              )
              coeff[j, j + 1 - k, i] = (
                  (-1) ** (j + k + 1)
                  * det(M[: j + 1, z__k, i])
                  / np.sqrt(det_ij)
              )
  
      return coeff
  
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 5 for calling a global function with example usage: _orth_poly_coeff(X, hdmr) and returns: coeff