pyro icon indicating copy to clipboard operation
pyro copied to clipboard

Port NumPyro introductory examples to Pyro

Open eb8680 opened this issue 3 years ago • 12 comments

NumPyro now has several excellent introductory examples with no direct counterparts in Pyro. Porting one of these to Pyro would be a great way for someone to simultaneously learn more about Bayesian data analysis and make a valuable open source contribution.

If you are reading this and want to give one of them a try, please leave a comment here so that other people are aware of your work and so we can help you get started!

Bonus points if you can modify an example to use variational inference with Pyro's autoguides rather than MCMC while obtaining similar results.

List of examples:

eb8680 avatar Dec 14 '21 15:12 eb8680

I can start working on the Bayesian Regression example if no one else is working on it.

arijeetchatterjee avatar Jan 04 '22 05:01 arijeetchatterjee

@arijc76 great, go for it!

eb8680 avatar Jan 04 '22 13:01 eb8680

@eb8680 - I am nearly done with the regression example. However, there is one issue. I am unable to figure out why the custom predict function is not showing the same results as the Predictive utility. Since I can't use vmap as per the NumPyro example, I am using a for loop. I think it might be a problem with the seed. I'd appreciate any suggestion on this. Also, I have added variational inference with an autoguide for model 1. Here's a link to my git repo where can take a look - https://github.com/arijc76/prob-ml/blob/main/bayesian_regression_pyro.ipynb Let me know any feedback. Thanks.

arijeetchatterjee avatar Jan 08 '22 00:01 arijeetchatterjee

Hi @arijc76, nice work! The reason you are seeing different values in your custom predict function is that it is drawing fresh samples for the random variable obs, as expected. If you'd like the values to be more similar, you could draw more samples (1000, say). You can use pyro.plate to vectorize sampling, as in this section of the Pyro intro tutorial.

Whenever you're ready, feel free to open a pull request with your notebook so we can review it in more detail.

eb8680 avatar Jan 10 '22 15:01 eb8680

Thanks @eb8680. The results are more similar now after following your suggestion. I will open a pull request with the notebook. After reviewing the Contributing.md, I wanted to clarify if it is sufficient to follow the steps mentioned in the Testing Tutorials section or is there anything else that I should be checking before submitting the pull request. Thanks again.

arijeetchatterjee avatar Jan 16 '22 18:01 arijeetchatterjee

@arijc76 that should be fine - we can help you get CI tests working in the PR.

eb8680 avatar Jan 16 '22 20:01 eb8680

I'm keen to contribute the Bayesian Hierarchical Regression tutorial, I've already ported it in the past so will clean it up and try variational inference with it.

JamesTrick avatar Jan 18 '22 20:01 JamesTrick

@JamesTrick sorry for the delay, that sounds great! Please let us know if you need any help getting started.

eb8680 avatar Jan 20 '22 21:01 eb8680

Hi @eb8680 Since I'm nearly done with the Bayesian Regression Using NumPyro example, I can work on the Bayesian Imputation example if that's ok.

arijeetchatterjee avatar Feb 03 '22 20:02 arijeetchatterjee

Hi there @arijc76 , is this issue still available for contribution? I am keen to give Bayesian Imputation a try

willtai avatar May 26 '22 23:05 willtai

Hi @willtai , Yes it's available. I am not working on the Bayesian Imputation example.

arijeetchatterjee avatar May 26 '22 23:05 arijeetchatterjee

If the Bayesian imputation task is still open, I'd like to pick it up. @willtai @arijeetchatterjee

nikolageorgiev2000 avatar Nov 06 '23 10:11 nikolageorgiev2000