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

Rewrite to remove normalization constants from joint_logprob #33

Open
ricardoV94 opened this issue Jul 26, 2021 · 4 comments
Open

Rewrite to remove normalization constants from joint_logprob #33

ricardoV94 opened this issue Jul 26, 2021 · 4 comments
Labels
enhancement New feature or request graph rewriting Involves the implementation of rewrites to Aesara graphs help wanted Extra attention is needed

Comments

@ricardoV94
Copy link
Contributor

ricardoV94 commented Jul 26, 2021

There was some work documented here already: pymc-devs/pymc#4396

Would be a great feature to include in the library.

CC'ing @manthehunted on the off-chance that he/she is still interested in this

@ricardoV94 ricardoV94 added enhancement New feature or request graph rewriting Involves the implementation of rewrites to Aesara graphs help wanted Extra attention is needed labels Jul 26, 2021
@manthehunted
Copy link

@ricardoV94

Yes I am. I am just not sure what else I need to do. Since I do not use pymc3 or Bayesian framework as much, I am not sure what are completion criteria.

It will be great if someone can specify the end goal, other than "we like to do this" (because a normalization factor for a simple case is done). Then I am totally happy to push this to the end.

@ricardoV94
Copy link
Contributor Author

ricardoV94 commented Jul 27, 2021

It will be great if someone can specify the end goal

I guess we need to check if any obvious optimizations are missed by your implementation when using realistic models (e.g., hierarchical models, variable transformations, mixture models, etc), examples of which can be found in the current tests.

And if things are working alright, we need tests. Should be as simple as evaluating a couple of models with and without the optimization and checking that indeed they differ only by a constant term.

@brandonwillard might have more concrete advice here.

@brandonwillard
Copy link
Member

Before I forget, here's a Gist with the beginnings of an implementation for all this.

It has the added constraint that it doesn't want to change the multiplication order of terms, so it "uniquifies" terms in a graph in order to keep track of exactly which terms were being multiplied amid distributive expansions.

Without that rather strong requirement, something like RemoveMulConstants alone would do the job.

@twiecki
Copy link

twiecki commented Aug 31, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request graph rewriting Involves the implementation of rewrites to Aesara graphs help wanted Extra attention is needed
Projects
Status: Graph
Development

No branches or pull requests

4 participants