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

construct_sampler does not support transformed observables #89

Open
brandonwillard opened this issue Dec 7, 2022 · 1 comment
Open
Assignees
Labels

Comments

@brandonwillard
Copy link
Member

brandonwillard commented Dec 7, 2022

It looks like we need to convert model graphs into AePPL IR and operate on those, because construct_sampler/construct_ir_fgraph only supports observed RandomVariables and not general MeasurableVariables.

An example:

import aesara.tensor as at
import aemcmc

srng = at.random.RandomStream(23920)

X_rv = srng.normal(0, 1, name="X")
Y_rv = 1 + X_rv

obs_rvs_to_values = {Y_rv: at.scalar("y")}

sample_steps, updates, initial_values, nuts_parameters = aemcmc.construct_sampler(
    obs_rvs_to_values, srng
)
aemcmc/basic.py:40: in construct_sampler
    fgraph, obs_rvs_to_values, memo, new_to_old_rvs = construct_ir_fgraph(
aemcmc/rewriting.py:91: in construct_ir_fgraph
    obs_rvs_to_values = {memo[k]: v for k, v in obs_rvs_to_values.items()}
aemcmc/rewriting.py:91: in <dictcomp>
    obs_rvs_to_values = {memo[k]: v for k, v in obs_rvs_to_values.items()}
E   KeyError: Elemwise{add,no_inplace}.0
@rlouf
Copy link
Member

rlouf commented Dec 7, 2022

Yes. AeMCMC will also need the extra information that we'll add to MeasurableVariable eventually.

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

No branches or pull requests

3 participants