GEEKERY  
ADVENTURE  
CONTEMPLATION  

20140722

Daft for probabilistic graphical models

probabilistic graphical model rendered with Daft
Daft is python package used to render graphical models. Its renders are indeed lovely (see right), but the pipeline leaves something to be desired, and there's still a lot of functionality missing.

To try it out, I decided to draw one of the simplest PGMs possible: N points drawn from a mean μ.  It was frustrating to enter coordinates to place the nodes and plate boundaries. It would be preferable to specify which nodes the plates should surround, just as the edges specify which nodes they connect.  It would also be nice to not specify coordinates at all for the nodes, and instead have the system determine placement (but still allow manual override).

There are no options to control the alignment or scale of plate labels, and the concept of specifying an origin was a little strange, even if it makes sense.  The aspect ratio of the graphical model should be fit to the contents, and you should be able to set margins; the only time we should specify a size is when rendering.

While it seems promising, the learning curve is too steep for me.  I've entrenched myself in Inkscape, where it's easy for me to center things quickly.  Churning out the variant below took me about two minutes, whereas the Daft variant took closer to ten, and it still needs work.  That said, Daft does match fonts better with LaTex documents.  I could see it being powerful once you know how to handle its quirks.

probabilistic graphical model hand-drawn with Inkscape

No comments: