Skip to content

Commit

Permalink
bugfix issue105 DBN error
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Oct 23, 2024
1 parent f89d8eb commit 896052f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bnlearn/bnlearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,7 +1139,7 @@ def plot_graphviz(model,
if model['adjmat'].sum().sum()==0:
if verbose>=3: print('[bnlearn]> Nothing to plot because no edges are present between nodes. ')
return None
if model['config']['method']=='DBN':
if model.get('config', {}).get('method') == 'DBN':
if verbose>=3: print('[bnlearn]> DynamicBayesianNetwork (DBN) can not be plot with Graphviz.')
return None

Expand Down Expand Up @@ -1286,7 +1286,7 @@ def plot(model,
if verbose>=3: print('[bnlearn]> Nothing to plot because no edges are present between nodes. ')
return None

if model['config']['method']=='DBN' and interactive:
if model.get('config', {}).get('method') == 'DBN' and interactive:
if verbose>=3: print('[bnlearn]> DynamicBayesianNetwork (DBN) can not be plot with Graphviz.')
return None

Expand Down
8 changes: 8 additions & 0 deletions bnlearn/examples.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#%%
import bnlearn as bn
model = bn.import_DAG('asia')
G = bn.plot(model)




# %% Impute categorical values
import bnlearn as bn
import pandas as pd
Expand Down

0 comments on commit 896052f

Please sign in to comment.