msmbuilder.clustering._hybrid_kmedoids¶
- msmbuilder.clustering._hybrid_kmedoids(metric, ptraj, k=None, distance_cutoff=None, num_iters=10, local_swap=True, norm_exponent=2.0, too_close_cutoff=0.0001, ignore_max_objective=False, initial_medoids='kcenters', initial_assignments=None, initial_distance=None)[source]¶
Run the hybrid kmedoids clustering algorithm to cluster a trajectory
Parameters: metric : msmbuilder.metrics.AbstractDistanceMetric
A metric capable of handling ptraj
ptraj : prepared trajectory
ptraj return by the action of the preceding metric on a msmbuilder trajectory
k : int
number of desired clusters
num_iters : int
number of swaps to attempt per medoid
local_swap : boolean, optional
If true, proposed swaps will be between a medoid and a data point currently assigned to that medoid. If false, the data point for the proposed swap is selected randomly.
norm_exponent : float, optional
exponent to use in pnorm of the distance to generate objective function
too_close_cutoff : float, optional
Summarily reject proposed swaps if the distance of the medoid to the trial medoid is less than thus value
ignore_max_objective : boolean, optional
Ignore changes to the distance of the worst classified point, and only reject or accept swaps based on changes to the p norm of all the data points.
initial_medoids : {‘kcenters’, ndarray}
If ‘kcenters’, run kcenters clustering first to get the initial medoids, and then run the swaps to improve it. If ‘random’, select the medoids at random. Otherwise, initial_medoids should be a numpy array of the indices of the medoids.
initial_assignments : {None, ndarray}, optional
If None, initial_assignments will be computed based on the initial_medoids. If you pass in your own initial_medoids, you can also pass in initial_assignments to avoid recomputing them.
initial_distances : {None, ndarray}, optional
If None, initial_distances will be computed based on the initial_medoids. If you pass in your own initial_medoids, you can also pass in initial_distances to avoid recomputing them.
References
[R8] Beauchamp, K. MSMBuilder2