class_docstr: Abstract class - Build a class that inherits from this class to implement
  a custom discretizer.
  Method bins() is to be redefined in the child class, as it is the actual
  custom part of the discretizer.
class_docstr_tok: ["Abstract","class","-","Build","a","class","that","inherits","from","this","class","to","implement","a","custom","discretizer",".","Method","bins","(",")","is","to","be","redefined","in","the","child","class",",","as","it","is","the","actual","custom","part","of","the","discretizer","."]
docstr: Discretizes the data.
  Args:
      data: numpy 2d or 1d array
  Returns:
      numpy array of same dimension, discretized.
docstr_tok: ["Discretizes","the","data",".","Args",":","data",":","numpy","2d","or","1d","array","Returns",":","numpy","array","of","same","dimension",",","discretized","."]
code: def discretize(self, data):
      """Discretizes the data.
      Args:
          data: numpy 2d or 1d array
      Returns:
          numpy array of same dimension, discretized.
      """
      ret = data.copy()
      for feature in self.lambdas:
          if len(data.shape) == 1:
              ret[feature] = int(self.lambdas[feature](ret[feature]))
          else:
              ret[:, feature] = self.lambdas[feature](
                  ret[:, feature]
              ).astype(int)
      return ret
  
imports: import numpy
  import sklearn
  import sklearn.tree
  import scipy
  from sklearn.utils import check_random_state
  from abc import ABCMeta, abstractmethod
label_desc: Use image node_id 3 for calling the BaseDiscretizer obj's underlying member method code with example usage: obj.discretize(data) and returns: ret