markovmodel / msmtools

Tools for estimating and analyzing Markov state models
GNU Lesser General Public License v3.0
40 stars 26 forks source link

non-converged transition matrix estimates: are they reversible? #44

Closed franknoe closed 7 years ago

franknoe commented 9 years ago

Is it possible that a transition matrix estimate returned by the reversible MLE if convergence within maxiter fails, is not reversible? I just ran into this pair of warnings. Since this happens within HMM sampling it's nontrivial to isolate a nice test case, so maybe the MLE code experts could have a look if for that case (exit due to iter > maxiter), some additional precautions to make sure that the resulting transition matrix is reversible with high accuracy, are not taken.

/Users/noe/anaconda/lib/python2.7/site-packages/msmtools/analysis/dense/pcca.py:292: ComplexWarning: Casting complex values to real discards the imaginary part
  evecs[:, i] /= math.sqrt(np.dot(evecs[:, i] * pi, evecs[:, i]))
/Users/noe/anaconda/lib/python2.7/site-packages/msmtools/estimation/dense/transition_matrix.py:197: 

NotConvergedWarning: Reversible transition matrix estimation didn't converge.
  warnings.warn("Reversible transition matrix estimation didn't converge.", msmtools.util.exceptions.NotConvergedWarning)
fabian-paul commented 8 years ago

This is addressed in PR #74. Return values of the reversible estimators always fulfil pi_i T_ij = p_j T_ji but the diagonal elements are wrong to that we can't conclude from that equation that sim_i pi_i T_ij = pi_j. Therefore for example stationary_distribution() fails. Fixing the normalization gives a formally correct T matrix that fulfils detailed balance with its own stationary distribution.

marscher commented 7 years ago

since #74 is merged, I close this now.