docstr: Initialize the discretizer.
  
  Parameters
  ----------
  data
      Data to discretize.
  numerical_features
      List of indices corresponding to the continuous feature columns. Only these features will be discretized.
  feature_names
      List with feature names.
  percentiles
      Percentiles used for discretization.
code: def __init__(
      self,
      data: np.ndarray,
      numerical_features: List[int],
      feature_names: List[str],
      percentiles: Sequence[Union[int, float]] = (25, 50, 75),
  ) -> None:
      """
      Initialize the discretizer.
  
      Parameters
      ----------
      data
          Data to discretize.
      numerical_features
          List of indices corresponding to the continuous feature columns. Only these features will be discretized.
      feature_names
          List with feature names.
      percentiles
          Percentiles used for discretization.
      """
  
      self.to_discretize = numerical_features
      self.percentiles = percentiles
  
      bins = self.bins(data)
      bins = [np.unique(x) for x in bins]
  
      self.feature_intervals: Dict[int, list] = {}
      self.lambdas: Dict[int, Callable] = {}
      for feature, qts in zip(self.to_discretize, bins):
          # get nb of borders (nb of bins - 1) and the feature name
          n_bins = qts.shape[0]
          name = feature_names[feature]
  
          # create names for bins of discretized features
          self.feature_intervals[feature] = [
              "%s <= %.2f" % (name, qts[0])
          ]
          for i in range(n_bins - 1):
              self.feature_intervals[feature].append(
                  "%.2f < %s <= %.2f" % (qts[i], name, qts[i + 1])
              )
          self.feature_intervals[feature].append(
              "%s > %.2f" % (name, qts[n_bins - 1])
          )
          self.lambdas[feature] = partial(self.get_percentiles, qts=qts)
  
file_path: alibi/alibi/utils/discretizer.py
imports: import numpy
  from alibi.tests.utils import issorted
  from functools import partial
  from typing import Dict, Callable, List, Sequence, Union
label_desc: Use image node_id 1 to create a new Discretizer object from inherited base classes: object with example: obj = Discretizer(data, numerical_features, feature_names, percentiles)