selector.methods.utils

selector.methods.utils#

Module for Selection Utilities.

selector.methods.utils.optimize_radius(obj, X, size, cluster_ids=None)#

Algorithm that uses sphere exclusion for selecting points from cluster.

Iteratively searches for the optimal radius to obtain the correct number of selected samples. If the radius cannot converge to return size points, the function returns the closest number of samples to size as possible.

Parameters#

obj: object

Instance of DirectedSphereExclusion or OptiSim selection class.

X: ndarray of shape (n_samples, n_features)

Feature matrix of n_samples samples in n_features dimensional space.

size: int

Number of sample points to select (i.e. size of the subset).

cluster_ids: np.ndarray

Indices of points that form a cluster.

Returns#

selected: list

List of indices of selected samples.