MSM Construction: msmbuilder.MSMLib

Functions for building MSMs

Notes

  • Assignments typically refer to a numpy array of integers such that Assignments[i,j] gives the state of trajectory i, frame j.
  • Transition and Count matrices are typically stored in scipy.sparse.csr_matrix format.
  • Some functionality from this module was moved into msmanalysis in version2.6

Mapping

apply_mapping_to_assignments(assignments, ...) Remap the states in an assignments file according to a mapping.
apply_mapping_to_vector(vector, mapping) Remap an observable vector after ergodic trimming
renumber_states(assignments) Renumber states to be consecutive integers (0, 1, ...
invert_assignments(assignments) Invert an assignments array – that is, produce a mapping

Trimming

tarjan(graph) Find the strongly connected components in a graph using Tarjan’s algorithm.
ergodic_trim(counts[, assignments]) Use Tarjan’s Algorithm to find maximal strongly connected subgraph.

Model Building

build_msm(counts[, symmetrize, ergodic_trimming]) Estimates the transition probability matrix from the counts matrix.
build_msm_from_counts
estimate_rate_matrix(count_matrix, assignments) MLE Rate Matrix given transition counts and dwell times
mle_reversible_count_matrix(count_matrix) Maximum likelihood estimate for a reversible count matrix
estimate_transition_matrix(count_matrix) Simple Maximum Likelihood estimator of transition matrix.
get_count_matrix_from_assignments(assignments) Calculate counts matrix from assignments.
get_counts_from_traj(states[, n_states, ...]) Computes the transition count matrix for a sequence of states (single trajectory).
log_likelihood(count_matrix, transition_matrix) log of the likelihood of an observed count matrix given a transition matrix