kneed icon indicating copy to clipboard operation
kneed copied to clipboard

Potentially wrong plot and/or knee identification

Open jagandecapri opened this issue 10 months ago • 4 comments

Hi @arvkevi,

Thank you for this cool library! 💯

I am experimenting with the following code:

from kneed import KneeLocator
import matplotlib.pyplot as plt

x = [0.90000, 0.99000, 0.99900, 0.99990, 0.99999]
y = [0.000019, 0.000046, 0.000050, 0.000050, 0.000050]

knee = KneeLocator(x, y, S=0.0, direction="increasing", curve="convex", online=True, interp_method="interp1d")
print(f"knee points: ({knee.knee}, {knee.knee_y})")
knee.plot_knee()
plt.show()
knee.plot_knee_normalized()
plt.show()

Output:

knee points: (0.99999, 5e-05) knee_point knee_normalized

I am not sure why the normalized knee plot is identifying the knee/elbow at 0 and I'm wondering why the knee point identified is at 0.99999? Shouldn't it be at 0.99?

Looking forward to your kind reply.

jagandecapri avatar Apr 20 '24 15:04 jagandecapri

Thanks for reporting this. It looks like making the changes discussed here addresses this issue.

arvkevi avatar Apr 21 '24 11:04 arvkevi

Thank you for the prompt response. Is there any way I could help? I am using kneed for my research project and would love to get this issue fixed "soonish" as my data has such unevenly spaced points.

jagandecapri avatar Apr 21 '24 16:04 jagandecapri

Thanks for offering to help. Unfortunately, I won't be able to release a new version soon. I need to make sure any breaking changes are identified and handled, and that it's "correct." My recommendation for your research project is to clone the repo (or just copy KneeLocator class) and attempt to introduce the changes mentioned above locally.

arvkevi avatar Apr 21 '24 19:04 arvkevi

Noted. I'll do as you have suggested. Have a pleasant week.

jagandecapri avatar Apr 21 '24 20:04 jagandecapri