daft-dev / daft

Render probabilistic graphical models using matplotlib
https://docs.daft-pgm.org
MIT License
675 stars 120 forks source link

Code future #169

Open nstarman opened 11 months ago

nstarman commented 11 months ago

numpyro and some others can auto-render their PGM, not relying on daft. They build a graphviz Graph and render that to matplotlib.

I was thinking that daft could keep its UI, but internally build a NetworkX graph (which can convert to a graphviz object). Daft could then support many different rendering options -- matplotlib, plotly, Vega, etc — by plugin (entrypoint modules), just by rendering the NetworkX graph. Also the NetworkX graph is a useful object in itself, with nice serialization options and customization, etc.

Perhaps numpyro could then make daft a dependency, esp if it supports a number of rendering options.

dfm commented 11 months ago

I'm not very interested in this proposal because the whole point of developing daft in the first place was to enable manual placement of nodes (often needed to get publication quality PGMs) which was/is? a PITA with the standard network visualization tools. I believe that it fills a very different niche than the tools you're looking at!

nstarman commented 11 months ago

NetworkX allows for the nodes to be anything / any metadata to be added to a node, e.g. a daft Node that holds the position information. By leveraging a network library it would be easier to do things like add two PGM. My idea is to separate the rendering layer from the graph, where the graph still holds necessary information like node type (observed vs alternate), position, etc.

dfm commented 11 months ago

Got it. If you think having networkx provide a data structure, and if you feel that comes with benefits, I'm happy to chat! I feel like the comparison to automated rendering from those PPL libraries is a big of a red herring, that's all.