FacilityLocation
- class PAsampling.wrappers.FacilityLocation(b_samples, metric='euclidean', initial_subset=None, verbose=False, n_jobs=-1)[source]
Implements the FacilityLocationSelection function from the Apricot library (https://apricot-select.readthedocs.io/en/).
This class provides a wrapper around the FacilityLocationSelection function, allowing for the selection of a subset of samples from a dataset based on the facility location strategy. The selection can be performed using different metrics, including ‘euclidean’, ‘Gaussian’, and ‘precomputed’.
Attributes:
- b_samplesint
The number of samples to select.
- metricstr, optional (default=’euclidean’)
The metric to use for computing distances. Options are ‘euclidean’, ‘Gaussian’, and ‘precomputed’.
- initial_subsetlist, optional (default=None)
A list of initial indices to include in the subset.
- verbosebool, optional (default=False)
Whether to print progress messages.
- n_jobsint, optional (default=-1)
The number of parallel jobs to run. -1 means using all processors.
- fit(X, gamma=0.1)[source]
Fits the function to the data X, with shape (n_samples, n_features), and returns the indices of the selected samples. If the metric is ‘Gaussian’, the gamma parameter is used to compute the RBF kernel matrix. If the metric is ‘precomputed’, the input X is assumed to be a precomputed distance matrix.
Parameters:
- Xnumpy.ndarray
Input data matrix, representing a set of data points. If metric is ‘precomputed’, X is expected to be the matrix of precomputed pairwise distances.
- gammafloat, optional (default=0.1)
The gamma parameter for the RBF kernel matrix. Used if metric is ‘Gaussian’.
Returns:
- Sampleslist
List of indices representing the selected points using the FacilityLocation algorithm.