kneed

Knee point detection in Python :chart_with_upwards_trend:

https://github.com/arvkevi/kneed

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.1%) to scientific vocabulary

Keywords

data-analysis data-science elbow-method knee-point python scientific-computing systems
Last synced: 6 months ago · JSON representation ·

Repository

Knee point detection in Python :chart_with_upwards_trend:

Basic Info
  • Host: GitHub
  • Owner: arvkevi
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage: https://kneed.readthedocs.io
  • Size: 12.2 MB
Statistics
  • Stars: 789
  • Watchers: 10
  • Forks: 74
  • Open Issues: 8
  • Releases: 27
Topics
data-analysis data-science elbow-method knee-point python scientific-computing systems
Created about 8 years ago · Last pushed 12 months ago
Metadata Files
Readme Contributing License Citation

README.md

kneed

Knee-point detection in Python

Downloads Downloads Dependents Open in Streamlit codecovDOI

This repository is an attempt to implement the kneedle algorithm, published here. Given a set of x and y values, kneed will return the knee point of the function. The knee point is the point of maximum curvature.

Table of contents

Installation

kneed has been tested with Python 3.7, 3.8, 3.9, and 3.10.

anaconda bash $ conda install -c conda-forge kneed

pip bash $ pip install kneed # To install only knee-detection algorithm $ pip install kneed[plot] # To also install plotting functions for quick visualizations

Clone from GitHub bash $ git clone https://github.com/arvkevi/kneed.git && cd kneed $ pip install -e .

Usage

These steps introduce how to use kneed by reproducing Figure 2 from the manuscript.

Input Data

The DataGenerator class is only included as a utility to generate sample datasets.

Note: x and y must be equal length arrays. ```python from kneed import DataGenerator, KneeLocator

x, y = DataGenerator.figure2()

print([round(i, 3) for i in x]) print([round(i, 3) for i in y])

[0.0, 0.111, 0.222, 0.333, 0.444, 0.556, 0.667, 0.778, 0.889, 1.0] [-5.0, 0.263, 1.897, 2.692, 3.163, 3.475, 3.696, 3.861, 3.989, 4.091] ```

Find Knee

The knee (or elbow) point is calculated simply by instantiating the KneeLocator class with x, y and the appropriate curve and direction.
Here, kneedle.knee and/or kneedle.elbow store the point of maximum curvature.

```python kneedle = KneeLocator(x, y, S=1.0, curve="concave", direction="increasing")

print(round(kneedle.knee, 3)) 0.222

print(round(kneedle.elbow, 3)) 0.222 ```

The knee point returned is a value along the x axis. The y value at the knee can be identified:

python print(round(kneedle.knee_y, 3)) 1.897

Visualize

The KneeLocator class also has two plotting functions for quick visualizations. Note that all (x, y) are transformed for the normalized plots ```python

Normalized data, normalized knee, and normalized distance curve.

kneedle.plotkneenormalized() ```

```python

Raw data and knee.

kneedle.plot_knee() ```

Documentation

Documentation of the parameters and a full API reference can be found here.

Interactive

An interactive streamlit app was developed to help users explore the effect of tuning the parameters. There are two sites where you can test out kneed by copy-pasting your own data: 1. https://share.streamlit.io/arvkevi/ikneed/main/ikneed.py 2. https://ikneed.herokuapp.com/

You can also run your own version -- head over to the source code for ikneed.

ikneed

Contributing

Contributions are welcome, please refer to CONTRIBUTING to learn more about how to contribute.

Citation

Finding a “Kneedle” in a Haystack: Detecting Knee Points in System Behavior Ville Satopa † , Jeannie Albrecht† , David Irwin‡ , and Barath Raghavan§ †Williams College, Williamstown, MA ‡University of Massachusetts Amherst, Amherst, MA § International Computer Science Institute, Berkeley, CA

Owner

  • Name: Kevin Arvai
  • Login: arvkevi
  • Kind: user
  • Location: Washington, D.C.

Data science & clinical genomics

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Arvai"
  given-names: "Kevin"
  orcid: "https://orcid.org/0000-0001-8751-8918"
title: "kneed"
version: 0.7.0
doi: 10.5281/zenodo.6496267
date-released: 2020-08-12
url: "https://github.com/arvkevi/kneed"

GitHub Events

Total
  • Issues event: 1
  • Watch event: 49
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 2
  • Pull request event: 2
  • Fork event: 4
Last Year
  • Issues event: 1
  • Watch event: 49
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 2
  • Pull request event: 2
  • Fork event: 4

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 240
  • Total Committers: 14
  • Avg Commits per committer: 17.143
  • Development Distribution Score (DDS): 0.1
Past Year
  • Commits: 35
  • Committers: 5
  • Avg Commits per committer: 7.0
  • Development Distribution Score (DDS): 0.114
Top Committers
Name Email Commits
arvkevi a****i@g****m 216
samhanic 5****c 5
zhongminhu z****u@t****m 3
Brian Lie b****1@g****m 3
peterdha p****l@g****m 3
Jonas Scheffner d****r@o****e 2
Dylan Nielson a****e@g****m 1
arvkevi k****i@d****m 1
George Perakis g****s@s****r 1
Tom Milligan t****m@r****o 1
big-o b****o 1
m-birke w****i@w****e 1
Kevin Schaefer k****3@g****m 1
Janson-L 5****L 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 45
  • Total pull requests: 70
  • Average time to close issues: 4 months
  • Average time to close pull requests: 24 days
  • Total issue authors: 34
  • Total pull request authors: 12
  • Average comments per issue: 1.82
  • Average comments per pull request: 1.01
  • Merged pull requests: 68
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 6 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • arvkevi (12)
  • tomas-teijeiro (1)
  • Physics96 (1)
  • Irfanwustl (1)
  • franciscogmm (1)
  • Gabriel-p (1)
  • itissid (1)
  • MitchellAcoustics (1)
  • raviolli (1)
  • tommilligan (1)
  • Peterdha (1)
  • DoNoRe (1)
  • tonitonae (1)
  • sinaotl (1)
  • leonfodoulian (1)
Pull Request Authors
  • arvkevi (59)
  • JimPrudent (2)
  • dcangulo (1)
  • Peterdha (1)
  • Blackrobe (1)
  • samhanic (1)
  • stereoF (1)
  • gperakis (1)
  • vhu43 (1)
  • Janson-L (1)
  • Shotgunosine (1)
  • m-birke (1)
  • tommilligan (1)
Top Labels
Issue Labels
bug (4) help wanted (2) enhancement (2)
Pull Request Labels
enhancement (4) bug (1) help wanted (1)

Dependencies

.github/workflows/pythonpublish.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v1 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
docs/requirements.txt pypi
  • sphinx ==6.2.1
  • sphinx_rtd_theme ==1.2.2
  • sphinxcontrib-applehelp ==1.0.4
  • sphinxcontrib-devhelp ==1.0.2
  • sphinxcontrib-htmlhelp ==2.0.1
  • sphinxcontrib-jquery ==4.1
  • sphinxcontrib-jsmath ==1.0.1
  • sphinxcontrib-qthelp ==1.0.3
  • sphinxcontrib-serializinghtml ==1.1.5
pyproject.toml pypi
  • numpy >=1.14.2
  • scipy >=1.0.0