-
-
Notifications
You must be signed in to change notification settings - Fork 985
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
MuE distributions for Pyro. #2728
Conversation
…standard HMM parameters.
cc @samuelklee |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far. Let's chat later this week. It's probably worth adding a tutorial notebook in a subsequent PR.
Another thing @eb8680 and @martinjankowiak and I have discussed is creating a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @EWeinstein, this looks great. I have only a few minor nits remaining.
Could we set up a time to quick walk over the code before merging, just so I can get an idea of future plans?
pyro/contrib/mue/models.py
Outdated
cuda=False, pin_memory=False): | ||
super().__init__() | ||
assert isinstance(cuda, bool) | ||
self.cuda = cuda |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename this to .is_cuda
or something to avoid conflict with the nn.Module.cuda() method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I'll merge now and let's discuss your plans tomorrow.
An implementation of MuE models for pyro. The code is organized as:
contrib/mue/statearrangers.py
Modules for converting standard MuE parameters into standard HMM parameters. Currently, this is just implemented for the profile HMM architecture, but in the future other MuE models will be added.contrib/mue/variablelengthhmm.py
An HMM with discrete states and discrete emissions which can handle variable length sequences, assuming that they are one hot encoded and padded at the end with zeros to some fixed length. Based on DiscreteHMM. In the future this will be extended with functions for sampling, filtering, estimating the latent state and computing the first moment of the distribution.contrib/mue/biosequenceloaders.py
Currently empty; in the future, this will include torch dataloaders for fasta files and for a2m (MSA) files.Example models (profile HMM, FactorMuE) can be found in
examples/contrib/mue
. Unit tests can be found intests/contrib/mue
.One more note: Pyro's DiscreteHMM computes the probability of the initial latent state as
initial_probs @ transition_probs
rather than just usinginitial_probs
(the more common convention I think). I used the second convention, but if Pyro is committed to the first I will change my HMM appropriately; it might help to clarify this in the documentation. (I found the same behavior in Edward2, tensorflow/probability#958).Tasks
make docs
and view docs/build/html/contrib.mue.html to ensure this works.make tutorial
and examine docs to ensure this works.VariableLengthDiscreteHMM
VariableLengthDiscreteHMM
vsDiscreteHMM
Profile
CPU_EXAMPLES
of test_examples.py. We try to pass args so that each such test is quick to run. Runmake test-examples
to ensure this works.