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 stubs 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
>>> y = np.array([1.0, 1.05, 1.15, 1.28, 1.30, 2.5, 3.6, 4.9])
>>> find_knee(y) # provide just the values
4
>>> x = np.arange(8)
>>> find_knee(x, y) # or both x and y
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_successive) - Fix the start and the end point, change the middle one (
menger_anchored)
- 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
Note: all of the methods are my ideas I came up with over quite some time
Note: this project was bootstrapped by python-blueprint
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
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.4.tar.gz.
File metadata
- Download URL: knarrow-0.0.4.tar.gz
- Upload date:
- Size: 10.8 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 |
2bb0c8cb80c1ddf0e04310b0ebda9793d918c68d6870b39539d492b26d4a1611
|
|
| MD5 |
56655c5296dc575606690456044751b1
|
|
| BLAKE2b-256 |
ffad2f32b308e31e87f74d97a27bc8e65069433daccd5ca6d71b729e32a3b0b6
|
File details
Details for the file knarrow-0.0.4-py3-none-any.whl.
File metadata
- Download URL: knarrow-0.0.4-py3-none-any.whl
- Upload date:
- Size: 8.6 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 |
00cd0b1dd2ed69109a656845220eee840039e12d32ea94b52c09c757600ac012
|
|
| MD5 |
98b376b643ef78faf1e40a4e94494647
|
|
| BLAKE2b-256 |
4b11498a55ad66edb06ca73e9a1a2692c1ba94ff4e5654fd423954085201681b
|