Open
Description
Contact Details
No response
Short description of the problem here.
I am simply following the provided example for causalnex.discretiser.MDLPSupervisedDiscretiserMethod:
But I would get the warning: WARNING:root:MDLP was not imported successfully
and the next error: ImportError: mdlp-discretisation was not installed and imported successfully
CausalNex Version
0.12.1
Python Version
3.10.13
Relevant code snippet
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()`
Relevant log output
WARNING:root:MDLP was not imported successfully
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-087b165d990f> in <cell line: 10>()
8 data = pd.DataFrame(X, columns=names)
9 data["target"] = y
---> 10 discretiser = MDLPSupervisedDiscretiserMethod({"min_depth": 0, "random_state": 2020, "min_split": 1e-3, "dtype": int})
11 discretiser.fit(
12 feat_names=["sepal length (cm)"],
/usr/local/lib/python3.10/dist-packages/causalnex/discretiser/discretiser_strategy.py in __init__(self, mdlp_args)
258 self.map_feat_transformer = {}
259 if MDLP is None:
--> 260 raise ImportError(
261 "mdlp-discretisation was not installed and imported successfully"
262 )
ImportError: mdlp-discretisation was not installed and imported successfully
Code of Conduct
- I agree to follow this project's Code of Conduct