class_docstr: Allows the discretisation of numeric data.
  
  Example:
  ::
      >>> import causalnex
      >>> import pandas as pd
      >>>
      >>> df = pd.DataFrame({'Age': [12, 13, 18, 19, 22, 60]})
      >>>
      >>> from causalnex.discretiser import Discretiser
      >>> df["Transformed_Age_1"] = Discretiser(method="fixed",
      >>> numeric_split_points=[11,18,50]).transform(df["Age"])
      >>> df.to_dict()
      {'Age': {0: 7, 1: 12, 2: 13, 3: 18, 4: 19, 5: 22, 6: 60},
      'Transformed_Age': {0: 0, 1: 1, 2: 1, 3: 2, 4: 2, 5: 2, 6: 3}}
docstr: Fit where split points are based on the input data.
  
  Args:
      data (np.ndarray): values used to learn where split points exist.
  
  Returns:
      self
  
  Raises:
      RuntimeError: If an attempt to fit fixed numeric_split_points is made.
docstr_tok: ["Fit","where","split","points","are","based","on","the","input","data",".","Args",":","data","(","np.ndarray",")",":","values","used","to","learn","where","split","points","exist",".","Returns",":","self","Raises",":","RuntimeError",":","If","an","attempt","to","fit","fixed","numeric_split_points","is","made","."]
code: def fit(self, data: np.ndarray) -> "Discretiser":
      """
      Fit where split points are based on the input data.
  
      Args:
          data (np.ndarray): values used to learn where split points exist.
  
      Returns:
          self
  
      Raises:
          RuntimeError: If an attempt to fit fixed numeric_split_points is made.
      """
  
      x = data.flatten()
      x.sort()
  
      if self.method == "uniform":
          bucket_width = (np.max(x) - np.min(x)) / self.num_buckets
          self.numeric_split_points = [
              np.min(x) + bucket_width * (n + 1)
              for n in range(self.num_buckets - 1)
          ]
  
      elif self.method == "quantile":
          bucket_width = 1.0 / self.num_buckets
          quantiles = [
              bucket_width * (n + 1)
              for n in range(self.num_buckets - 1)
          ]
          self.numeric_split_points = np.quantile(x, quantiles)
  
      elif self.method == "outlier":
          self.numeric_split_points = np.quantile(
              x, [self.outlier_percentile, 1 - self.outlier_percentile]
          )
  
      elif self.method == "percentiles":
          percentiles = [p * 100 for p in self.percentile_split_points]
          self.numeric_split_points = np.percentile(x, percentiles)
  
      else:
          raise RuntimeError("cannot call fit using method=fixed")
  
      return self
  
file_path: causalnex/causalnex/discretiser/discretiser.py
imports: from typing import List
  import numpy
  from sklearn.base import BaseEstimator, TransformerMixin
label_desc: Use image node_id 2 for calling the Discretiser obj's underlying member method code with example usage: obj.fit(data) and returns: self