deeptime.markov.tools.analysis.expectation¶
- deeptime.markov.tools.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
>>> import numpy as np >>> from deeptime.markov.tools.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) >>> m_a 0.909090909...