Closed Toolxx closed 8 months ago
Hi, great progress! You actually have to be lucky that you can pipe the transition matrix directly into the deeptime package. A Vampnet only guarantees you a matrix, whose entries add up to 1 within each row. However, negative entries are not excluded, because it is still a Koopman model, where the matrix is the best propagator for the state assignments. In the case of a normal MSM the state assignments are hard (instead of the softmax it is either 1 or 0), this will make the Koopman matrix a real transition matrix. In case of VAMPnets, usually the harder the assignment of states, the more likely the matrix will be a real transition matrix. There are advanced method built on top of VAMPnets which will guarantee real transition matrix and/or reversible models. One could combine these with the iVAMPnet approach. However, we have not tried it yet. Now as a first step I would love to know which post analysis you want to do? Because some of them you can still do with the negative entries, but others you cant.
As a second point, you already found a way how to force the matrix to be non negative afterwards. Setting them to zero is a very rough way, but if you want to do it, you have to normalize the rows again, that they all sum up to 1.
Something like: T = T/T.sum(1, keepdims=True)
Another way is to simply make the soft assignment hard ones. So assign the state with a argmax and then put it into the deeptime package: chi_hard = np.argmax(chi, axis=1)
. This will give you a discrete trajectory and you can use the normal MSM construction scheme.
If you want to stick to soft assignments, I think you will get better results if you optimize a transition matrix to be a good propagator of the state assignments: ||chi(x_t+tau) - T^T chi(x_t)||, where you parametrize T and optimize the function I have provided while enforcing the elements of T to be all positive and each row to sum up to 1.
I hope this helps. Let me know, how it goes!
Andreas
Hi Andreas,
I just realized I forgot to reply to this message. Regarding this part of the my study, after your suggestion, it has continued fordwards. Thank you so much for your help, what you've said has helped my research a lot!
I am now continuing to try to work on the system I am interested in based on your iVAMPnet model. My main interest is how to estimate a reasonable MSM instead of the Koopman model. Other than directly derive the biophysical properties, I need to use MSM in some other tasks. Specifically, I need to estimate the MSM here for different states and then go ahead and compare the existing Markov models in the literature that have been built by other means (generally mathematical modeling, which start from assumptions then build the model other than statistical estimation from MD). Or, based on the MSM estimated to be exported by iVAMPnet, go ahead and bring in the Hodgkin–Huxley model (like Fig3 of Hempel, 2021). Because of the constrains of the above research objectives, probably I would prefer to estimate MSM based on iVAMPnet rather than directly using iVAMPnet's Koopman model.
One more aspect I would like to ask for further advice is: which is more guaranteed in your opinion, deriving discrete trajectories from iVAMPnet's Koopman model and then estimating the MSM, or estimating the MSM with soft assignment setting constraints in iVAMPnet? Or do they each have advantages and disadvantages?
Thanks.
After I have established my iVAMPnet model, I want to further analyze the Markov state model. However, after I use the "get_transition_matrix" function in the ivampnet.py file, the transition matrix I export has negative elements. This prevents me from importing this model into the markov state model class of the deeptime or pyemma. So, I want to ask what is the reason for this? And how can I solve this issue?
My simple attempt is to change the small negative elements to 0 and adjust the tolerance, but this will cause the situation that the stationary distribution cannot be computed.
The code and running results of some of my attempts are as follows