msmtools.estimation.prior_neighbor

msmtools.estimation.prior_neighbor(C, alpha=0.001)

Neighbor prior for the given count matrix.

Parameters:
  • C ((M, M) ndarray or scipy.sparse matrix) – Count matrix
  • alpha (float (optional)) – Value of prior counts
Returns:

B – Prior count matrix

Return type:

(M, M) ndarray or scipy.sparse matrix

Notes

The neighbor prior \(b_{ij}\) is defined as

\[\begin{split}b_{ij}=\left \{ \begin{array}{rl} \alpha & c_{ij}+c_{ji}>0 \\ 0 & \text{else} \end{array} \right .\end{split}\]

Examples

>>> import numpy as np
>>> from msmtools.estimation import prior_neighbor
>>> C = np.array([[10, 1, 0], [2, 0, 3], [0, 1, 4]])
>>> B = prior_neighbor(C)
>>> B
array([[ 0.001,  0.001,  0.   ],
       [ 0.001,  0.   ,  0.001],
       [ 0.   ,  0.001,  0.001]])