From b912d023540ee49cb3a6dc79e0f4f8309ef64771 Mon Sep 17 00:00:00 2001 From: erdogant Date: Sat, 16 Mar 2024 15:39:44 +0100 Subject: [PATCH] add d3blocks to setup with minimum version for interactive plots --- bnlearn/__init__.py | 14 +++++++++----- bnlearn/examples.py | 6 +++--- requirements.txt | 1 + setup.py | 1 + 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/bnlearn/__init__.py b/bnlearn/__init__.py index ac63d03e..813679ef 100644 --- a/bnlearn/__init__.py +++ b/bnlearn/__init__.py @@ -38,7 +38,7 @@ __author__ = 'Erdogan Tasksen' __email__ = 'erdogant@gmail.com' -__version__ = '0.8.4' +__version__ = '0.8.5' import pgmpy # Check version pgmpy @@ -48,19 +48,23 @@ # Version check import matplotlib if not version.parse(matplotlib.__version__) >= version.parse("3.3.4"): - raise ImportError('[bnlearn] >Error: Matplotlib version should be >= v3.3.4.\nTry to: pip install -U matplotlib') + raise ImportError('[bnlearn] >Error: Matplotlib version should be >= v3.3.4\nTry to: pip install -U matplotlib') import networkx as nx if not version.parse(nx.__version__) >= version.parse("2.7.1"): - raise ImportError('[bnlearn] >Error: networkx version should be > 2.7.1.\nTry to: pip install -U networkx') + raise ImportError('[bnlearn] >Error: networkx version should be > 2.7.1\nTry to: pip install -U networkx') import numpy as np if not version.parse(np.__version__) >= version.parse("1.24.1"): - raise ImportError('[bnlearn] >Error: numpy version should be > 1.24.1.\nTry to: pip install -U numpy') + raise ImportError('[bnlearn] >Error: numpy version should be > 1.24.1\nTry to: pip install -U numpy') import pandas as pd if not version.parse(pd.__version__) <= version.parse("1.5.3"): - raise ImportError('[bnlearn] >Error: pands version should be <= 1.5.3.') + raise ImportError('[bnlearn] >Error: pands version should be <= 1.5.3') + +import d3blocks as d3 +if not version.parse(d3.__version__) <= version.parse("1.4.9"): + raise ImportError('[bnlearn] >Error: d3blocks version should be >= 1.4.9') # module level doc-string __doc__ = """ diff --git a/bnlearn/examples.py b/bnlearn/examples.py index bf9767d0..f467d7ce 100644 --- a/bnlearn/examples.py +++ b/bnlearn/examples.py @@ -1,10 +1,10 @@ import bnlearn as bn # Load asia DAG -model_true = bn.import_DAG('asia') +model = bn.import_DAG('asia') # plot ground truth -G = bn.plot(model_true) +G = bn.plot(model) -Gi = bn.plot(model_true, interactive=True) +Gi = bn.plot(model, interactive=True) # %% issue plot static vs dynamic is different import bnlearn as bn diff --git a/requirements.txt b/requirements.txt index a2e76a8e..b836725b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ networkx>='2.7.1' matplotlib>='3.3.4' numpy>='1.24.1' pandas==1.5.3 +d3blocks>='1.4.9' tqdm ismember scikit-learn diff --git a/setup.py b/setup.py index d5f8a968..f24c9452 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ "matplotlib>=3.3.4", "numpy>=1.24.1", 'pandas==1.5.3', + 'd3blocks>=1.4.9', 'tqdm', 'ismember', 'scikit-learn',