Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: causalnex.discretiser.MDLPSupervisedDiscretiserMethod does not import MDLP #228

Open
1 task done
elisammz opened this issue Mar 9, 2024 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@elisammz
Copy link

elisammz commented Mar 9, 2024

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
@elisammz elisammz added the bug Something isn't working label Mar 9, 2024
Jimmy-INL pushed a commit to Jimmy-INL/causalnex that referenced this issue May 17, 2024
* initial draft for pyvis plotting

* modify edge length and mass for strong style and return pyvis object

* add pytests and fix sklearn plotting function

* update to include pyvis in requirements

* add in notebook check tests for test_plot_dag

* downgrade pyvis for compatibility

* update to latest plotting functions

* update requirements to exclude pygraphviz

* upgrading ipython

* moving ipython as main requirement

* simplify plot_structure function

* remove unused code and add test cases when needed

* reset pyvis version to see if .show() is working on v0.3.1

* set ipython and python versions

* undo previous change (ipython version change)

* remove ipython version from requirements

* re-add ipython version to requirements

* change ipython+python version

* undo change ipython+python version

* check for different ipython versions

* add quotation marks in requirements.txt

* revert back to ipython>=8.10.0

* try out ipython requirements from kedro

* revert back to ipython>=8.10

* change ipython requirements to successfully create environments

