Giter Site home page Giter Site logo

Comments (6)

jmschrei avatar jmschrei commented on August 24, 2024 1

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.

christer-watson avatar christer-watson commented on August 24, 2024

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.

jmschrei avatar jmschrei commented on August 24, 2024

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.

christer-watson avatar christer-watson commented on August 24, 2024

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.

jmschrei avatar jmschrei commented on August 24, 2024

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.

christer-watson avatar christer-watson commented on August 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.