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

Boosting BBVI Tutorial #13

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

Boosting BBVI Tutorial #13

wants to merge 32 commits into from

Conversation

lorenzkuhn
Copy link
Collaborator

boosting_bbvi_tutorial.ipynb contains my draft of the boosting BBVI tutorial for the Pyro documentation. Please review it - I'd be happy about any kind of feedback and suggestions.

I used pylint to check for PEP8 compliance. I've prioritised consistency with existing tutorials over being compliant with PEP8 in cases where there were conflict between these two.
I've fixed the import order with isort as recommended in the Pyro contribution guidelines .

I don' think there's a need to review the other files in this PR at this point.

Copy link
Collaborator

@TNU-yaoy TNU-yaoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some changes mostly to the text and committed them to a new branch (see #14). Below are two additional comments:

  1. you are using 3 different naming conventions for the latent and observed variables: z and x (intro), mu and y (model description), loc and obs (code). It might make sense to unify this if it is not too much work.

  2. can we get away with not replicating the observations 10 times?

Copy link
Collaborator

@gideonite gideonite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to get to this.

There are some code things to be cleaned up: mainly removing commented out code and refactoring plotting code.

More importantly, have we been able to factor out the relbo in a modular fashion?

boosting_bbvi_tutorial.ipynb Show resolved Hide resolved
bayesian_logistic_regression.py Show resolved Hide resolved
bayesian_logistic_regression.py Show resolved Hide resolved
bayesian_logistic_regression.py Show resolved Hide resolved
bayesian_logistic_regression.py Show resolved Hide resolved
bayesian_logistic_regression.py Show resolved Hide resolved
bayesian_logistic_regression.py Show resolved Hide resolved
# pyplot.title('-ELBO against time for component {}'.format(t));
# pyplot.show()

pyplot.plot(range(len(guide_log_prob)), -1 * np.array(guide_log_prob), 'b-', label='- Guide log prob')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally want to separate plotting code from the algorithm itself.

bbbvi.py Show resolved Hide resolved
…ts2019-boosting-bbvi-pyro into wip/bimodal_experiments
Copy link
Collaborator

@sharrison5 sharrison5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks!

A collection of fairly random comments on the notebook primarily:

  • Do we need to set max_plate_nesting?
  • Maybe stick with the p, q notation in the Variational Inference section, and stick with s for the boosting component?
  • Any mechanism for attribution etc - not clear at first glance if all the examples are contributed by the Pyro team?
  • Agree with Yu re the data*10 statement - if we do need to keep it, perhaps just mention it as an aside?
    Again, looks really good to me. Will let you know if I come across anything else, but this seems basically ready to try and submit AFAIC.

@lorenzkuhn
Copy link
Collaborator Author

I made some changes mostly to the text and committed them to a new branch (see #14). Below are two additional comments:

Thanks for the review, @TNU-yaoy. Your changes to the notebook look good to me; I've merged them into this branch.

  1. you are using 3 different naming conventions for the latent and observed variables: z and x (intro), mu and y (model description), loc and obs (code). It might make sense to unify this if it is not too much work.

Good point, I've changed it to be z and x everywhere.

  1. can we get away with not replicating the observations 10 times?

The approximation we get is quite a bit better if we use more data. Instead of replicating the list ten times, a cleaner way would be to draw some samples from N(4, 0.1) to get the observations. I've updated the notebook in this way, what do you think about that?

@TNU-yaoy
Copy link
Collaborator

looks good to me

@lorenzkuhn
Copy link
Collaborator Author

This is great, thanks!

Hey @sharrison5, thanks a lot for having a look at the tutorial!

A collection of fairly random comments on the notebook primarily:

  • Do we need to set max_plate_nesting?

I think we don't strictly need to, i.e. Pyro will try to infer it if it's not explicitly given.

  • Maybe stick with the p, q notation in the Variational Inference section, and stick with s for the boosting component?

Makes sense, I've changed this.

  • Any mechanism for attribution etc - not clear at first glance if all the examples are contributed by the Pyro team?

Hmm, I didn't find any information on this on the Pyro repo or in the documentation. Maybe there's no such mechanism but that might be negotiable.

  • Agree with Yu re the data*10 statement - if we do need to keep it, perhaps just mention it as an aside?

Fixed this by creating observations by sampling from N(4, 0.1).

Again, looks really good to me. Will let you know if I come across anything else, but this seems basically ready to try and submit AFAIC.

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

Successfully merging this pull request may close these issues.

5 participants