Comments (6)
Howdy
Yeah, sorry, time-dependent HMMs are super cool but aren't currently supported. If you have a resource for how they're implemented I'd love to take a look to confirm my understanding but I can't commit to implementing them soon.
from pomegranate.
Just one last question. Push aside the difficulties of a time covariate. Is something like a temperature covariate (i.e., not cyclic) easy to incorporate, or would that too require creating a new HMM distribution?
from pomegranate.
The short answer is you'd probably need to make a new class in either situation but that potentially the modifications would be minimal.
If these covariates linearly modify the log probabilities in the transition matrix you could modify the forward
and backward
functions (e.g., this line https://github.com/jmschrei/pomegranate/blob/master/pomegranate/hmm/dense_hmm.py#L339 and maybe also https://github.com/jmschrei/pomegranate/blob/master/pomegranate/hmm/dense_hmm.py#L333) to add in your covariates at that time step. Conceptually, if you're able to fix the forward
and backward
methods (and pass the tensor of covariates through all the other functions, e.g. fit
and forward_backward
) you should also be able to train the model without any other larger modifications.
If these covariates non-linearly modified/generated the transition matrix you'd probably need to do something more complicated that takes in the covariates as input and outputs a transition matrix at each step. I can see this being possible, particularly with PyTorch, but I don't know exactly how you'd optimize the whole thing.
from pomegranate.
Thanks for responding here. One last question. Let's say I want to develop a HMM where each hidden state has two different emission distributions. That is, we can observe two different features. One feature is continuous, drawn from a Gaussian, say. The second feature, however, is categorical. Totally different property.
Is this possible?
Reading through the very-well written documentation, I can't figure out if this is possible or not. I've tried playing around, without any luck.
from pomegranate.
Yes, you should be able to use IndependentComponents
, which treats each feature independently with a different distribution: https://github.com/jmschrei/pomegranate/blob/master/pomegranate/distributions/independent_components.py#L15
A downside of this is that it does treat the two features independently -- which may not be exactly what you want.
from pomegranate.
I think that is exactly what I want. No covariance. Thanks. Btw, the documentation on Independent Components from earlier versions doesn't appear to have migrated to the v1.0 documentation, so I didn't even know this class existed. Reading the older documentation and the code makes clear how to use it, though.
When I tried to create a HMM that was fitting a gaussian feature and a separate categorical feature, I ran into an error. The data are converted to floats, but the categorical distribution is expecting an Int or Long to index a probability calculation. I went into the code and, at the appropriate point, cast the data to Int and it appears to work. I didn't add any error checking, however, so it probably makes the code more fragile.
Would you want me to try to make a pull request with this change or just leave it?
from pomegranate.
Related Issues (20)
- conditional_categorical.py : RuntimeError: scatter(): Expected self.dtype to be equal to src.dtype[BUG] HOT 1
- [QUESTION] I would like to fix the transition matrix upon running. Can I have some help pointing to what update steps need to be commented? HOT 14
- import pomegranate error HOT 1
- [BUG] ragged input to HMM HOT 1
- Gaussian Mixture yields large negative improvement on first step using weighted data with large range in weights HOT 1
- [BUG] Weighting in GMM is ignored
- [QUESTION] Best practice for initializing HMM language model? HOT 2
- [QUESTION] Is structure learning from sample data supported in the latest version? HOT 3
- Dynamic bayesian network to be fitted with hybrid variables(consist of discrete and continuous variable) HOT 3
- static variable HOT 2
- structure learning for hybird DBN HOT 1
- from_samples equivalent code after v1.0 HOT 4
- Sample function of Bayesian network HOT 2
- NotImplementedError: zero-inflated poisson HMM HOT 4
- Bayesian Network Predicts Wrong Values HOT 1
- Bayesian Network Prediction, tuple index out of range HOT 2
- Why Bayesian network requires non-negative data HOT 2
- [Question] "Variances must be positive" Error When Using `Normal().fit(data)` and Adding Beta Distribution Support HOT 1
- [BUG] Error when fitting a Normal distribution with a masked tensor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pomegranate.