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

Implement DiscreteHMM.sample() #3050

Merged
merged 3 commits into from
Mar 22, 2022
Merged

Implement DiscreteHMM.sample() #3050

merged 3 commits into from
Mar 22, 2022

Conversation

fritzo
Copy link
Member

@fritzo fritzo commented Mar 21, 2022

Inspired by a forum question whose answer would have been easier if we had implemented DiscreteHMM.sample() for generating data. In addition, Bayesian workflow recommends sanity checking models by generating data. We already have .rsample() methods for GaussianHMM and LinearHMM.

Tested

  • added lots of shape tests
  • added a simple test of distribution

Copy link
Collaborator

@martinjankowiak martinjankowiak left a comment

Choose a reason for hiding this comment

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

generally looks good but this sample method is non-parallel in contrast to all (?) other *HMM code. should at least comment in the docstring, which purports to parallelize over time?

pyro/distributions/hmm.py Show resolved Hide resolved
tests/distributions/test_hmm.py Show resolved Hide resolved
@martinjankowiak martinjankowiak merged commit 8ac6c46 into dev Mar 22, 2022
@martinjankowiak martinjankowiak deleted the discrete-hmm-sample branch March 22, 2022 12:01
@fritzo
Copy link
Member Author

fritzo commented Mar 22, 2022

Thanks for reviewing @martinjankowiak!

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