msmbuilder.cluster.RegularSpatial¶

class
msmbuilder.cluster.
RegularSpatial
(d_min, metric='euclidean')¶ Regular spatial clustering.
This method finds a set of cluster centers that are themselves data points, chosen to be approximately equally separated in conformation space with respect to the distance metric used. In pseudocode, the algorithm, from Senne et al. [1], is:
Initialize a list of cluster centers containing only the first data point in the data set
 Iterating over all conformations in the input dataset (in order),
 If the data point is farther than
d_min
from all existing cluster center, add it to the list of cluster centers
 If the data point is farther than
Parameters: d_min : float
Minimum distance between cluster centers. This parameter controls the number of clusters which are found.
metric : {“euclidean”, “sqeuclidean”, “cityblock”, “chebyshev”, “canberra”,
“braycurtis”, “hamming”, “jaccard”, “cityblock”, “rmsd”}
The distance metric to use. metric = “rmsd” requires that sequences passed to
fit()
be`md.Trajectory`
; other distance metrics require ``np.ndarray``s.References
[R6] Senne, Martin, et al. J. Chem Theory Comput. 8.7 (2012): 22232238 Attributes
cluster_center_indices_: array, [n_clusters] Indices of the positions chosen as cluster centers. Each entry is a (trajectory_index, frame_index) pair. cluster_centers_ (array, [n_clusters, n_features]) Coordinates of cluster centers n_clusters_ (int) The number of clusters located. Methods
fit
(sequences[, y])Fit the kcenters clustering on the data fit_predict
(sequences[, y])Performs clustering on X and returns cluster labels. fit_transform
(sequences[, y])Alias for fit_predict get_params
([deep])Get parameters for this estimator. partial_predict
(X[, y])Predict the closest cluster each sample in X belongs to. partial_transform
(X)Alias for partial_predict predict
(sequences[, y])Predict the closest cluster each sample in each sequence in sequences belongs to. set_params
(**params)Set the parameters of this estimator. summarize
()transform
(sequences)Alias for predict 
__init__
(d_min, metric='euclidean')¶
Methods
__init__
(d_min[, metric])fit
(sequences[, y])Fit the kcenters clustering on the data fit_predict
(sequences[, y])Performs clustering on X and returns cluster labels. fit_transform
(sequences[, y])Alias for fit_predict get_params
([deep])Get parameters for this estimator. partial_predict
(X[, y])Predict the closest cluster each sample in X belongs to. partial_transform
(X)Alias for partial_predict predict
(sequences[, y])Predict the closest cluster each sample in each sequence in sequences belongs to. set_params
(**params)Set the parameters of this estimator. summarize
()transform
(sequences)Alias for predict 
fit
(sequences, y=None)¶ Fit the kcenters clustering on the data
Parameters: sequences : list of arraylike, each of shape [sequence_length, n_features]
A list of multivariate timeseries, or
md.Trajectory
. Each sequence may have a different length, but they all must have the same number of features, or the same number of atoms if they are ``md.Trajectory``s.Returns: self

fit_predict
(sequences, y=None)¶ Performs clustering on X and returns cluster labels.
Parameters: sequences : list of arraylike, each of shape [sequence_length, n_features]
A list of multivariate timeseries. Each sequence may have a different length, but they all must have the same number of features.
Returns: Y : list of ndarray, each of shape [sequence_length, ]
Cluster labels

fit_transform
(sequences, y=None)¶ Alias for fit_predict

get_params
(deep=True)¶ Get parameters for this estimator.
Parameters: deep: boolean, optional
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns: params : mapping of string to any
Parameter names mapped to their values.

partial_predict
(X, y=None)¶ Predict the closest cluster each sample in X belongs to.
In the vector quantization literature, cluster_centers_ is called the code book and each value returned by predict is the index of the closest code in the code book.
Parameters: X : arraylike shape=(n_samples, n_features)
A single timeseries.
Returns: Y : array, shape=(n_samples,)
Index of the cluster that each sample belongs to

partial_transform
(X)¶ Alias for partial_predict

predict
(sequences, y=None)¶ Predict the closest cluster each sample in each sequence in sequences belongs to.
In the vector quantization literature, cluster_centers_ is called the code book and each value returned by predict is the index of the closest code in the code book.
Parameters: sequences : list of arraylike, each of shape [sequence_length, n_features]
A list of multivariate timeseries. Each sequence may have a different length, but they all must have the same number of features.
Returns: Y : list of arrays, each of shape [sequence_length,]
Index of the closest center each sample belongs to.

set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.Returns: self

transform
(sequences)¶ Alias for predict