Skip to content

Shortcut: CLASSICAL_MDS

Module dimred
Description Usage
Create a low-dimensional projection of a trajectory using the classical multidimensional used in 1 tutorialsused in 0 eggs
output value type
the low dimensional projections for the input data points matrix

Details and examples

Create a low-dimensional projection of a trajectory using the classical multidimensional scaling algorithm.

Multidimensional scaling (MDS) is similar to what is done when you make a map. You start with distances between London, Belfast, Paris and Dublin and then you try to arrange points on a piece of paper so that the (suitably scaled) distances between the points in your map representing each of those cities are related to the true distances between the cities. Stating this more mathematically MDS endeavors to find an isometry between points distributed in a high-dimensional space and a set of points distributed in a low-dimensional plane. In other words, if we have -dimensional points, , and we can calculate dissimilarities between pairs them, , we can, with an MDS calculation, try to create projections, , of the high dimensionality points in a -dimensional linear space by trying to arrange the projections so that the Euclidean distances between pairs of them, , resemble the dissimilarities between the high dimensional points. In short we minimize:

where is the distance between point and point and is the distance between the projection of , , and the projection of , . A tutorial on this approach can be used to analyze simulations can be found in this tutorial and in the following short video.

Examples

The following command instructs plumed to construct a classical multidimensional scaling projection of a trajectory. The RMSD distance between atoms 1-256 have moved is used to measure the distances in the high-dimensional space.

Click on the labels of the actions for more information on what each action computes
tested on2.11
ff: COLLECT_FRAMESCollect atomic positions or argument values from the trajectory for later analysis This action is a shortcut and it has hidden defaults. More details ATOMSlist of atomic positions that you would like to collect and store for later analysis=1-256
mds: CLASSICAL_MDSCreate a low-dimensional projection of a trajectory using the classical multidimensional This action is a shortcut. More details ARGthe arguments that you would like to make the histogram for=ff NLOW_DIMnumber of low-dimensional coordinates required=2
weights: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=ff.logweights FUNCthe function you wish to evaluate=exp(x) PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
DUMPPDBOutput PDB file. More details ATOM_INDICESthe indices of the atoms in your PDB output=1-256 ATOMSvalue containing positions of atoms that should be output=ff_data ARGthe values that are being output in the PDB file=mds,weights FILEthe name of the file on which to output these quantities=embed.pdb

By contrast the following input instructs PLUMED to calculate the distances between atoms by taking the differences in five torsional angles. The MDS algorithm is then used to arrange a set of points in a low dimensional space in a way that reproduces these differences.

Click on the labels of the actions for more information on what each action computes
tested on2.11
phi1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
phi2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=5,6,7,8
phi3: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=9,10,11,12
phi4: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=13,14,15,16
phi5: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=17,18,19,20

angles: COLLECT_FRAMESCollect atomic positions or argument values from the trajectory for later analysis This action is a shortcut and it has hidden defaults. More details ARGthe labels of the values whose time series you would like to collect for later analysis=phi1,phi2,phi3,phi4,phi5
mds: CLASSICAL_MDSCreate a low-dimensional projection of a trajectory using the classical multidimensional This action is a shortcut. More details ARGthe arguments that you would like to make the histogram for=angles NLOW_DIMnumber of low-dimensional coordinates required=2
weights: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=angles.logweights FUNCthe function you wish to evaluate=exp(x) PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
DUMPVECTORPrint a vector to a file More details ARGthe labels of vectors/matrices that should be output in the file=mds,weights FILE the file on which to write the vetors=list_embed

The following section is for people who are interested in how this method works in detail. A solid understanding of this material is not necessary to use MDS.

Method of optimization

The stress function can be minimized using the conjugate gradients or steepest descent optimization algorithms that are implemented in ARRANGE_POINTS. However, it is more common to do this minimization using a technique known as classical scaling. Classical scaling works by recognizing that each of the distances in the above sum can be written as:

We can use this expression and matrix algebra to calculate multiple distances at once. For instance if we have three points, , we can write distances between them as:

This last equation can be extended to situations when we have more than three points. In it is a matrix that has one high-dimensional point on each of its rows and is its transpose. is an vector of ones and is a vector with components given by:

These quantities are the diagonal elements of , which is a dot product or Gram Matrix that contains the dot product of the vector with the vector in element .

In classical scaling we introduce a centering matrix that is given by:

where is the identity. Multiplying the equations above from the front and back by this matrix and a factor of a gives:

The fist two terms in this expression disappear because , where is a matrix containing all zeros. In the final step meanwhile we use the fact that the matrix of squared distances will not change when we translate all the points. We can thus assume that the mean value, , for each of the components, :

is equal to 0 so the columns of add up to 0. This in turn means that each of the columns of adds up to zero, which is what allows us to write .

The matrix of squared distances is symmetric and positive-definite we can thus use the spectral decomposition to decompose it as:

Furthermore, because the matrix we are diagonalizing, , is the product of a matrix and its transpose we can use this decomposition to write:

Much as in PCA there are generally a small number of large eigenvalues in and many small eigenvalues. We can safely use only the large eigenvalues and their corresponding eigenvectors to express the relationship between the coordinates . This gives us our set of low-dimensional projections.

This derivation makes a number of assumptions about the how the low dimensional points should best be arranged to minimize the stress. If you use an interactive optimization algorithm such as SMACOF you may thus be able to find a better (lower-stress) projection of the points. For more details on the assumptions made see this website.

Full list of keywords

The following table describes the keywords and options that can be used with this action

Keyword Type Default Description
ARG compulsory none the arguments that you would like to make the histogram for
NLOW_DIM compulsory none number of low-dimensional coordinates required