<commit_before>.. _cluster:
.. currentmodule:: msmbuilder.cluster

Geometric Clustering
====================

Background
----------

The goal of clustering MD trajectories is to group the the data [#f1]_ into
a set of groups (clusters) such that conformations in the same cluster are
structurally similar to one another, and conformations in different clusters
are structurally distinct.

The two central issues for clustering MD data are

#. How should "structurally similar" be defined? What distance metric should be used?
#. Given the distance metric, what algorithm should be used to actually cluster the data?

On point 1, there is no consensus in the protein MD literature. Popular distance
metrics include cartesian root-mean squared deviation of atomic positions (RMSD)
[#f3]_, distances based on the number of native contacts formed, distances based
on the difference in backbone dihedral angles, and probably others.

On point 2, "Optimal" clustering is NP-hard [#f2]_, so there's usually a
tradeoff between clustering quality and computational cost. For that reason
MSMBuilder has a bunch of different clustering algorithms implemented.

API and Implementation Notes
----------------------------

All clustering algorithms in MSMBuilder follow the following basic API.
Hyperparameters, including the number of clusters, random seeds, the distance
metric (if applicable), etc are passed to the class constructor. Then,
the heavy-lifting is done by calling ``fit(sequences)``. The argument to
``fit`` should be a **list** of molecular dynamics trajectories or a list of 2D
numpy arrays, each of shape ``(length_of_trajecotry, n_features)``.


Algorithms
----------
.. autosummary::
    :toctree: generated/
    :template: class.rst

    KCenters
    KMeans
    KMedoids
    MinibatchKMedoids
    RegularSpatial
    LandmarkAgglomerative


Additional Algorithms
---------------------
.. autosummary::
    :toctree: generated/<commit_msg>Update cluster.rst<commit_after>.. _cluster:
.. currentmodule:: msmbuilder.cluster

Geometric Clustering
====================

Background
----------

The goal of clustering MD trajectories is to group the the data [#f1]_ into
a set of groups (clusters) such that conformations in the same cluster are
structurally similar to one another, and conformations in different clusters
are structurally distinct.

The two central issues for clustering MD data are

#. How should "structurally similar" be defined? What distance metric should be used?
#. Given the distance metric, what algorithm should be used to actually cluster the data?

On point 1, there is no consensus in the protein MD literature. Popular distance
metrics include cartesian root-mean squared deviation of atomic positions (RMSD)
[#f3]_, distances based on the number of native contacts formed, distances based
on the difference in backbone dihedral angles, and probably others.

On point 2, "Optimal" clustering is NP-hard [#f2]_, so there's usually a
tradeoff between clustering quality and computational cost. For that reason
MSMBuilder has a bunch of different clustering algorithms implemented.

API and Implementation Notes
----------------------------

All clustering algorithms in MSMBuilder follow the following basic API.
Hyperparameters, including the number of clusters, random seeds, the distance
metric (if applicable), etc are passed to the class constructor. Then,
the heavy-lifting is done by calling ``fit(sequences)``. The argument to
``fit`` should be a **list** of molecular dynamics trajectories or a list of 2D
numpy arrays, each of shape ``(length_of_trajecotry, n_features)``.


Algorithms
----------
.. autosummary::
    :toctree: generated/
    :template: class.rst

    KCenters
    KMeans
    KMedoids
    MiniBatchKMedoids
    RegularSpatial
    LandmarkAgglomerative


Additional Algorithms
---------------------
.. autosummary::
    :toctree: generated/
{'fraction_non_alphanumeric': 0.09828072876571722, 'fraction_numerical': 0.003079291762894534, 'mean_word_length': 3.90314465408805, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1404632', 'n_tokens_mistral': 1030, 'n_tokens_neox': 943, 'n_words': 484}