JuliaStats / PGM.jl

A Julia framework for probabilistic graphical models.
Other
52 stars 19 forks source link

Step 1: API for model specification #4

Closed papamarkou closed 10 years ago

papamarkou commented 10 years ago

I was thinking that, following the proposal and the natural order of things, the first step after choosing the package name is to decide how the model specification will be entered by the user. That's the first component of the API and framework. Will it be an expression, which will then be parsed to a graph internally?

lindahua commented 10 years ago

I think the proposal was mainly dealing with this.

What we have to do is to write the @model macro, which can be considered as a compiler in some sense.

lindahua commented 10 years ago

In my consideration, the @model macro takes as input a user-friendly julia expression (can be pretty long, with multiple statements), and translates them into codes that construct a factor graph.

papamarkou commented 10 years ago

You are right @lindahua, this is the main context of the proposal. I just wasn't sure if the proposed model macro was roughly outlined or was actually in its near-final form for implementation. For example, looking at the finite mixture model, would the user define the model via an expression or via the model macro, which will have a certain template as in the finite mixture example of the proposal? The idea of using a model macro with a designated template seems better than a quoted expression maybe. Just trying to follow your stream of thought in the proposal.

papamarkou commented 10 years ago

I think I am following you exactly now @lindahua, after your clarifications above and a little more thinking. I will close this issue for now as it seems it is well addressed already.

papamarkou commented 9 years ago

@lindahua, I am aware you are probably very busy at the moment. Truth is I also have limited time, but have been thinking how one could possibly make a bit of progress with PGM.jl. I can see how the @model macro can take a julia expression as its input and return a graph, and this is sth I can possibly do. Nevertheless, to be precise about the returned object, what makes me struggle a bit at the moment is whether this should be in general a graph or specifically a factor graph. What do you think about this?

If you prefer the latter, should the definition of factor graph go in Graphs.jl or in PGM.jl? If you could possibly provide a minimal template for the factor graph definition, then I can take it from there and start writing up the @model macro. I am not entirely sure though that we need to rely on a factor graph; I was initially thinking of DAGs, which are more restrictive, and have more recently been tempted to use just graphs...

lindahua commented 9 years ago

@scidom Factor graph is a bipartite graph instead of an ordinary graph, and has its own operations. I think relying on Graphs.jl doesn't help a lot.

papamarkou commented 9 years ago

That's true, in general either DAGs or factor graphs are used for inference, both from a stats and a machine learning perspective. I am aware that factor graphs are not directed, as opposed to DAGs. In general, do you think that a Markov or a Bayesian network is a better graphical model representation when the main aim is inference?