FPS
- class PAsampling.wrappers.FPS(precomputed_distances=False)[source]
Implements the Farthest Point Sampling (FPS) algorithm.
This class provides a wrapper around the fps_np function, allowing for the selection of a subset of samples from a dataset based on the FPS strategy. The selection can be performed using different distance functions and can handle precomputed distance matrices.
Attributes:
- precomputed_distancesbool, optional (default=False)
If True, the fit function expects a precomputed distance matrix as input.
- fit(X, initial_subset, b_samples, distance_func=None, verbose=False)[source]
Fits the model to the data X and returns the indices of the selected samples.
Parameters:
- Xnumpy.ndarray
Input data matrix with shape (n_samples, n_features), representing a set of data points. If “precomputed_distances” is True, X is expected to be the matrix of precomputed pairwise distances with shape (n_samples, n_samples).
- initial_subsetlist
List of indices (rows of the input points matrix) representing the initial set of selected elements.
- b_samplesint
The desired number of points to select.
- distance_funccallable, optional (default=None)
A function to compute pairwise distances. If None, Euclidean distance is used.
- verbosebool, optional (default=False)
If True, progress messages are printed.
Returns:
- sampleslist
List of indices representing the selected points using the FPS algorithm.