skillfed

kneed

Knee-point detection in Python

kneed v0.8.6 697.1K downloads/30d#5,300 on PyPI817
License unclear Active released

What it is and what it does

Kneed is a Python library that implements the Kneedle algorithm for detecting knee or elbow points in curves—the points where the curve's curvature is greatest. It takes arrays of x and y values and returns the x-coordinate of maximum curvature, along with the corresponding y value. The library handles both concave and convex curves, supports increasing and decreasing functions, and can automatically detect curve shape if you're unsure. It depends on numpy and scipy for numerical computation.

The package is designed for exploratory data analysis and optimization problems where you need to find the "elbow" in a curve—a common task in clustering (determining optimal cluster count), performance tuning, and system behavior analysis. It includes utilities for generating test data, tuning sensitivity, and visualizing results with matplotlib (optional). The API is straightforward: instantiate KneeLocator with your data and curve parameters, then access the knee attribute.

Use it for:

  • Determine optimal cluster count in k-means clustering by finding the elbow in the inertia curve.
  • Identify the point of diminishing returns in performance tuning or resource allocation curves.
  • Analyze system behavior curves to detect where performance degrades or stabilizes.
  • Find inflection points in cost-benefit or accuracy-complexity trade-off curves.
  • Detect transition points in experimental or observational data where behavior changes.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Detects knee (elbow) points in curves using the Kneedle algorithm, returning the point of maximum curvature for a given set of x and y values.

Yes. The package is actively maintained, has no known vulnerabilities, installs with minimal friction (only numpy and scipy), and solves a specific well-defined problem with a published algorithm. The main caveat is the unclear license status—verify the actual license before use in proprietary contexts. For research, data analysis, and optimization tasks, it's a solid choice.

Install

kneed on PyPI

pip

pip install kneed

uv

uv add kneed

poetry

poetry add kneed

Installing kneed

Before you install

Low friction install with only numpy and scipy as runtime dependencies. The package is actively maintained with a recent release (2026-03-20), supports Python 3.8 through 3.12, and has no known vulnerabilities.

License in practice

License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in proprietary or restricted contexts.

Quickstart

pip install kneed

from kneed import KneeLocator, DataGenerator

x, y = DataGenerator.figure2()
kl = KneeLocator(x, y, curve="concave", direction="increasing")
print(kl.knee)

Requires Python 3.8 or later. Optional: matplotlib for plotting functionality (install via `pip install kneed[plot]`).

Verify before relying

  • Whether the unclear license status reflects a missing declaration or an intentional choice to remain unspecified.
  • Performance characteristics and scalability limits for very large datasets or high-dimensional curves.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 2 — numpy, scipy
Maintenance actively maintained — 147 days since the last release
Last repo commit
First released
Downloads 697,094/month — #5,300 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: kneed-0.8.6-py3-none-any.whl

Keywords: elbow-method, knee-detection, system

Development Status :: 5 - Production/StableIntended Audience :: Science/ResearchProgramming Language :: Python :: 3Topic :: Scientific/Engineering :: Information Analysis

Tags

knee point detectionelbow method algorithmcurve inflection pointkneedle algorithmmaximum curvature detectionelbow detection pythonknee-elbow analysis
curve-analysisoptimizationdata-exploration

More Information Analysis packages