class_docstr: Allows discretisation of continuous features using mdlp algorithm
  
  Example:
  ::
      >>> import pandas as pd
      >>> import numpy as np
      >>> from causalnex.discretiser.discretiser_strategy import MDLPSupervisedDiscretiserMethod
      >>> from sklearn.datasets import load_iris
      >>> iris = load_iris()
      >>> X, y = iris["data"], iris["target"]
      >>> names = iris["feature_names"]
      >>> data = pd.DataFrame(X, columns=names)
      >>> data["target"] = y
      >>> discretiser = MDLPSupervisedDiscretiserMethod(
      >>>     {"min_depth": 0, "random_state": 2020, "min_split": 1e-3, "dtype": int}
      >>> )
      >>> discretiser.fit(
      >>>     feat_names=["sepal length (cm)"],
      >>>     dataframe=data,
      >>>     target="target",
      >>>     target_continuous=False,
      >>> )
      >>> discretised_data = discretiser.transform(data[["sepal length (cm)"]])
      >>> discretised_data.values.ravel()
  
      array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 2, 2, 2, 1, 2, 1, 2, 0, 2, 0, 0, 2, 2, 2, 1, 2,
             1, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 0, 2, 2, 2,
             1, 1, 1, 2, 1, 0, 1, 1, 1, 2, 0, 1, 2, 1, 2, 2, 2, 2, 0, 2, 2, 2,
             2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
             2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2])
class_docstr_tok: ["Allows","discretisation","of","continuous","features","using","mdlp","algorithm","Example",":",":",":",">",">",">","import","pandas","as","pd",">",">",">","import","numpy","as","np",">",">",">","from","causalnex.discretiser.discretiser_strategy","import","MDLPSupervisedDiscretiserMethod",">",">",">","from","sklearn.datasets","import","load_iris",">",">",">","iris","=","load_iris","(",")",">",">",">","X",",","y","=","iris","[","``","data","''","]",",","iris","[","``","target","''","]",">",">",">","names","=","iris","[","``","feature_names","''","]",">",">",">","data","=","pd.DataFrame","(","X",",","columns=names",")",">",">",">","data","[","``","target","''","]","=","y",">",">",">","discretiser","=","MDLPSupervisedDiscretiserMethod","(",">",">",">","{","``","min_depth","''",":","0",",","``","random_state","''",":","2020",",","``","min_split","''",":","1e-3",",","``","dtype","''",":","int","}",">",">",">",")",">",">",">","discretiser.fit","(",">",">",">","feat_names=","[","``","sepal","length","(","cm",")","''","]",",",">",">",">","dataframe=data",",",">",">",">","target=","''","target","''",",",">",">",">","target_continuous=False",",",">",">",">",")",">",">",">","discretised_data","=","discretiser.transform","(","data","[","[","``","sepal","length","(","cm",")","''","]","]",")",">",">",">","discretised_data.values.ravel","(",")","array","(","[","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","1",",","1",",","0",",","0",",","1",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","1",",","0",",","0",",","1",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","0",",","2",",","2",",","2",",","1",",","2",",","1",",","2",",","0",",","2",",","0",",","0",",","2",",","2",",","2",",","1",",","2",",","1",",","1",",","2",",","1",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","1",",","1",",","1",",","1",",","2",",","0",",","2",",","2",",","2",",","1",",","1",",","1",",","2",",","1",",","0",",","1",",","1",",","1",",","2",",","0",",","1",",","2",",","1",",","2",",","2",",","2",",","2",",","0",",","2",",","2",",","2",",","2",",","2",",","2",",","1",",","1",",","2",",","2",",","2",",","2",",","2",",","2",",","1",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","2",",","1",",","2",",","2",",","2",",","2",",","2",",","2",",","2","]",")"]
docstr: The fit method allows MDLP to learn split thresholds from the input data.
  The target feature cannot be continuous
  
  Args:
      feat_names (List[str]): a list of feature to be discretised
      target (str): name of the variable that is going to be used a target for MDLP
      dataframe (pd.DataFrame): pandas dataframe of input data
      target_continuous (bool): boolean that indicates if target variable is continuous.
  
  Returns:
      self: MDLPSupervisedDiscretiserMethod object with learned split thresholds from mdlp algorithm
  
  Raises:
      ValueError: if the target is continuous
docstr_tok: ["The","fit","method","allows","MDLP","to","learn","split","thresholds","from","the","input","data",".","The","target","feature","can","not","be","continuous","Args",":","feat_names","(","List","[","str","]",")",":","a","list","of","feature","to","be","discretised","target","(","str",")",":","name","of","the","variable","that","is","going","to","be","used","a","target","for","MDLP","dataframe","(","pd.DataFrame",")",":","pandas","dataframe","of","input","data","target_continuous","(","bool",")",":","boolean","that","indicates","if","target","variable","is","continuous",".","Returns",":","self",":","MDLPSupervisedDiscretiserMethod","object","with","learned","split","thresholds","from","mdlp","algorithm","Raises",":","ValueError",":","if","the","target","is","continuous"]
code: def fit(
      self,
      feat_names: List[str],
      target: str,
      dataframe: pd.DataFrame,
      target_continuous: bool,
  ) -> "MDLPSupervisedDiscretiserMethod":
      """
      The fit method allows MDLP to learn split thresholds from the input data.
      The target feature cannot be continuous
  
      Args:
          feat_names (List[str]): a list of feature to be discretised
          target (str): name of the variable that is going to be used a target for MDLP
          dataframe (pd.DataFrame): pandas dataframe of input data
          target_continuous (bool): boolean that indicates if target variable is continuous.
  
      Returns:
          self: MDLPSupervisedDiscretiserMethod object with learned split thresholds from mdlp algorithm
  
      Raises:
          ValueError: if the target is continuous
      """
      self.feat_names = feat_names
      self.map_feat_transformer = {}
      if target_continuous:
          raise ValueError(
              "Target variable should not be continuous when using MDLP."
          )
  
      for feat in feat_names:
          mdlp = deepcopy(self.mdlp)
  
          mdlp.fit(dataframe[[feat]], dataframe[[target]])
          self.map_thresholds[feat] = mdlp.cut_points_[0]
  
      return self
  
file_path: causalnex/causalnex/discretiser/discretiser_strategy.py
imports: import logging
  from copy import deepcopy
  from typing import Any, Dict, List
  import pandas
  from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
  from causalnex.discretiser.abstract_discretiser import AbstractSupervisedDiscretiserMethod
  from causalnex.utils.decision_tree_tools import extract_thresholds_from_dtree
label_desc: Use image node_id 2 for calling the MDLPSupervisedDiscretiserMethod obj's underlying member method code with example usage: obj.fit(feat_names, target, dataframe, target_continuous) and returns: self