daft-dev / daft Goto Github PK
View Code? Open in Web Editor NEWRender probabilistic graphical models using matplotlib
Home Page: https://docs.daft-pgm.org
License: MIT License
Render probabilistic graphical models using matplotlib
Home Page: https://docs.daft-pgm.org
License: MIT License
I hate to say this, but I think the original PGM() call should take a rect quad (not a width, height double). The reason is, if you lay out a sick PGM and then want to adjust the bounding box lower-left corner up or over, you have to re-set every x,y position of every node and plate. Whereas if it had a rect at call, that's all you need to change. See, for example, my changeset 7231308 which would have been a one-liner if the input was rect rather than w,h.
Like the Fergus/Hogg PGM?
and put it in examples
We should show what to do if a user wants to import daft and some set of latex macros
Do we have to say, under install, that you need matplotlib?
(this might require doing dots to indicate repeats, as in http://www.nowpublishers.com/10.1561%5CMAL22%5C2200000006%5Cimages/fig4.5.gif )
see, eg, examples/astronomy.py
The rect
input to plate takes four numbers in some order. What numbers and in what order?
Hi.
Could I ask for a basic example of how I might overlay a daft graph on an image?
(context = I'm making a diagram of a small network of brain regions; an image in the background would be v. handy for visual interpretation)
I'm expecting/hoping that the matplotlib base should make this more straightforward than e.g. with graphviz.
Ta.
The arrows don't start at the observed nodes!
The API page says it is, but I think this might be a no-op, given the ctx
.
I think we should start something new.
I also think we shouldn't work on Daft any more after 23:59 today (Friday), except inasmuch as it helps us write papers.
I like putting the nodes on an integer grid, for consistent-style reasons (for example, I want to do that in Data Analysis Recipes). But sometimes you might want that grid (in increasing order of difficulty):
This is an enhanced goal because we don't need this for present goals. (For some reason I don't have the right to label the issues with tags.)
I would change "beautifully rendered probabilistic" to "rendering probabilistic" on the slug-line below "DAFT" on the top page. I would also remove "pixel-perfect" from the first paragraph. The examples should give this sense without us saying it. Just sayin
I often want to just write text on my PGM. We should provide a general text
method or label
method that permits this. Am hacking Plate
right now (and feeling dirty).
It's useful to have some prose on the API page. In particular: include a comment about what the _rendering_context
is.
Hey @davidwhogg,
I'm trying to do a PGM with external LaTeX definitions. Your weak lensing example claims to do this but I can't seem to get it to work. Can you add your .tex
file for this example to the repository so that I can try to diagnose?
Thanks!
I realize you have told me before, but I simply cannot find it anywhere.
Also, when I fork this, I only get master, I don't get gh-pages. Why not? If I try to fork gh-pages, github says I have already forked.
I think I have already done this in the pull request, but my solutions are CLUNKY.
I think there are much more elegant ways of doing all this; not sure what we should do?
One problem is that I have options like observed=True
and nogray=True
. These mix concepts like "observed" with typographical commands like "nogray". We kind-of have to decide whether we are letting people set the "look" of the Nodes or the "function" of the nodes. I slightly prefer the latter, with then a style sheet of what each "function" looks like. That could be a good idea -- and would force users to set a style up-front.
that's a problem with the "subtitle" or "description" field in the github repo...
here's an option: http://cosmo.nyu.edu/hogg/research/2012/09/21/logo.png
right now someone coming to the site would have no way to find us or contact us. My link should be to http://cosmo.nyu.edu/hogg/
Koller, Sontag, Fergus, LeCun, Murray, Marshall, Harmeling, Hirsch, etc. And people at CMML. And the CMMLU. And etc.
[hogg@172-26-28-219 Daft]$ python setup.py build
running build
running build_py
error: package directory 'daft' does not exist
I realize that all my new examples are BOHRING but we need more examples on the page.
We track "ec" and "fc" and "lw" but not the long forms of these names. We have to catch the long forms too. Requires some dictionary translation or other cleverness
If so, Edge()
has to become an object. I think we should do this only if asked.
I SUCK... WORKING ON IT
for Edge and Plage, the render()
function takes ctx
but the docs say ax
and conv
The 2to3 tool shows a small number of changes for full Python 3 compatibility. Most of those changes don't seem needed (m.keys()
to list(m.keys()
). I only needed one change to make Daft work for my simple use case:
--- ./daft.py (original)
+++ ./daft.py (refactored)
@@ -126,7 +126,7 @@
for edge in self._edges:
edge.render(self._ctx)
- for name, node in self._nodes.iteritems():
+ for name, node in self._nodes.items():
node.render(self._ctx)
return self.ax
Another possible issue is the exec src in ns
statement in docs/gen_example.py which would need to be converted to exec(src, ns). The six library provides a simple wrapper for this.
Looking at the PGMs on the web, I think this one is an important one; I will work on it now.
The reason I want to mention directed acyclic graphs and Bayesian networks is for "SEO" or so we are discoverable on the web by people who refer to these things by these other names. Indeed, I see DAG more than I see PGM these days.
setup.py
imports the daft module, which imports matplotlib
, which is a dependency, and not necessarily installed when running pip! This means that "pip install daft" in a new virtualenv will fail with: ImportError: No module named 'matplotlib'
.
Thanks for daft!
The "alpha" node in classic.py is a standard; we should make it easy with some kind of blah=True
input to the daft.Node()
call.
Feel free to assign this to me, but only after you tell me what those kinds of nodes are called.
This project sure is a fun distraction for me!
convert -crop 150x150+230+115 nocircles.png nocircles-thumb.png
convert -crop 150x150+230+115 wordy.png wordy-thumb.png
convert -crop 150x150+50+18 classic.png classic-thumb.png
convert -crop 150x150+50+18 nogray.png nogray-thumb.png
We should either give facilities for giving the graph other kinds of labels (notes, title, etc) or else make an example that does so by pgm.ax.annotate()
or whatever.
I'm all for it: Dan Foreman-Mackey, David W. Hogg, and contributors.
In some cases you might want all nodes to have a shared non-circular shape. The _rendering_context
should have an aspect
element.
It looks like currently nodes that connect back to themselves are ignored. A curve line segment should be drawn with the arrow pointing back to the node.
On this page http://daft-pgm.org/api/ I see no comment on observed_style
, even though it is listed in the calling sequence of PGM()
In addition to the mentioning we need in #17, we also need to mention, at least, "(png, pdf, eps)" after "any format your matplotlib backend supports".
let's get serious about this whole web thing
and put it in examples
these are the offending lines
# Deal with the path for import.
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.