code: def make_bin_weights(
      X,
      n_samples,
      sample_weight,
      feature_names_in,
      feature_types_in,
      bins,
      term_features,
  ):
      bin_weights = _none_list * len(term_features)
      for term_idx, bin_indexes in eval_terms(
          X,
          n_samples,
          feature_names_in,
          feature_types_in,
          bins,
          term_features,
      ):
          feature_idxs = term_features[term_idx]
          multiple = 1
          dimensions = []
          for dimension_idx in range(len(feature_idxs) - 1, -1, -1):
              feature_idx = feature_idxs[dimension_idx]
              bin_levels = bins[feature_idx]
              feature_bins = bin_levels[
                  min(len(bin_levels), len(feature_idxs)) - 1
              ]
              if isinstance(feature_bins, dict):
                  # categorical feature
                  n_bins = (
                      2
                      if len(feature_bins) == 0
                      else max(feature_bins.values()) + 2
                  )
              else:
                  # continuous feature
                  n_bins = len(feature_bins) + 3
  
              dimensions.append(n_bins)
              dim_data = bin_indexes[dimension_idx]
              dim_data = np.where(dim_data < 0, n_bins - 1, dim_data)
              if multiple == 1:
                  flat_indexes = dim_data
              else:
                  flat_indexes += dim_data * multiple
              multiple *= n_bins
          dimensions = tuple(reversed(dimensions))
  
          if sample_weight is None:
              term_bin_weights = np.bincount(
                  flat_indexes, minlength=multiple
              )
          else:
              term_bin_weights = np.bincount(
                  flat_indexes,
                  weights=sample_weight,
                  minlength=multiple,
              )
          term_bin_weights = term_bin_weights.astype(
              np.float64, copy=False
          )
          term_bin_weights = term_bin_weights.reshape(dimensions)
          bin_weights[term_idx] = term_bin_weights
  
      return bin_weights
  
file_path: interpret/python/interpret-core/interpret/glassbox/_ebm/_bin.py
imports: import logging
  import numpy
  from ...utils._native import Native
  from ...utils._clean_x import unify_columns
label_desc: Use image node_id 4 for calling a global function with example usage: make_bin_weights(X, n_samples, sample_weight, feature_names_in, feature_types_in, bins, term_features) and returns: bin_weights