deeptime.markov.tools.analysis.mfpt

deeptime.markov.tools.analysis.mfpt(T, target, origin=None, tau=1, mu=None)

Mean first passage times (from a set of starting states - optional) to a set of target states.

Parameters:
  • T (ndarray or scipy.sparse matrix, shape=(n,n)) – Transition matrix.

  • target (int or list of int) – Target states for mfpt calculation.

  • origin (int or list of int (optional)) – Set of starting states.

  • tau (int (optional)) – The time-lag (in elementary time steps of the microstate trajectory) at which the given transition matrix was constructed.

  • mu ((n,) ndarray (optional)) – The stationary distribution of the transition matrix T.

Returns:

m_t – Mean first passage time or vector of mean first passage times.

Return type:

ndarray, shape=(n,) or shape(1,)

Notes

The mean first passage time Ex[TY]\mathbf{E}_x[T_Y] is the expected hitting time of one state yy in YY when starting in state xx. [1].

For a fixed target state yy it is given by

Ex[Ty]={0x=y1+zTx,zEz[Ty]xy\mathbb{E}_x[T_y] = \left \{ \begin{array}{cc} 0 & x=y \\ 1+\sum_{z} T_{x,z} \mathbb{E}_z[T_y] & x \neq y \end{array} \right.

For a set of target states YY it is given by

Ex[TY]={0xY1+zTx,zEz[TY]xY\mathbb{E}_x[T_Y] = \left \{ \begin{array}{cc} 0 & x \in Y \\ 1+\sum_{z} T_{x,z} \mathbb{E}_z[T_Y] & x \notin Y \end{array} \right.

The mean first passage time between sets, EX[TY]\mathbf{E}_X[T_Y], is given by

EX[TY]=xXμxEx[TY]zXμz\mathbb{E}_X[T_Y] = \sum_{x \in X} \frac{\mu_x \mathbb{E}_x[T_Y]}{\sum_{z \in X} \mu_z}

References

Examples

>>> import numpy as np
>>> from deeptime.markov.tools.analysis import mfpt
>>> T = np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]])
>>> m_t = mfpt(T, 0)
>>> m_t
array([ 0., 12., 22.])