get_elbow

get_elbow(data: ndarray) int[source][source]

Draws a line between the first and last points in a dataset and finds the point furthest from that line.

Parameters:

data (array) – The data to find the elbow in.

Returns:

The index of the elbow point.

Return type:

int

Examples

>>> data = np.array([0, 1, 2, 3, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10])
>>> get_elbow(data)
4
>>> data = np.array([1, 2, 3, 4, 5, 4.5, 4, 3.5, 3, 2, 1])
>>> get_elbow(data)
4