Skip to content
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

Call for User-Contributed Examples and Tutorials! #1461

Open
martinjankowiak opened this issue Oct 17, 2018 · 23 comments
Open

Call for User-Contributed Examples and Tutorials! #1461

martinjankowiak opened this issue Oct 17, 2018 · 23 comments
Labels
documentation Examples good first issue help wanted Issues suitable for, and inviting external contributions

Comments

@martinjankowiak
Copy link
Collaborator

martinjankowiak commented Oct 17, 2018

Goal

Add creative examples of Pyro code developed by users out in the real world to our catalog of examples and tutorials. This is great for the community as a whole and helps the Pyro dev team focus on features that are useful to you and the broader community.

Context

The Pyro dev team met a bunch of Pyro users at ProbProg 2018 and heard about a variety of interesting applications of Pyro.

What is being asked

We realize that writing a clean piece of code that can be read by and is useful to a wide audience is difficult. We are also aware that some code/data cannot easily be made public. Wherever possible we are eager to help you overcome some of these potential barriers by

  • helping you clean up and comment your contributed code (and possibly add CUDA support)
  • help you find alternative datasets when needed
  • help you extract a smaller example of Pyro usage from a larger context

Who?

Anyone reading this!

@martinjankowiak martinjankowiak added help wanted Issues suitable for, and inviting external contributions documentation good first issue labels Oct 17, 2018
@eb8680 eb8680 added help wanted Issues suitable for, and inviting external contributions good first issue and removed help wanted Issues suitable for, and inviting external contributions good first issue labels Oct 17, 2018
@martinjankowiak
Copy link
Collaborator Author

martinjankowiak commented Oct 17, 2018

Some people we'd love to hear from include (no pressure though!):
@mbabadi @chart90 @robertness @desmond-ong @wsgharvey @justinchiu @stuhlmueller @mhw32 @null-a

@desmond-ong
Copy link

happy to contribute! @ndgAtUber and I have some stuff baking right now (and an application paper that should be accepted soon), so hopefully soon, we'll have something in a shape to have the dev team take a look at.

@maedoc
Copy link

maedoc commented Oct 24, 2018

sorry to jump on here, (but I could neither join the forum by github or direct sign up (I never received the verification email)), I would like to not only +1 this issue, but also suggest that porting example models from other software (e.g. Stan) would save potential users a lot of time. In my case, it took me a few hours to figure out how to write down a simple AR model (which is my fault more that anything), and having this example (which is given in the Stan guide) would've gotten me jump started.

Also, examples to get users get started transitioning from CPU to GPU would be helpful (where I'm currently stuck).

Btw I'd be happy to trade my AR example for tips on getting it working for CUDA, which could be attractive for Pyro since it (AR) is a stepping stone to ODE/SDE support.

edit I figured out the CUDA problem was part of using autoguides (they need their params predefined on the cuda device), but this could be mentioned in the docs or an example.

edit 2 put in bold the contribution to this issue to distinguish from my whining

@SourabhKul
Copy link

SourabhKul commented Nov 18, 2018

Would a vanilla Bayesian Network implementing a heart disease example be a good example/tutorial?
I have it coded in python from scratch and could try to port it.

@martinjankowiak
Copy link
Collaborator Author

@SourabhKul sounds like it could be useful. can you please give some more details?

@SourabhKul
Copy link

SourabhKul commented Nov 20, 2018

@martinjankowiak This work was a homework assignment in a PGM class I took. The code is available here.

It is a 9-node Bayesian network, with categorical variables (Heart rate, age, gender etc.). In the tutorial I could show how to instantiate the Bayesian network (nodes, edges), populate CPTs through maximum likelihood estimate and perform exact as well as sampling based inference. It could be helpful for users to model their own Bayesian Networks using this tutorial, and going forward it may be helpful to natively support Bayesian Networks in pyro.

I am new to pyro as well as new to contributing to open source and this would be an interesting first project. I can also do tutorials for other basic PGMs like Markov random fields, And some more advanced examples like Stochastic variational inference over factor analysis model and other mixture models.

@martinjankowiak
Copy link
Collaborator Author

@SourabhKul sure that sounds great. i suggest you start with a pretty minimal version and try to keep your first PR from getting too large. improvements can always be added in follow-up PRs. it's also probably best to keep abstractions to a minimum, since too many abstractions can make it harder for readers to parse example code.

@eb8680 eb8680 pinned this issue Dec 20, 2018
@fehiepsi fehiepsi unpinned this issue Dec 28, 2018
@fehiepsi fehiepsi pinned this issue Dec 28, 2018
@activatedgeek
Copy link
Contributor

Hey @martinjankowiak, allow me to suggest something.

I'm sure the Bayesian literature has collected plenty of tutorial data sets and tasks over the years (think counterparts for MNIST/CIFAR/COCO from the DL world). It would be a good idea to create issues tagged with "Help Wanted" or "Examples" which state those problems. Anyone interested (including me) to explore the Pyro API and Bayesian Learning in general can help contribute. Eventually, we can reach feature parity against the literature.

Not sure if this aligns with the goals of Pyro, but may be listing some classic examples from references texts would be helpful for starters?

@SourabhKul
Copy link

@SourabhKul sure that sounds great. i suggest you start with a pretty minimal version and try to keep your first PR from getting too large. improvements can always be added in follow-up PRs. it's also probably best to keep abstractions to a minimum, since too many abstractions can make it harder for readers to parse example code.

Hi, sorry for responding late. In my attempt to encode graph-based models like Bayesian networks in pyro, I realize that there really needs to be a better way to do it. Let me elaborate:

Typical flow to solve real-world problems through graph-based models is
i) model each feature of the data as a random variable (optionally have some latent variables)
ii) define relationships between these variables through connections (causal in Bayes nets, non-causal in Markov nets). These relationships could be learnt through structure learning or hand-made through expert knowledge, or a combination of both
iii) define conditional probability tables/distributions over the relations to be random variables themselves
iv) perform inference over these parameters to learn the model
v) perform inference over the learnt model by sampling the learnt parameter distributions

