mckinsey / causalnex

A Python library that helps data scientists to infer causation rather than observing correlation.
http://causalnex.readthedocs.io/
Other
2.24k stars 258 forks source link

repeat edges when use plot_structure function #123

Closed huanglen closed 3 years ago

huanglen commented 3 years ago

hello ,everyone.

Description

I'm trying the tutorial of causalnex, but I will plot repeat edges when I use StructureModel.plot_structure.

` from causalnex.structure import StructureModel sm = StructureModel() sm.add_edges_from([('health', 'absences'),('health', 'G1')])

from IPython.display import Image from causalnex.plots import plot_structure, NODE_STYLE, EDGE_STYLE viz = plot_structure( sm, graph_attributes={"scale": "0.5"}, all_node_attributes=NODE_STYLE.WEAK, all_edge_attributes=EDGE_STYLE.WEAK) Image(viz.draw(format='png')) ` but the each edg in figure appeared repeat.

d07a37e984bcda70ec1c68c3005ae07d_P2xJ53MHTg+GAAAAAElFTkSuQmCC

Your Environment

OS: win10 CPU: Intel Core i5 GPU: none python: 3.7.0 anaconda: 4.8.4 causalnex: 0.10.0

how can I resolve this problem? Thanks for your help !

oentaryorj commented 3 years ago

Hi @huanglen, I tried to run your codes and the graph looks alright on my machine (see screenshot below).

If you are running from a Jupyter notebook, perhaps you can try to restart the kernel and re-run? It might also be worth reinstalling/upgrading pygraphviz just in case ...

image

oentaryorj commented 3 years ago

Closing this for now. If the problem still persists, do let us know and feel free to reopen the issue

huanglen commented 3 years ago

Thanks for your information !