Skip to content

GLM poisson regression update with bambi #191

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

Merged
merged 2 commits into from
Jul 22, 2021

Conversation

chiral-carbon
Copy link
Collaborator

Addresses issue #86 and updates GLM poisson regression to use bambi instead of pymc.glm


Still pretty new to bambi so wanted to understand how to get mu in the posterior group in the resulting inference data on running bambi.Model.fit() in cell 19.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Jun 29, 2021

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2021-06-29T09:43:15Z
----------------------------------------------------------------

Line #6.    import patsy as pt

Instead of patsy you could use formuale. This is what bambi uses.

from formulae import design_matrices



chiral-carbon commented on 2021-06-29T13:30:32Z
----------------------------------------------------------------

oh okay sure, will use this

@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2021-06-29T09:43:16Z
----------------------------------------------------------------

dm = design_matrices(fml, df, na_action="error")


@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2021-06-29T09:43:16Z
----------------------------------------------------------------

dm.common.as_dataframe()


@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2021-06-29T09:43:17Z
----------------------------------------------------------------

The names used by formulae are slightly different


@review-notebook-app
Copy link

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2021-06-29T09:43:17Z
----------------------------------------------------------------

mu is not present


@review-notebook-app
Copy link

review-notebook-app bot commented Jun 29, 2021

View / edit / reply to this conversation on ReviewNB

aloctavodia commented on 2021-06-29T09:43:18Z
----------------------------------------------------------------

mu is not present.

Maybe instead you can compute the posterior predictive distribution and then take the mean. Something like this.

model.posterior_predictive(inf_fish_alt) #notice tthat by default this is an inplace operation

inf_fish_alt.posterior_predictive["nsneeze"].mean().item()


chiral-carbon commented on 2021-06-29T13:32:31Z
----------------------------------------------------------------

yes wanted some help as to how to get mu with bambi. thanks a lot!

Copy link
Collaborator Author

oh okay sure, will use this


View entire conversation on ReviewNB

Copy link
Collaborator Author

yes wanted some help as to how to get mu with bambi. thanks a lot!


View entire conversation on ReviewNB

@chiral-carbon
Copy link
Collaborator Author

@aloctavodia hey! sorry I took so long to update this, I had been taking a break from the internship for personal reasons. hope you and @OriolAbril can review this when you get some time.

@aloctavodia aloctavodia merged commit 79a7878 into pymc-devs:main Jul 22, 2021
@aloctavodia
Copy link
Member

thanks @chiral-carbon!

@chiral-carbon chiral-carbon deleted the glmpoission branch August 27, 2021 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants