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
The DAG is not a DAG! #1589
Comments
@samanemami Thanks for creating the issue. Would it be possible for you to share some of your data or give more details on what it looks like? I am not able to reproduce your issue using a different dataset. In [1]: from pgmpy.utils import get_example_model
In [2]: model = get_example_model('alarm')
d
In [3]: data = model.simulate()
Generating for node: BP: 100%|██████████████████████████████████████████| 37/37 [00:00<00:00, 600.00it/s]
In [4]: from pgmpy.estimators import TreeSearch
In [6]: est = TreeSearch(data, root_node='HISTORY')
In [7]: est.estimate(estimator_type='chow-liu')
Building tree: 100%|████████████████████████████████████████████████| 666/666.0 [00:00<00:00, 756.91it/s]
Out[7]: <pgmpy.base.DAG.DAG at 0x7f3456214850>
In [8]: dag = est.estimate(estimator_type='chow-liu')
Building tree: 100%|████████████████████████████████████████████████| 666/666.0 [00:00<00:00, 769.44it/s]
# Nodes are exactly the same as in data.
In [12]: set(list(dag.nodes())) == set(list(data.columns))
Out[12]: True
# There are no repeated edges.
In [15]: len(list(dag.edges())) == len(set(list(dag.edges())))
Out[15]: True
In [29]: dag.to_daft('circular', pgm_params={'grid_unit': 10})
Out[29]: <daft.PGM at 0x7f3446375a60>
# Network plot attached below
In [30]: _.render() |
Hi @ankurankan Thank you for your kind reply and the shared experiment. Thank you again for your amazing repository and support. |
Subject of the issue
I tried to estimate the DAG structure with a tree search but I have repeated nodes with various connections!
Your environment
Steps to reproduce
Expected behaviour
The edges should be unique and directed not multiple
Actual behaviour
Having duplicated nodes with various edges
The text was updated successfully, but these errors were encountered: