NeuroKit
NeuroKit copied to clipboard
Standardize and tidy up finding the elbow/knee/plateau point
Finding the elbow of a curve is a very common problem and we use it in multiple instances. Currently we always have bespoke implementations but we could gather them into a unique find_plateau/elbow()
function that would help in terms of re-usability, maintainability and testing.
I thought of a few ways to implement this, trial-and-errored them, and I think the best I can think of for now is like so (see new find_plateau()
function in the case of an increasing plateau)
- extract indices in increasing segments where their gradients are becoming less positive (i.e. decelerating)
- troughs like in the figure below may be detected from (1) so filter out these inverse peaks
- from the filtered indices of (1) + (2), find the top 10% of indices with the greatest deceleration of gradients
- if after step 3, there's more than 1 optimal index, extract the one which has the higher magnitude
Perhaps there may be a more straightforward way to do this 🤔
This issue has been automatically marked as inactive because it has not had recent activity. It will eventually be closed if no further activity occurs.
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
This exists now as find_knee()