As per my understanding, this flow is not supported; the flow currently supported (e.g. the nn api) is a layer-by-layer organization which does not permit within-layer connectivity.

It may be important to support the above flow natively in pyro. Thoughts?

@fritzo
Copy link
Member

fritzo commented Mar 12, 2019

@SourabhKul you can use Pyro easily for your Bayesian network workflow, except structure learning which you would need to hand-code on top of Pyro. I'm sorry if you found Pyro confusing coming from a Bayes net background. We could definitely use help with documentation.

@SourabhKul
Copy link

SourabhKul commented Mar 17, 2019

@SourabhKul you can use Pyro easily for your Bayesian network workflow, except structure learning which you would need to hand-code on top of Pyro. I'm sorry if you found Pyro confusing coming from a Bayes net background. We could definitely use help with documentation.

Thanks for the feedback, I'll give it another try after I go through more examples. It might just be that I need to be more familiar with pyro.

@fritzo
Copy link
Member

fritzo commented Mar 18, 2019

@SourabhKul Great. If you have any intro questions, the best place to ask is https://forum.pyro.ai

@fehiepsi fehiepsi unpinned this issue May 8, 2019
@patrickeganfoley
Copy link
Contributor

Just made a super simple classic ELO model for NCAA Men's Basketball 2002-2018 here. Would you be interested in it as an example if I cleaned it up a bit?

Super pumped to be able to have the variational posterior on the team quality terms - it's cool you can see that the D2/D3 teams that only play a few games a year have very high uncertainty.

@martinjankowiak
Copy link
Collaborator Author

@patrickeganfoley that would be great! i know at least two people who would love to see that

@fehiepsi
Copy link
Member

fehiepsi commented Sep 6, 2019

Sorry for an interuption. I have no idea why I did unpin/pin this thread. :( I'll revert this back to the original pinned thread.

@fehiepsi fehiepsi pinned this issue Sep 6, 2019
@deepaks4077
Copy link

deepaks4077 commented Dec 31, 2019

@martinjankowiak: I've been meaning to use Pyro for a causal inference in genomics task (to conduct a GWAS). I already have the code to generate a decent amount of synthetic data. I could make it more complicated by adding some latent confounding as well. What do you guys think? My code is all in Pytorch so it'll be reasonably instructive to port it to Pyro.

Also, @martinjankowiak : This could be a nice project for GSoc 2020.

@JamesTrick
Copy link
Contributor

JamesTrick commented Mar 24, 2020

I've just started the process of (likely slowly) porting examples from Bayesian Data Analysis by Gelman et. al. to Pyro which may be of interest. Repo is here

@EvanZ
Copy link

EvanZ commented Jan 3, 2021

I have a couple of projects involving Pyro and basketball:

Bayesian Neural Network Win Probability
https://github.com/EvanZ/bayesian-win-probability/blob/master/bayes-wp.ipynb

NBA Player Ratings Model
https://github.com/EvanZ/ppl-pm/blob/main/xpm.ipynb

Bayesian Meta-Mock Draft (Aggregating Draft Rankings)
https://github.com/EvanZ/bayesian-meta-mock/blob/master/bayesian-meta-mock-draft.ipynb

@eb8680
Copy link
Member

eb8680 commented Jan 6, 2021

@EvanZ these look awesome! I have been meaning to create a community tutorials/examples page on our website highlighting externally hosted examples, and your projects look like a great incentive for me to finish that. Have you been publishing them anywhere that I should link to, e.g. as blog entries?

We would also be happy to host them here along with the rest of the Pyro examples - if you would prefer that option, please open separate pull requests for each notebook.

@EvanZ
Copy link

EvanZ commented Jan 13, 2021

Hi @eb8680 sorry didn't get back sooner. No, I've really just been putting them in git repos. Feel free to link to those!

@EvanZ
Copy link

EvanZ commented Jan 31, 2021

Here's another post I made yesterday.

Are The Boston Celtics Better Than Random In Preventing Wide Open 3s?
https://github.com/EvanZ/open_3pt_inference/blob/master/inference.ipynb

@fritzo fritzo unpinned this issue Apr 21, 2021
@fritzo fritzo pinned this issue Apr 21, 2021
@jaronowitz
Copy link

jaronowitz commented Jun 12, 2021

Would there be interest in an example concerning solving multiarmed bandits using randomized probability matching? I'm really excited about Pyro and would love to be able to contribute!

@martinjankowiak
Copy link
Collaborator Author

@jaronowitz sure sounds great! feel free to start by opening an issue to discuss scope/details or just directly submit a PR if you have a good idea of what you'd like to contribute. either way we're happy to offer advice and suggestions, help improve the code, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Examples good first issue help wanted Issues suitable for, and inviting external contributions
Projects
None yet
Development

No branches or pull requests