Shoot a knarrow to the knee
Project description
knarrow
Shoot a knarrow to the knee ;)
(The lib is better than this pun, I swear.)
Detect knee points in various scenarios using a plethora of methods
Usage
Just plugin your values in a list, tuple or an np.ndarray and watch knarrow hit the knee:
>>> from knarrow import find_knee
>>> find_knee([1, 2, 3, 4, 6]) # use a list
3
>>> find_knee((1, 2, 3, 4, 6)) # or a tuple
3
>>> import numpy as np
>>> x = np.arange(8)
>>> y = np.array([1.0, 1.05, 1.15, 1.28, 1.30, 2.5, 3.6, 4.9])
>>> find_knee(x, y) # or even provide x and y directly
4
>>> A = np.vstack((x, y))
>>> A
array([[0. , 1. , 2. , 3. , 4. , 5. , 6. , 7. ],
[1. , 1.05, 1.15, 1.28, 1.3 , 2.5 , 3.6 , 4.9 ]])
>>> find_knee(A) # works with x in first row, y in the second
4
>>> A.T
array([[0. , 1. ],
[1. , 1.05],
[2. , 1.15],
[3. , 1.28],
[4. , 1.3 ],
[5. , 2.5 ],
[6. , 3.6 ],
[7. , 4.9 ]])
>>> find_knee(A.T) # also works with x in the first column, y in the second column
4
Methods:
Currently supported methods:
- Curvature methods:
- Circle through 3 succesive points (
menger) - Fix the start and the end point, change the middle one
- Circle through 3 succesive points (
- Maximum change in the angle of connecting lines
- Two lines method:
- Split the dataset in two parts, fit OLS to them and sum up the resulting R2
- Split the dataset in two parts, fit line from start to end and measure R2
- Orthogonal distance to y=x
- Vertical distance to y=x
- Derivative methods
- First derivative
- Second derivative
- Kneedle
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
knarrow-0.0.2.tar.gz
(9.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file knarrow-0.0.2.tar.gz.
File metadata
- Download URL: knarrow-0.0.2.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
288af86a856a6d791c272e6651961483f74b03d8d2e6177b64844ac0c354e67e
|
|
| MD5 |
2fedb2d274f00f9e7538e35bd56c7b33
|
|
| BLAKE2b-256 |
bd829ea3c91e07c1e959ea1829aef66472b9f85049e0058a75b9c35014d65661
|
File details
Details for the file knarrow-0.0.2-py3-none-any.whl.
File metadata
- Download URL: knarrow-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa2739b88cbf3505dd3a783b5059fb70d444176d8cff7c8e44a392b0861cc3a1
|
|
| MD5 |
90557286db607c80b9c288aafea5242a
|
|
| BLAKE2b-256 |
d74b214ec16e92e73cb536af13974ab75777923d4ef3e2b2853efaaa67af5262
|