Skip to content

Text backend does not support tallying a subset of variables (raises KeyError) #2560

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

Closed
chumsley opened this issue Sep 12, 2017 · 5 comments
Closed

Comments

@chumsley
Copy link

Attempting to use a trace that was loaded from the text backend yields a KeyError, if the trace contains only a subset of the model's variables (e.g., if it was created using the trace= argument to sample).

Failing example:

with pm.Model() as model:
    a = pm.Gamma('a', mu=10.0, sd=2.0)
    b = pm.Gamma('b', mu=10.0, sd=2.0)

    trace = pm.sample(trace=[model.a, model.a_log__])
    assert len(trace.varnames) == 2

    pm.backends.text.dump('trace.text', trace)

    loaded = pm.backends.text.load('trace.text')
    x = loaded[0] #!!! Will throw a KeyError looking for 'b_log__'
@junpenglao junpenglao added the bug label Sep 16, 2017
@junpenglao
Copy link
Member

Thanks for reporting. We should add the vars=None kwarg into pm.backends.text.load and pm.backends.text.dump

@haritha1313
Copy link

@twiecki @junpenglao I'd like to work on this issue.

@vermashresth
Copy link

Hi @junpenglao
I have gone through the code base of pymc3 and would like to start working on an issue. This one seems old but is it still relevant?

@twiecki
Copy link
Member

twiecki commented Mar 25, 2019

@vermashresth Definitely, you can just try the above code to see if the problem persists.

@michaelosthege
Copy link
Member

We're deprecating multiple backends.. (see #3903)
While the text backend may survive a bit longer, only very few people seem to be using it.

As indicated by our deprecation warnings, please switch backends. If you can't please contact us and tell us why.

Closing this issue, because most likely, nobody will take it up.

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

No branches or pull requests

8 participants