msmbuilder.clustering.KCenters

class msmbuilder.clustering.KCenters(metric, trajectories=None, prep_trajectories=None, k=None, distance_cutoff=None, seed=0)[source]
__init__(metric, trajectories=None, prep_trajectories=None, k=None, distance_cutoff=None, seed=0)[source]

Run kcenters clustering algorithm.

Terminates either when k clusters have been identified, or when every data is clustered better than distance_cutoff.

Parameters:

metric : msmbuilder.metrics.AbstractDistanceMetric

A metric capable of handling ptraj

trajectory : Trajectory or list of msmbuilder.Trajectory

data to cluster

k : {int, None}

number of desired clusters, or None

distance_cutoff : {float, None}

Stop identifying new clusters once the distance of every data to its cluster center falls below this value. Supply either this or k

seed : int, optional

index of the frame to use as the first cluster center

See also

_kcenters
implementation

References

[R6]Beauchamp, MSMBuilder2

Methods

__init__(metric[, trajectories, ...]) Run kcenters clustering algorithm.
get_assignments Assign the trajectories you passed into the constructor based on
get_distances Extract the distance from each frame to its assigned cluster kcenter
get_generator_indices Get the generator indices corresponding to frames in self.ptraj.
get_generators_as_traj Get a trajectory containing the generators
Versions