Skip to content

Sequential Monte Carlo -- Using Theano? #548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
raddy opened this issue Jun 6, 2014 · 13 comments
Closed

Sequential Monte Carlo -- Using Theano? #548

raddy opened this issue Jun 6, 2014 · 13 comments

Comments

@raddy
Copy link

raddy commented Jun 6, 2014

I'm aware of this pymc2 wrapping SMC library: https://github.com/ebilionis/pysmc

Is SMC utilizing Theano on the roadmap for pymc? This would presumably require all of the particle motion/initialize functions be theano-ified. (Which seems daunting)

@ebilionis
Copy link

Is anybody willing to help me port pysmc on pymc 3?

The aim of pysmc is to sample from posteriors with very very expensive
likelihoods (from 30 seconds to a few hours for a single evaluation
possibly requiring many cpu's for a single evaluation).
These appear in the process of calibrating scientific models on real data.
The technical issues are the following:

  1. we need to be able to run in parallel on a wide array of different
    architectures in parallel
  2. we must be able to make use of non-theano functions (e.g. the output of
    an existing scientific program, this relates to a previous post on this
    mailing list).

The documentation of the current version is here:
http://ebilionis.github.io/pysmc/

In the Appendix of the attached "smc_paper.pdf", I describe the Sequential
Monte Carlo technique in detail when applied to sampling from posteriors.
Note that this is quite different from the application of Sequential Monte
Carlo to dynamical models.

Perks:

  • it is possible to get several publications out of this both in theory and
    in applications (applications can be from oil reservoir modeling, climate
    model calibration and/or materials, ask me for existing papers).
  • there are funding opportunities for PhD students at Mechanical
    Engineering, Purdue University
  • there is the possibility of collaboration to obtain research funding for
    faculty and postdocs in the US in the context of exascale computing.

Don't hesitate to contact me.

Ilias Bilionis

On Fri, Jun 6, 2014 at 4:48 PM, Josh [email protected] wrote:

I'm aware of this pymc2 wrapping SMC library:
https://github.com/ebilionis/pysmc

Is SMC utilizing Theano on the roadmap for pymc? This would presumably
require all of the particle motion/initialize functions be theano-ified.
(Which seems daunting)


Reply to this email directly or view it on GitHub
#548.

Ilias Bilionis,
Mathematics and Computer Science Division,
Argonne National Laboratory,
Lemont, IL
http://www.mcs.anl.gov/~ebilionis/

@fonnesbeck
Copy link
Member

This is pretty cool, Ilias. I'm teaching a tutorial on Bayesian computing at SciPy next month, and I may include some pysmc as part of it.

As for PyMC 3, we are always here to help with integration, the problem is that the core PyMC 3 developers are each pretty busy, to the point that we barely have time to move PyMC 3 forward. The other devs can speak for themselves, but I have not been able to set aside much development time in the past several months, mainly due to the fact that my schedule is busy and nobody is paying me to develop PyMC. I'm trying to line up a grant for next year to remedy this, but for the moment, that is the situation. So, I'm intrigued by the possibility of faculty/postdoc funding that you propose. Feel free to forward any details.

@twiecki
Copy link
Member

twiecki commented Jun 17, 2014

I second everything @fonnesbeck said. #507 is the issue on adding arbitrary stochastics. Theano made the necessary change but we haven't yet added an example for this.

@aflaxman
Copy link
Contributor

@ebilionis: What version of PyMC does pysmc work with now? I tried your tutorial with PyMC 2.3.2 and got AttributeError: 'Metropolis' object has no attribute 'get_params' when calling smc_sampler.initialize(0.01). It looks like very cool stuff, though.

@ebilionis
Copy link

@aflaxman: Which example are you trying to run?
This problem is described (somewhat) here:
PredictiveScienceLab/pysmc#2

It has to do with this:

  • pysmc needs its own step methods
  • these should be just like pymc's step methods but implementing a couple of more things (see pysmc.RandomWalk). This is because I am tuning them in a different way.
  • I have implemented a couple of step methods (e.g. pysm.RandomWalk is just pymc.Metropolis with some more methods)
  • I have given them a higher "competence" so that they are preferred to standard pymc step methods
  • I add them to pymc.StepMethodRegistry
  • It used to work in the past, but... the newest version of PyMC simply ignores how I change pymc.StepMethodRegistry

Thus, for the moment, most of the examples are broken.
You would have to manually assign step methods, like this:
mcmc.use_step_method(pysmc.RandomWalk, model['mixture'])

You need to assign one of these step methods:

  • pysmc.RandomWalk (same as pymc.Metropolis)
  • pysmc.LognormalRandomWalk (lognormal proposal)
  • pysmc.GaussianMixtureStep (a proposal that starts as a random walk and then becomes a mixture of multivariate normal built on the fly from the particle approximation - it requires scikit-learn).

This example should work:
https://github.com/ebilionis/pysmc/blob/master/examples/simple_model_run.py
It should be fairly obvious how you can make the rest of the examples work (until I have the time to fix the issue or the examples).

@aflaxman
Copy link
Contributor

Cool, that works for me! I was trying to follow the tutorial here when I had trouble.

@twiecki
Copy link
Member

twiecki commented Aug 17, 2014

@ebilionis Are you still interested? I think the necessary pieces are in place now and it shouldn't be too hard to port.

@ebilionis
Copy link

Of course I am.
However, it will have to wait until the end of September because it is the busiest period of the year for me right now.
I will get back to you when I find some time.

Ilias Bilionis

Assistant Professor
Department of Mechanical Engineering
Purdue University

On Aug 17, 2014, at 4:00 PM, Thomas Wiecki [email protected] wrote:

@ebilionis Are you still interested? I think the necessary pieces are in place now and it shouldn't be too hard to port.


Reply to this email directly or view it on GitHub.

@jsalvatier
Copy link
Member

Have you had a chance to look at this at all?

@jsalvatier jsalvatier changed the title SMC -- Using Theano? Sequential Monte Carlo -- Using Theano? Jun 3, 2015
@SemanticBeeng
Copy link

@twiecki, all: please share an update on this.

Doing some time series state space modeling research from Time Series: Modeling, Computation, and Inference and need Sequential Monte Carlo.

State Space Models in R mentions what can be done with R but I would really like to use Pymc 3 as well if at all possible.

[UPDATE]: Found https://twitter.com/twiecki/status/479308176207388673.

@springcoil
Copy link
Contributor

Is it worth closing this issue? I've not seen any activity for over a year.

@twiecki
Copy link
Member

twiecki commented Sep 3, 2016

Yes I think so.

On Sep 3, 2016 7:53 PM, "Peadar Coyle" [email protected] wrote:

Is it worth closing this issue? I've not seen any activity for over a year.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#548 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AApJmGDkUW6Hb1amyYg5o-h-GpAI_SbBks5qmbQGgaJpZM4CB_St
.

@hvasbath
Copy link
Contributor

hvasbath commented May 7, 2017

Lol now I see this ... It is done @ebilionis ; ) . Of course would be great to get your input on it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants