Skip to main content

Kneeliverse: A Universal Knee/ElbowDetection Library for Performance Curves

Project description

Kneeliverse: A Universal Knee/ElbowDetection Library for Performance Curves

Estimating the knee/elbow point in performance curves is a challenging task. However, most of the time these points represent ideal compromises between cost and performance.

This library implements several well-known knee detection algorithms:

  1. Discrete Curvature
  2. DFDT
  3. Kneedle
  4. L-method
  5. Menger curvature

Furthermore, the code in this library expands the ideas on these algorithms to detect multi-knee/elbow points in complex curves. We implemented a recursive method that allows each of the previously mentioned methods to detect multi-knee and elbow points. Some methods natively support multi-knee detection, such as:

  1. Kneedle
  2. Fusion
  3. Z-method

Finally, we also implemented additional methods that help with knee detection tasks. As a preprocessing step, we develop a custom RDP algorithm that reduced a discrete set of points while keeping the reconstruction error to a minimum. As a post-processing step we implemented several algorithms:

  1. 1D dimensional clustering, is used to merge close knee points
  2. Several filters out non-relevant knees
  3. Knee ranking algorithms that used several criteria to assess the quality of a knee point

Running unit tests

Several unit tests were written to validate some corner cases. The unit tests were written in unittest. Run the following commands to execute the unit tests.

python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install .
python -m unittest

Documentation

This library was documented using the google style docstring, it can be accessed here. Run the following commands to produce the documentation for this library.

python3 -m venv venv
source venv/bin/activate
pip install pdoc
pdoc --math -d google -o docs src/kneeliverse \
--logo https://raw.githubusercontent.com/mariolpantunes/knee/main/media/knee.png \
--favicon https://raw.githubusercontent.com/mariolpantunes/knee/main/media/knee.png

Instalation

To install the library locally, simple execute the following commands:

python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install .

You can also use the PyPI repository for easy access to the library:

kneeliverse>=1.0

Runing the demos

The demos can be execute as python modules using the following code:

python -m demos.curvature -i [trace]
python -m demos.dfdt -i [trace]
python -m demos.fusion -i [trace]
python -m demos.kneedle_classic -i [trace]
python -m demos.kneedle_rec -i [trace]
python -m demos.kneedle -i [trace]
python -m demos.lmethod -i [trace]
python -m demos.menger -i [trace]
python -m demos.zmethod -i [trace]

Most demos have the same parameters (with the exception of zmethod and kneedle_classic):

python -m demos.curvature -husage: curvature.py [-h] -i I [-a] [-r R] [-t T] [-c C] [-o] [-g] [-k {left,linear,right,hull}]

Multi Knee evaluation app

optional arguments:
  -h, --help            show this help message and exit
  -i I                  input file
  -a                    add even spaced points
  -r R                  RDP reconstruction threshold
  -t T                  clustering threshold
  -c C                  corner threshold
  -o                    store output (debug)
  -g                    display output (debug)
  -k {left,linear,right,hull}
                        Knee ranking method

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright

This project is under the following COPYRIGHT.

Python CI

MIT License

Copyright (c) 2020 Mário Antunes

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copyright (c) 2021-2023 Stony Brook University Copyright (c) 2021-2023 The Research Foundation of SUNY

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kneeliverse-1.0.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kneeliverse-1.0-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file kneeliverse-1.0.tar.gz.

File metadata

  • Download URL: kneeliverse-1.0.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for kneeliverse-1.0.tar.gz
Algorithm Hash digest
SHA256 4f61b40723b07d8476e6aaf92c28c01d19fe8510dbae848417356ef081ad2f47
MD5 f533117de207e10882de08a4024e2d95
BLAKE2b-256 9c39d8a117ca4c3bf96e91b8128ce27c02ba7387677792e9430baa7faa7c1cfa

See more details on using hashes here.

File details

Details for the file kneeliverse-1.0-py3-none-any.whl.

File metadata

  • Download URL: kneeliverse-1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for kneeliverse-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0d7b48418d2614d57f5c203eab02a412cafb5ceee76ea552321987a4561801d
MD5 315c300c46dd4d35e4cfa62e0a7f5f7c
BLAKE2b-256 95556efa749fb23fa091a640d3d94ff217948cbdcc2e4e4f64b6449d127fa83e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page