selector.methods.base
#
Base class for diversity based subset selection.
- class selector.methods.base.SelectionBase#
Base class for selecting subset of sample points.
- _abc_impl = <_abc._abc_data object>#
- select(x: ndarray, size: int, labels: ndarray = None, proportional_selection: bool = True) Union[List, Iterable] #
Return indices representing subset of sample points.
Parameters#
- x: ndarray of shape (n_samples, n_features) or (n_samples, n_samples)
Feature matrix of n_samples samples in n_features dimensional feature space. If fun_distance is None, this x is treated as a square pairwise distance matrix.
- size: int
Number of sample points to select (i.e. size of the subset).
- labels: np.ndarray, optional
Array of integers or strings representing the labels of the clusters that each sample belongs to. If None, the samples are treated as one cluster. If labels are provided, selection is made from each cluster.
- proportional_selection: bool, optional
If True, the number of samples to be selected from each cluster is proportional. Otherwise, the number of samples to be selected from each cluster is equal. Default is True.
Returns#
- selected: list
Indices of the selected sample points.
- abstract select_from_cluster(x: ndarray, size: int, labels: ndarray = None) ndarray #
Return indices representing subset of sample points from one cluster.
Parameters#
- x: ndarray of shape (n_samples, n_features) or (n_samples, n_samples)
Feature matrix of n_samples samples in n_features dimensional feature space. If fun_distance is None, this x is treated as a square pairwise distance matrix.
- size: int
Number of sample points to select (i.e. size of the subset).
- labels: np.ndarray, optional
Array of integers or strings representing the labels of the clusters that each sample belongs to. If None, the samples are treated as one cluster. If labels are provided, selection is made from each cluster.
Returns#
- selected: list
Indices of the selected sample points.