cancel
Showing results for
Did you mean:

Highlighted

## Re: How to calculate knee point without using cursor

I don't remember the details exactly, but finding the local maximum is done by calculation the first derivative of the curve and then, withinn this new curve, searche for the maximum. That's standard math for evaluation functions.

Not sure whether this helps. Please feel free to post your data and describe your problem. That way you might get more detailed feedback on how to find the solution.

Message 21 of 26
(1,033 Views)
Highlighted

## Re: How to calculate knee point without using cursor

Right after hitting the "send" button I remembered what was implemented in my first solution. The sensivity part was NOT implemented in the script. I figured that the sensitivity paramter in the original algorithm was used to cover the fact that there might be consecutive local maxima's because of the noise which typically comes with the data.

I had used a filter early in the process to smooth teh data. With that, I could ignore the sensitivity part and just use the first local maxima.

Andreas

Message 22 of 26
(1,032 Views)
Highlighted

## Re: How to calculate knee point without using cursor

Hi Andreas,

Thanks for your reply. I indeed did the knee detection that way. Following your suggestion about the problem I am trying to solve, I'm posting an example.  Basically I have a plot where I am trying to find the 2 most linear portions (before and after the knee) to then extract the respective slopes. The initial idea was to find the knee point, split the curve into 2 segments at the knee point (for which I thought the kneedle algorithm was pretty good) and then run a linear regression on the respective segments to find the portions with the most consistent highest r-square (like a piecewise regression). The respective slopes can then be extracted from the linear equation fitting these points. Do you think there are other more optimal ways of achieving this? I have attached an image of what I am looking to achieve and there is also an excel file of the data example with the first column being the x-axis and the 2nd column being the y-axis if you want to have a look and play :-).

Anoop.

Message 23 of 26
(1,013 Views)
Highlighted

## Re: How to calculate knee point without using cursor

Hello Anoop,

I looked at your description and then at the data you provided. Your algorithm makes sense to me. I definitely don't have a better idea.

I tried to look at teh 2nd derivative of teh curve (after smoothing it) and the result is somewhat ambiguous. So again, looks like you have a good algorithm.

Andreas

Message 24 of 26
(1,004 Views)
Highlighted

## Re: How to calculate knee point without using cursor

Hey I am using this script to calculate knee point WRT time and I was wondering if there is a way to calculate the knee point starting from the end of the time series.  Essentially in reverse a where t - time.size then working backwards to find the knee point.

Tim
Message 25 of 26
(219 Views)
Highlighted

## Re: How to calculate knee point without using cursor

You have a useful and fascinating solution.  I would really like to see the VBScript behind this.  I'm open to any arrangement.

Message 26 of 26
(28 Views)