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

Fix SIR predict() use of reparameterizers #2431

Merged
merged 2 commits into from
Apr 22, 2020
Merged

Conversation

fritzo
Copy link
Member

@fritzo fritzo commented Apr 22, 2020

Addresses #2426

This fixes a bug whereby forecasting failed when using reparameterizers like --dct. It's still unclear whether DCT reparam will be useful here, but this bug fix might also be helpful for other reparameterizers we try to use.

This PR also:

  • cleans up some comments in predict(), and
  • speeds up unit tests by reducing max_tree_depth

Tested

  • added forecasting to the dct test in test_examples.py

Comment on lines +486 to +488
if args.dct: # Apply the same reparameterizer as during inference.
rep = DiscreteCosineReparam()
model = poutine.reparam(model, {"S_aux": rep, "I_aux": rep})
Copy link
Member Author

Choose a reason for hiding this comment

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

This was the bug: S_aux was being sampled from the prior because the inferred samples only provided S_aux_dct.

'sir_hmc.py -t=2 -w=2 -n=4 -d=2 -m=1 --enum',
'sir_hmc.py -t=2 -w=2 -n=4 -d=2 -p=10000 --sequential',
'sir_hmc.py -t=2 -w=2 -n=4 -d=100 -p=10000 -f 2',
'sir_hmc.py -t=2 -w=2 -n=4 -d=100 -p=10000 -f 2 --dct',
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the regression test: -f fails before this PR

@martinjankowiak martinjankowiak merged commit c21902e into dev Apr 22, 2020
@fritzo fritzo deleted the sir-fix-predict branch April 28, 2020 01:14
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