thu-ml / zhusuan

A probabilistic programming library for Bayesian deep learning, generative models, based on Tensorflow
http://zhusuan.readthedocs.io
MIT License
2.2k stars 418 forks source link

pairwise Markov random field #61

Closed DanqingZ closed 6 years ago

DanqingZ commented 6 years ago

dear authors, thanks for this package. I am wondering if Markov random field can be implemented using zhusuan, is so, do you have a tutorial for me to go through? thank you.

thjashin commented 6 years ago

Unfortunately, as most of probabilistic programming libraries, we currently only support directed models. How to deal with undirected models in a general way is still an open problem for probabilistic programming.

If you are using MRFs for structured prediction, I guess deep generative models can do equally well (even much better).

thjashin commented 6 years ago

Wait, what kind of markov random field are you dealing with? @cjf00000 made me realize that you can deal with continuous markov random field with zs.HMC.

DanqingZ commented 6 years ago

@thjashin I am having a high-order discrete Markov random field that is a part of my larger model, I am now using some MCMC techniques, but it is too slow, so I am looking for some alternatives. Because of my assumption of the joint distribution, the naive mean field and loopy belief don't have a closed form update rule, so I am looking for some other techniques.

thjashin commented 6 years ago

@DanqingZ Ok, that's clear. I think there are several ways to address this problem,

DanqingZ commented 6 years ago

Thanks! let me check the links.

DanqingZ commented 6 years ago

@thjashin , what is the capacity of zhusuan with continuous MRF? Can it deal with thousands of nodes or even millions of nodes? thanks.

thjashin commented 6 years ago

That really depends on whether your tuned HMC is scalable to thousands of dimensions (whether it can efficiently explores the space). I don't have much experience for this specific scene but you could give it a try first with tens of nodes to see how it works.

On the computation side, when you have large models, you may do it with a mix of Gibbs and HMC, that is, you could divide the total nodes into several groups, and use Gibbs as an outer loop, with the inner step as a HMC iteration.

DanqingZ commented 6 years ago

Hi, Could you point me to where the continuous markov random field is used? It looks to me most of the models in the tutorial uses bayes net, which is directed.

thjashin commented 6 years ago

I may write a small prototype (with two or three nodes) when I have free time. Maybe @miskcoo can help also?

DanqingZ commented 6 years ago

@thjashin @miskcoo , sure, a small prototype, with fewer than 10 nodes, is enough for me to learn. Thanks.

thjashin commented 6 years ago

@DanqingZ See #62 for a simple gaussian markov random field with 2 nodes, using HMC to sample.

DanqingZ commented 6 years ago

@thjashin Thank you! let me check it.

misssprite commented 6 years ago

Hi, @thjashin I plan to do some unsupervised image segmentation. It seem that MRF makes sense and I'm wondering if it can be accelerated with gpu. What do you mean by 'deep generative models'? VAE? Could you give me some suggestions about work on unsupervised image segmentation?