-
Notifications
You must be signed in to change notification settings - Fork 590
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
modifying an existing transition probability #9
Comments
Currently there isn't. I'm using a three vector approach to sparse matrices, but each vector is a private attribute right now. Can you describe what type of constraints you'd like to put in? You can tie edges and add edge inertia during training, if either of those help. |
I'd like to learn an autoregressive (AR)HMM. In this model, there is an inner hidden variable that is connected to itself at next time point and an outer hidden variable. The outer hidden variable is connected to itself in the next time point and to the observation. A possible work-around would be to re-build the model from scratch every iteration but I would have thought that others may find such a feature useful. Another use-case for this is a program for what-if scenario analysis where the user may want to make modifications to a model and re-run it. The same workaround (regeneration the model) would apply. |
(edited my previous comment to clarify it a bit) |
Autoregressive HMMs are super cool, and I would like to add more functionality to both the HMM section and the Bayes net section to make them (and other wild HMM models) easier to build/train/use. However, time is a major limitation in my life right now--I haven't even had time to flesh out factor graphs, which was my goal for this quarter. Rebuilding the model from scratch is a currently viable solution, though very hacky and inefficient. I agree there should be a better way; and adding it shouldn't be too difficult. I'll add in a method which takes in either a dense or sparse matrix and calculates a new internal transition matrix from that. If you need something very soon, the model regeneration technique shouldn't be too difficult to code (just computationally intensive) and would be something like the following:
** edited code slightly ** Let me know if this helps. When I have time I'll add in the new function. |
Thanks. |
Whoops, my bad. I actually went and checked if it took distributions or states, then updated the As long as you know which distributions you want to tie, remembering which indices refer to the same distribution shouldn't be too bad, and then just passing in one distribution object for each index in the future. There is a cost, but you don't want to just return the matrix Baum-Welch calculates, because you're updating your parameters using it causing it to be out of date. You're replicating effort because the forward_backward matrix you calculate in iteration 3 should be the same as the Baum-Welch matrix in iteration 4. Though, now that I think about it, if you're externally regularizing parameters based on autoregression that isn't even true anymore. The Baum-Welch matrix is going to be different (I think) than the previous iterations forward_backward, because you've changed parameters between the two calculation. I would start off with the possible duplication of effort as a proof of concept, and then see if the forward_backward matrix and the Baum-Welch are the same. |
You're right, both about the out-of date Baum Welch and the changes caused by the external transition probability updates invalidating the forward-backward result. |
Is there a bette way to achieve this now? Or a complete example that demonstrates the use of modifying the transition matrix to enforce some simple constraints (like a certain transition being impossible, ie probability of 0.0)? |
Looking into the code, it seems the |
Is there a way to modify a transition probability in a model manually?
In my specific use-case, I'd like to have this ability so I can enforce some constraints on the transitions.
Specifically, I would like to interleave a constraints enforcing method in-between single baum_welch iterations.
Thanks !
Lavi
The text was updated successfully, but these errors were encountered: