baybe.utils.numerical.closest_element

baybe.utils.numerical.closest_element(array: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], target: float)[source]

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

Parameters:
Return type:

float

Returns:

The closest element.