* Updated pyvis tutorials (mckinsey#232)

* update tutorials and adjust default values to improve output

* allow user to change layout in plot_dag function before calling .show()

* display df without dataframe_image

* fix dataframe_image No such file or directory

* remove one cell beacause unused

* incorporate windows solution from Kyle

* fix typo

* change plot_structure documentation

* change plot_dag documentation

* check and correct all notebooks

* remove python 3.6 and 3.7 support

* update documentation

* remove comment regarding ignoring a warning when running `make build-docs`

* removing ipython from test requiremnets

* refactoring plot syntax and changing logic in plot_dag

* addressing Gabriel's comments

* removing unused IPython conditional import

* refactoring code to use display

* Docs - update 01-tutorial

* updating first tutotiral

* updating plotting tutorial

* updating plotting tutorial

* updating display api

* fixing bug - displau

* fixing notebooks

* fixing notebooks

* fixing notebooks

* fixing notebooks

* Replacing Pygraphviz with Pyvis

* Replacing Pygraphviz with Pyvis

* Replacing Pygraphviz with Pyvis

* updating pyvis version

* updating notebook

* Richard Comments - batch 1

* Update tests/test_plotting.py

Co-authored-by: Richard Oentaryo <[email protected]>

* Update tests/test_plotting.py

Co-authored-by: Richard Oentaryo <[email protected]>

* Richard Comments - batch 2

* adjust node color test to include background color

* docs

* docs

* test

* fixing mdlp with cython

* fixing mdlp with cython

* test

* removing cython from requirements

* adding cython to config

---------

Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: GabrielAz <[email protected]>
Co-authored-by: Gabriel Azevedo <[email protected]>
Co-authored-by: Gabriel Azevedo Ferreira <[email protected]>
Co-authored-by: Richard Oentaryo <[email protected]>
Jimmy-INL pushed a commit to Jimmy-INL/causalnex that referenced this issue May 17, 2024
* Limiting numpy version (mckinsey#217)

* adding line on yml - no effect

* adding line on yml - no effect

* changing req.txt

* changing req.txt

* changing req.txt

* adding setuptools requirement (mckinsey#218)

* adding setuptools requirement

* adding setuptools requirement

* update dictionaries to pass linting (mckinsey#230)

* Refactor/unlock numpy kl (mckinsey#235)

* unlocking numpy

* unlocking numpy

* unlocking numpy

* dependency fixes for docs and linters

* requirement fixes : numpy <1.24 for all python versions

---------

Co-authored-by: kyle_lim <[email protected]>

* Simplifying requirements - Numpy version range (mckinsey#236)

* Remove python 3.6 and 3.7 support (mckinsey#234)

* remove python 3.6 and 3.7 support

* update documentation

* remove comment regarding ignoring a warning when running `make build-docs`

* removing ipython from test requiremnets

* Update README.md

Co-authored-by: Philip Pilgerstorfer <[email protected]>

---------

Co-authored-by: GabrielAz <[email protected]>
Co-authored-by: Gabriel Azevedo Ferreira <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>

* unlocking numpy (mckinsey#238)

Co-authored-by: Gabriel Azevedo <[email protected]>

* Release 0.11.2 (mckinsey#239)

Co-authored-by: Gabriel Azevedo <[email protected]>

* Replacing Pygraphviz with Pyvis (mckinsey#237)

* Replacing Pygraphviz with Pyvis

* Replacing Pygraphviz with Pyvis

* Replacing Pygraphviz with Pyvis

* temp (#242)

* Limiting numpy version (mckinsey#217)

* adding line on yml - no effect

* adding line on yml - no effect

* changing req.txt

* changing req.txt

* changing req.txt

* adding setuptools requirement (mckinsey#218)

* adding setuptools requirement

* adding setuptools requirement

* update dictionaries to pass linting (mckinsey#230)

* Refactor/unlock numpy kl (mckinsey#235)

* unlocking numpy

* unlocking numpy

* unlocking numpy

* dependency fixes for docs and linters

* requirement fixes : numpy <1.24 for all python versions

---------

Co-authored-by: kyle_lim <[email protected]>

* Simplifying requirements - Numpy version range (mckinsey#236)

* Remove python 3.6 and 3.7 support (mckinsey#234)

* remove python 3.6 and 3.7 support

* update documentation

* remove comment regarding ignoring a warning when running `make build-docs`

* removing ipython from test requiremnets

* Update README.md

Co-authored-by: Philip Pilgerstorfer <[email protected]>

---------

Co-authored-by: GabrielAz <[email protected]>
Co-authored-by: Gabriel Azevedo Ferreira <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>

* unlocking numpy (mckinsey#238)

Co-authored-by: Gabriel Azevedo <[email protected]>

* Release 0.11.2 (mckinsey#239)

Co-authored-by: Gabriel Azevedo <[email protected]>

---------

Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: kyle_lim <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>
Co-authored-by: Gabriel Azevedo <[email protected]>

* adding cython to config

* adding cython to config

* adding cython to config

* adding cython to config

---------

Co-authored-by: Gabriel Azevedo <[email protected]>
Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: kyle_lim <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>

* Replace pygraphviz plotting with pyvis (mckinsey#228)

* initial draft for pyvis plotting

* modify edge length and mass for strong style and return pyvis object

* add pytests and fix sklearn plotting function

* update to include pyvis in requirements

* add in notebook check tests for test_plot_dag

* downgrade pyvis for compatibility

* update to latest plotting functions

* update requirements to exclude pygraphviz

* upgrading ipython

* moving ipython as main requirement

* simplify plot_structure function

* remove unused code and add test cases when needed

* reset pyvis version to see if .show() is working on v0.3.1

* set ipython and python versions

* undo previous change (ipython version change)

* remove ipython version from requirements

* re-add ipython version to requirements

* change ipython+python version

* undo change ipython+python version

* check for different ipython versions

* add quotation marks in requirements.txt

* revert back to ipython>=8.10.0

* try out ipython requirements from kedro

* revert back to ipython>=8.10

* change ipython requirements to successfully create environments

* Updated pyvis tutorials (mckinsey#232)

* update tutorials and adjust default values to improve output

* allow user to change layout in plot_dag function before calling .show()

* display df without dataframe_image

* fix dataframe_image No such file or directory

* remove one cell beacause unused

* incorporate windows solution from Kyle

* fix typo

* change plot_structure documentation

* change plot_dag documentation

* check and correct all notebooks

* remove python 3.6 and 3.7 support

* update documentation

* remove comment regarding ignoring a warning when running `make build-docs`

* removing ipython from test requiremnets

* refactoring plot syntax and changing logic in plot_dag

* addressing Gabriel's comments

* removing unused IPython conditional import

* refactoring code to use display

* Docs - update 01-tutorial

* updating first tutotiral

* updating plotting tutorial

* updating plotting tutorial

* updating display api

* fixing bug - displau

* fixing notebooks

* fixing notebooks

* fixing notebooks

* fixing notebooks

* Replacing Pygraphviz with Pyvis

* Replacing Pygraphviz with Pyvis

* Replacing Pygraphviz with Pyvis

* updating pyvis version

* updating notebook

* Richard Comments - batch 1

* Update tests/test_plotting.py

Co-authored-by: Richard Oentaryo <[email protected]>

* Update tests/test_plotting.py

Co-authored-by: Richard Oentaryo <[email protected]>

* Richard Comments - batch 2

* adjust node color test to include background color

* docs

* docs

* test

* fixing mdlp with cython

* fixing mdlp with cython

* test

* removing cython from requirements

* adding cython to config

---------

Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: GabrielAz <[email protected]>
Co-authored-by: Gabriel Azevedo <[email protected]>
Co-authored-by: Gabriel Azevedo Ferreira <[email protected]>
Co-authored-by: Richard Oentaryo <[email protected]>

* fix: requirements.txt to reduce vulnerabilities (#247)

The following vulnerabilities are fixed by pinning transitive dependencies:
- https://snyk.io/vuln/SNYK-PYTHON-IPYTHON-3318382

Co-authored-by: snyk-bot <[email protected]>

* test

* Release Notes 0.12.0 (#249)

* temp (#242)

* Limiting numpy version (mckinsey#217)

* adding line on yml - no effect

* adding line on yml - no effect

* changing req.txt

* changing req.txt

* changing req.txt

* adding setuptools requirement (mckinsey#218)

* adding setuptools requirement

* adding setuptools requirement

* update dictionaries to pass linting (mckinsey#230)

* Refactor/unlock numpy kl (mckinsey#235)

* unlocking numpy

* unlocking numpy

* unlocking numpy

* dependency fixes for docs and linters

* requirement fixes : numpy <1.24 for all python versions

---------

Co-authored-by: kyle_lim <[email protected]>

* Simplifying requirements - Numpy version range (mckinsey#236)

* Remove python 3.6 and 3.7 support (mckinsey#234)

* remove python 3.6 and 3.7 support

* update documentation

* remove comment regarding ignoring a warning when running `make build-docs`

* removing ipython from test requiremnets

* Update README.md

Co-authored-by: Philip Pilgerstorfer <[email protected]>

---------

Co-authored-by: GabrielAz <[email protected]>
Co-authored-by: Gabriel Azevedo Ferreira <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>

* unlocking numpy (mckinsey#238)

Co-authored-by: Gabriel Azevedo <[email protected]>

* Release 0.11.2 (mckinsey#239)

Co-authored-by: Gabriel Azevedo <[email protected]>

---------

Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: kyle_lim <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>
Co-authored-by: Gabriel Azevedo <[email protected]>

* Release Notes

---------

Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: kyle_lim <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>
Co-authored-by: Gabriel Azevedo <[email protected]>

---------

Co-authored-by: ElisabethSesterHussQB <[email protected]>
Co-authored-by: kyle_lim <[email protected]>
Co-authored-by: Philip Pilgerstorfer <[email protected]>
Co-authored-by: Gabriel Azevedo <[email protected]>
Co-authored-by: Serene Yeo <[email protected]>
Co-authored-by: Richard Oentaryo <[email protected]>
Co-authored-by: Leon Nallamuthu <[email protected]>
Co-authored-by: snyk-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant