msmbuilder.msm._ratematrix.build_ratemat

msmbuilder.msm._ratematrix.build_ratemat(exptheta, n, inds, out, which='K')

Build the reversible rate matrix K or symmetric rate matrix, S, from the free parameters, theta

Parameters:

exptheta : array

The element-wise exponential of the free parameters, theta. These values are the linearized elements of the upper triangular portion of the symmetric rate matrix, S, followed by the equilibrium weights.

n : int

Dimension of the rate matrix, K, (number of states)

inds : array, optional (default=None)

Sparse linearized triu indices exptheta. If not supplied, exptheta is assumed to be a dense parameterization of the upper triangular portion of the symmetric rate matrix followed by the log equilibrium weights, and must be of length n*(n-1)/2 + n. If inds is supplied, it is a set of indices, with len(inds) == len(exptheta), 0 <= inds < n*(n-1)/2+n, giving the indices of the nonzero elements of the upper triangular elements of the rate matrix to which exptheta correspond.

which : {‘S’, ‘K’}

Whether to build the matrix S or the matrix K

out : [output], array shape=(n, n)

On exit, out contains the matrix K or S

Notes

The last n elements of exptheta must be nonzero, since they parameterize the equilibrium populations, so even with the sparse parameterization, len(u) must be greater than or equal to n.

With the sparse parameterization, the following invariant holds. If inds = indices_of_nonzero_elements(exptheta), then build_ratemat(exptheta, n, None) == build_ratemat(exptheta[inds], n, inds)

Versions