baybe.utils.numerical.closest_element

baybe.utils.numerical.closest_element(array: ndarray, target: float)[source]

Find the element of an array that is closest to a target value.

Parameters:
  • array (ndarray) – The array in which the closest value should be found.

  • target (float) – The target value.

Return type:

float

Returns:

The closes element.