baybe.utils.sampling_algorithms.farthest_point_sampling¶
- baybe.utils.sampling_algorithms.farthest_point_sampling(points: ndarray, n_samples: int = 1, initialization: Literal['farthest', 'random'] = 'farthest')[source]¶
Sample points according to a farthest point heuristic.
Creates a subset of a collection of points by successively adding points with the largest Euclidean distance to intermediate point selections encountered during the algorithmic process.
- Parameters:
points (
ndarray
) – The points that are available for selection, represented as a 2D array whose first dimension corresponds to the point index.n_samples (
int
) – The total number of points to be selected.initialization (
Literal
['farthest'
,'random'
]) – Determines how the first points are selected. When"farthest"
is chosen, the first two selected points are those with the largest distance. If only a single point is requested, it is selected randomly from these two. When"random"
is chosen, the first point is selected uniformly at random.
- Return type:
- Returns:
A list containing the positional indices of the selected points.
- Raises:
ValueError – If an unknown initialization recommender is used.