kneed
Knee-point detection in Python
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 kneeduv
uv add kneedpoetry
poetry add kneedInstalling 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
Tags
More Information Analysis packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyarrowpyarrow provides Python bindings to Apache…
permissive · top 100 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
contourpyContourPy calculates contours of 2D…
permissive · top 1,000 on PyPI
snowflake-snowpark-pythonSnowpark Python provides APIs to query and…
permissive · top 1,000 on PyPI
pyclothoidsPyclothoids provides a Python interface to…
unclear · top 15,000 on PyPI
rdpImplements the Ramer-Douglas-Peucker algorithm…
permissive · top 15,000 on PyPI
isosurfacesConstructs isolines and isosurfaces of 2D and…
permissive · top 15,000 on PyPI
kmodesImplements k-modes and k-prototypes clustering…
permissive · top 15,000 on PyPI
leidenalgImplements the Leiden community detection…
copyleft · top 15,000 on PyPI
quadprogSolves strictly convex quadratic programming…
copyleft · top 15,000 on PyPI
cu2quConverts cubic Bézier curves to quadratic…
permissive · top 15,000 on PyPI
libcoallibcoal provides Python bindings for collision…
permissive · top 15,000 on PyPI
alphashapeGenerates n-dimensional alpha shapes—concave or…
permissive · top 5,000 on PyPI