pyemma.msm.analysis.expectation

pyemma.msm.analysis.expectation(T, a, mu=None)

Equilibrium expectation value of a given observable.

Parameters:
  • T ((M, M) ndarray or scipy.sparse matrix) – Transition matrix
  • a ((M,) ndarray) – Observable vector
  • mu ((M,) ndarray (optional)) – The stationary distribution of T. If given, the stationary distribution will not be recalculated (saving lots of time)
Returns:

val – Equilibrium expectation value fo the given observable

Return type:

float

Notes

The equilibrium expectation value of an observable a is defined as follows

\[\mathbb{E}_{\mu}[a] = \sum_i \mu_i a_i\]

\(\mu=(\mu_i)\) is the stationary vector of the transition matrix \(T\).

Examples

>>> from pyemma.msm.analysis import expectation
>>> T=np.array([[0.9, 0.1, 0.0], [0.5, 0.0, 0.5], [0.0, 0.1, 0.9]])
>>> a=np.array([1.0, 0.0, 1.0])
>>> m_a=expectation(T, a)
0.90909090909090917