kneebow
Find the knee of a curve or the elbow of a curve.
How it works
kneebow builds upon a very simple idea: if we want to find the elbow of a curve, we can simply rotate the data so that curve looks down and then take the minimum value. If we want to find the knee of the curve, we take the maximum value instead. It's as simple as that.
For more info, see this answer on the Data Science StackExchange.
Installation
You can install the package via pip:
pip install kneebow
Alternatively, you can also install the latest version from GitHub:
pip install git+https://github.com/georg-un/kneebow.git
Usage
Let's assume, we try to find the elbow of the following data:
import numpy as np
data = np.array([[1, 1], [2, 2], [3, 3], [4, 4], [5, 5], [6, 6], [7, 7], [8, 8], # linear until (8,8)
[9, 16], [10, 32], [11, 64], [12, 128], [13, 256], [14, 512]]) # exponential afterwards
Let's have a peak how this data looks like:
To find the elbow, we create an instance of the Rotor class and use its fit_rotate method:
from kneebow.rotor import Rotor
rotor = Rotor()
rotor.fit_rotate(data)
Now we can get the index of the elbow as follows:
elbow_idx = rotor.get_elbow_index()
print(elbow_idx) # 11
The Rotor class also comes with plot methods to inspect the data visually together with the estimated elbow/knee:
rotor.plot_elbow()
Citation
If you need to cite this package, you can do so as follows:
BibTeX
@misc{kneebow,
title={ {kneebow}: Knee or elbow detection for curves},
author={Georg Unterholzner},
year={2019},
howpublished={\url{https://github.com/georg-unterholzner/kneebow}},
}
Note: Make sure to import the url package with: \usepackage{url}.
APA/Harvard
Georg Unterholzner. (2019). kneebow: Knee or elbow detection for curves. https://github.com/georg-unterholzner/kneebow.
License
Distributed under the MIT License. See LICENSE for more information.
Metadata
Release files for kneebow 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kneebow-1.0.4.tar.gz | 4.7 kB | Without provenance | Details for kneebow-1.0.4.tar.gz |
Release files / kneebow-1.0.4.tar.gz
| Download URL | kneebow-1.0.4.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
146fe65caf5c666a6b73749240b934fedeee1b38859656ae829c12ad65d18fce
|
|
BLAKE2b-256 checksum How to use checksums |
d9cf3ee22b001e0bd89dc995498120ce17acfc657ee05773f753936fe06800ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for kneebow 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.