Skip to content

Commit e60d0f4

Browse files
authored
Merge pull request #165 from markovmodel/revision-cw
Revision cw
2 parents d3e0f9f + c71ec37 commit e60d0f4

File tree

3 files changed

+57
-17
lines changed

3 files changed

+57
-17
lines changed

notebooks/03-msm-estimation-and-validation.ipynb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@
8585
"cell_type": "markdown",
8686
"metadata": {},
8787
"source": [
88-
"The first step after obtaining the discretized dynamics is finding a suitable lag time. The systematic approach is to estimate MSMs at various lag times and observe how the implied timescales (ITSs) of these models behave. To this aim, PyEMMA provides the `its()` function which we use to track the first three (`nits=3`) implied timescales:"
88+
"The first step after obtaining the discretized dynamics is finding a suitable lag time.\n",
89+
"The systematic approach is to estimate MSMs at various lag times and observe how the implied timescales (ITSs) of these models behave.\n",
90+
"In particular, we are looking for lag time ranges in which the implied timescales are constant\n",
91+
"(i.e., lag time independent as described in the manuscript in Section 2.1).\n",
92+
"To this aim, PyEMMA provides the `its()` function which we use to track the first three (`nits=3`) implied timescales:"
8993
]
9094
},
9195
{
@@ -117,11 +121,20 @@
117121
"cell_type": "markdown",
118122
"metadata": {},
119123
"source": [
120-
"The above plot tells us that there is one resolved process with an ITS of approximately $8.5$ steps (blue) which is largely invariant to the MSM lag time. The other two ITSs (green, red) are smaller than the lag time (black line, grey-shaded area); they correspond to processes which are faster than the lag time and, thus, are not resolved.\n",
124+
"The above plot tells us that there is one resolved process with an ITS of approximately $8.5$ steps (blue) which is largely invariant to the MSM lag time.\n",
125+
"The other two ITSs (green, red) are smaller than the lag time (black line, grey-shaded area);\n",
126+
"they correspond to processes which are faster than the lag time and, thus, are not resolved.\n",
127+
"Since the implied timescales are, like the corresponding eigenvalues, sorted in decreasing order, we know that all other remaining processes must be even faster.\n",
121128
"\n",
122-
"As MSMs tend to underestimate the true ITSs, we are looking for a converged maximum in the ITS plot. In our case, any lag time before the slow process (blue line) crosses the lag time threshold (black line) would work. To maximize the kinetic resolution, we choose the lag time $1$ step.\n",
129+
"As MSMs tend to underestimate the true ITSs, we are looking for a converged maximum in the ITS plot.\n",
130+
"In our case, any lag time before the slow process (blue line) crosses the lag time threshold (black line) would work.\n",
131+
"To maximize the kinetic resolution, we choose the lag time $1$ step.\n",
123132
"\n",
124-
"To see whether our model satisfies Markovianity, we perform (and visualize) a Chapman-Kolmogorow (CK) test. Since we aim at modeling the dynamics between metastable states rather than between microstates, this will be conducted in the space of metastable states. The latter are identified automatically using PCCA++ (which is explained in a later notebook). We usually choose the number of metastable states according to the implied timescales plot by identifying a gap between the ITS. For a single process, we can assume that there are two metastable states between which the process occurs."
133+
"To see whether our model satisfies Markovianity, we perform (and visualize) a Chapman-Kolmogorow (CK) test.\n",
134+
"Since we aim at modeling the dynamics between metastable states rather than between microstates, this will be conducted in the space of metastable states.\n",
135+
"The latter are identified automatically using PCCA++ (which is explained in [Notebook 05 📓](05-pcca-tpt.ipynb)).\n",
136+
"We usually choose the number of metastable states according to the implied timescales plot by identifying a gap between the ITS.\n",
137+
"For a single process, we can assume that there are two metastable states between which the process occurs."
125138
]
126139
},
127140
{

notebooks/04-msm-analysis.ipynb

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,18 @@
179179
"cell_type": "markdown",
180180
"metadata": {},
181181
"source": [
182-
"The attribute `msm.pi` tells us, for each discrete state, the absolute probability of observing said state in global equilibrium. Mathematically speaking, the stationary distribution $\\pi$ is the left eigenvector of the transition matrix $\\mathbf{T}$ to the eigenvalue $1$:\n",
182+
"The attribute `msm.pi` tells us, for each discrete state, the absolute probability of observing said state in global equilibrium.\n",
183+
"Mathematically speaking, the stationary distribution $\\pi$ is the left eigenvector of the transition matrix $\\mathbf{T}$ to the eigenvalue $1$:\n",
183184
"\n",
184185
"$$\\pi^\\top \\mathbf{T} = \\pi^\\top.$$\n",
185186
"\n",
186-
"We can use the stationary distribution to, e.g., visualize the weight of the dicrete states and, thus, to highlight which areas of our feature space are most probable. Here, we show all data points in a two dimensional scatter plot and color/weight them according to their discrete state membership:"
187+
"Please note that the $\\pi$ is fundamentaly different from a normalized histogram of states:\n",
188+
"for the histogram of states to accurately describe the stationary distribution, the data needs to be sampled from global equilibrium, i.e, the data points need to be statistically independent.\n",
189+
"The MSM approach, on the other hand, only requires local equilibrium, i.e., statistical independence of state transitions.\n",
190+
"Thus, the MSM approach requires a much weaker and, in practice, much easier to satisfy condition than simply counting state visits.\n",
191+
"\n",
192+
"We can use the stationary distribution to, e.g., visualize the weight of the dicrete states and, thus, to highlight which areas of our feature space are most probable.\n",
193+
"Here, we show all data points in a two dimensional scatter plot and color/weight them according to their discrete state membership:"
187194
]
188195
},
189196
{
@@ -236,7 +243,9 @@
236243
"cell_type": "markdown",
237244
"metadata": {},
238245
"source": [
239-
"We will see further uses of the stationary distribution later. But for now, we continue the analysis of our model by visualizing its (right) eigenvectors. First, we notice that the first right eigenvector is a constant $1$."
246+
"We will see further uses of the stationary distribution later.\n",
247+
"But for now, we continue the analysis of our model by visualizing its (right) eigenvectors which encode the dynamical processes.\n",
248+
"First, we notice that the first right eigenvector is a constant $1$."
240249
]
241250
},
242251
{
@@ -281,11 +290,15 @@
281290
"cell_type": "markdown",
282291
"metadata": {},
283292
"source": [
284-
"The right eigenvectors can be used to visualize the processes governed by the corresponding implied timescales. The first right eigenvector (always) is $(1,\\dots,1)^\\top$ for an MSM transition matrix and it corresponds to the stationary process (infinite implied timescale).\n",
293+
"The right eigenvectors can be used to visualize the processes governed by the corresponding implied timescales.\n",
294+
"The first right eigenvector (always) is $(1,\\dots,1)^\\top$ for an MSM transition matrix and it corresponds to the stationary process (infinite implied timescale).\n",
285295
"\n",
286-
"The second right eigenvector corresponds to the slowest process; its entries are negative for one group of discrete states and positive for the other group. This tells us that the slowest process happens between these two groups and that the process relaxes on the slowest ITS ($\\approx 8.5$ steps).\n",
296+
"The second right eigenvector corresponds to the slowest process;\n",
297+
"its entries are negative for one group of discrete states and positive for the other group.\n",
298+
"This tells us that the slowest process happens between these two groups and that the process relaxes on the slowest ITS ($\\approx 8.5$ steps).\n",
287299
"\n",
288-
"The third and fourth eigenvectors show a larger spread of values and no clear grouping. In combination with the ITS convergence plot, we can safely assume that these eigenvectors contain just noise and do not indicate any resolved processes.\n",
300+
"The third and fourth eigenvectors show a larger spread of values and no clear grouping.\n",
301+
"In combination with the ITS convergence plot, we can safely assume that these eigenvectors contain just noise and do not indicate any resolved processes.\n",
289302
"\n",
290303
"We then continue to validate our MSM with a CK test for $2$ metastable states which are already indicated by the second right eigenvector."
291304
]
@@ -423,7 +436,11 @@
423436
"source": [
424437
"Again, we have the $(1,\\dots,1)^\\top$ first right eigenvector of the stationary process.\n",
425438
"\n",
426-
"The second to fourth right eigenvectors illustrate the three slowest processes.\n",
439+
"The second to fourth right eigenvectors illustrate the three slowest processes which are (in that order):\n",
440+
"\n",
441+
"- rotation of the $\\Phi$ dihedral,\n",
442+
"- rotation of the $\\Psi$ dihedral when $\\Phi\\approx-2$ rad, and\n",
443+
"- rotation of the $\\Psi$ dihedral when $\\Phi\\approx1$ rad.\n",
427444
"\n",
428445
"Eigenvectors five, six, and seven indicate further processes which, however, relax faster than the lag time and cannot be resolved clearly.\n",
429446
"\n",

notebooks/08-common-problems.ipynb

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
"- you can find the full documentation at [PyEMMA.org](http://www.pyemma.org).\n",
1919
"---\n",
2020
"\n",
21-
"Most problems arise from bad sampling combined with a poor discretization. For estimating a Markov model, it is required to have a connected data set, i.e. we must have observed each process we want to describe in both directions. PyEMMA checks if this requirement is fulfilled, however in certain situations this might be less obvious."
21+
"Most problems in Markov modeling of MD data arise from bad sampling combined with a poor discretization.\n",
22+
"For estimating a Markov model, it is required to have a connected data set,\n",
23+
"i.e., we must have observed each process we want to describe in both directions.\n",
24+
"PyEMMA checks if this requirement is fulfilled but, however, in certain situations this might be less obvious."
2225
]
2326
},
2427
{
@@ -40,7 +43,8 @@
4043
"source": [
4144
"## Case 1: preprocessed, two-dimensional data (toy model)\n",
4245
"### well-sampled double-well potential\n",
43-
"Let's again have a look at the double-well potential. Since we are only interested in the problematic situations here, we will simplify our data a bit and work with a 1D projection."
46+
"Let's again have a look at the double-well potential.\n",
47+
"Since we are only interested in the problematic situations here, we will simplify our data a bit and work with a 1D projection."
4448
]
4549
},
4650
{
@@ -97,7 +101,7 @@
97101
"cell_type": "markdown",
98102
"metadata": {},
99103
"source": [
100-
"We visualize the histogram along with the first part of the trajectory (left panel) and the MSM implied timescales (right panel):"
104+
"As a reference, we visualize the histogram of this well-sampled trajectory along with the first $200$ steps (left panel) and the MSM implied timescales (right panel):"
101105
]
102106
},
103107
{
@@ -122,13 +126,19 @@
122126
"cell_type": "markdown",
123127
"metadata": {},
124128
"source": [
125-
"We see a nice, reversibly connected trajectory. That means we have sampled transitions between the basins in both directions that are correctly resolved by the discretization. As we see from the almost perfect overlay of discrete and continuous trajectory, nearly no discretization error is made. \n",
129+
"We see a nice, reversibly connected trajectory.\n",
130+
"That means we have sampled transitions between the basins in both directions that are correctly resolved by the discretization.\n",
131+
"As we see from the almost perfect overlay of discrete and continuous trajectory, nearly no discretization error is made. \n",
126132
"\n",
127133
"### irreversibly connected double-well trajectories\n",
128134
"\n",
129-
"In MD simulations, we often face the problem that a process is sampled only in one direction. For example, consider protein-protein binding. The unbinding might take on the order of seconds to minutes and is thus difficult to sample. We will have a look what happens with the MSM in this case. \n",
135+
"In MD simulations, we often face the problem that a process is sampled only in one direction.\n",
136+
"For example, consider protein-protein binding.\n",
137+
"The unbinding might take on the order of seconds to minutes and is thus difficult to sample.\n",
138+
"We will have a look what happens with the MSM in this case. \n",
130139
"\n",
131-
"Our example are two trajectories sampled from a double-well potential, each started in a different basin. They will be color coded."
140+
"Our example are two trajectories sampled from a double-well potential, each started in a different basin.\n",
141+
"They will be color coded."
132142
]
133143
},
134144
{

0 commit comments

Comments
 (0)