code: def bin_native_by_dimension(
      n_classes,
      n_dimensions,
      bins,
      X,
      y,
      sample_weight,
      feature_names_in,
      feature_types_in,
  ):
      # called under: fit
  
      feature_idxs = range(len(feature_names_in))
      bins_iter = []
      for feature_idx in feature_idxs:
          bin_levels = bins[feature_idx]
          feature_bins = bin_levels[
              min(len(bin_levels), n_dimensions) - 1
          ]
          bins_iter.append(feature_bins)
  
      return bin_native(
          n_classes,
          feature_idxs,
          bins_iter,
          X,
          y,
          sample_weight,
          feature_names_in,
          feature_types_in,
      )
  
imports: import logging
  import numpy
  from ._native import Native
  from ._clean_x import unify_columns
label_desc: Use image node_id 2 for calling a global function with example usage: bin_native_by_dimension(n_classes, n_dimensions, bins, X, y, sample_weight, feature_names_in, feature_types_in) and returns: bin_native