sherlockpipe.scoring.helper.find_nearest

sherlockpipe.scoring.helper.find_nearest(array, value)

Find the index and value nearest to a given value in an array.

Parameters

arrayndarray

The array to search in.

valuefloat

The target value to find the nearest neighbor for.

Returns

tuple

A tuple of (index, nearest_value) where index is the position in the array and nearest_value is the closest array element to the input value.