baybe.utils.numerical.closest_element

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

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

Parameters:
Return type:

float

Returns:

The closest element.