NeuroKit icon indicating copy to clipboard operation
NeuroKit copied to clipboard

Standardize and tidy up finding the elbow/knee/plateau point

Open DominiqueMakowski opened this issue 2 years ago • 2 comments

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.

DominiqueMakowski avatar Oct 09 '21 00:10 DominiqueMakowski

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)

  1. extract indices in increasing segments where their gradients are becoming less positive (i.e. decelerating)
  2. troughs like in the figure below may be detected from (1) so filter out these inverse peaks
  3. from the filtered indices of (1) + (2), find the top 10% of indices with the greatest deceleration of gradients
  4. if after step 3, there's more than 1 optimal index, extract the one which has the higher magnitude

Figure_3

Perhaps there may be a more straightforward way to do this 🤔

zen-juen avatar Oct 13 '21 09:10 zen-juen

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.

stale[bot] avatar Apr 11 '22 23:04 stale[bot]

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.

stale[bot] avatar Sep 08 '22 17:09 stale[bot]

This exists now as find_knee()

DominiqueMakowski avatar Sep 21 '22 00:09 DominiqueMakowski