{"id":13450675,"url":"https://github.com/arvkevi/kneed","last_synced_at":"2025-10-21T20:05:35.023Z","repository":{"id":27412227,"uuid":"113799037","full_name":"arvkevi/kneed","owner":"arvkevi","description":"Knee point detection in Python :chart_with_upwards_trend:","archived":false,"fork":false,"pushed_at":"2024-06-04T10:59:44.000Z","size":12819,"stargazers_count":722,"open_issues_count":9,"forks_count":74,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-08-26T10:43:47.308Z","etag":null,"topics":["data-analysis","data-science","elbow-method","knee-point","python","scientific-computing","systems"],"latest_commit_sha":null,"homepage":"https://kneed.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arvkevi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-11T01:39:14.000Z","updated_at":"2024-08-25T09:22:16.000Z","dependencies_parsed_at":"2024-10-28T16:42:27.172Z","dependency_job_id":"103dbf4c-12fa-403b-b974-57ecef8e963e","html_url":"https://github.com/arvkevi/kneed","commit_stats":{"total_commits":240,"total_committers":14,"mean_commits":"17.142857142857142","dds":0.09999999999999998,"last_synced_commit":"ea2f90f815d0945f382cc513a44dfb66379bb1e5"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fkneed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fkneed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fkneed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arvkevi%2Fkneed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arvkevi","download_url":"https://codeload.github.com/arvkevi/kneed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245130962,"owners_count":20565751,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","data-science","elbow-method","knee-point","python","scientific-computing","systems"],"created_at":"2024-07-31T07:00:37.230Z","updated_at":"2025-10-21T20:05:29.984Z","avatar_url":"https://github.com/arvkevi.png","language":"Python","readme":"# kneed\n Knee-point detection in Python\n\n[![Downloads](https://pepy.tech/badge/kneed)](https://pepy.tech/project/kneed) [![Downloads](https://pepy.tech/badge/kneed/week)](https://pepy.tech/project/kneed) ![Dependents](https://badgen.net/github/dependents-repo/arvkevi/kneed/?icon=github) [![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://share.streamlit.io/arvkevi/ikneed/main/ikneed.py) [![codecov](https://codecov.io/gh/arvkevi/kneed/branch/main/graph/badge.svg)](https://codecov.io/gh/arvkevi/kneed)[![DOI](https://zenodo.org/badge/113799037.svg)](https://zenodo.org/badge/latestdoi/113799037)\n\n\nThis repository is an attempt to implement the kneedle algorithm, published [here](https://www1.icsi.berkeley.edu/~barath/papers/kneedle-simplex11.pdf). 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.\n\n![](https://raw.githubusercontent.com/arvkevi/kneed/main/images/functions_args_summary.png)\n\n## Table of contents\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Input Data](#input-data)\n  - [Find Knee](#find-knee)\n  - [Visualize](#visualize)\n- [Documentation](#documentation)\n- [Interactive](#interactive)\n- [Contributing](#contributing)\n- [Citation](#citation)\n\n## Installation  \n`kneed` has been tested with Python 3.7, 3.8, 3.9, and 3.10.\n\n**anaconda**\n```bash\n$ conda install -c conda-forge kneed\n```\n\n**pip**\n```bash\n$ pip install kneed # To install only knee-detection algorithm\n$ pip install kneed[plot] # To also install plotting functions for quick visualizations\n```\n\n**Clone from GitHub**\n```bash\n$ git clone https://github.com/arvkevi/kneed.git \u0026\u0026 cd kneed\n$ pip install -e .\n```\n\n## Usage\nThese steps introduce how to use `kneed` by reproducing Figure 2 from the manuscript.\n\n### Input Data\nThe `DataGenerator` class is only included as a utility to generate sample datasets. \n\u003e  Note: `x` and `y` must be equal length arrays.\n```python\nfrom kneed import DataGenerator, KneeLocator\n\nx, y = DataGenerator.figure2()\n\nprint([round(i, 3) for i in x])\nprint([round(i, 3) for i in y])\n\n[0.0, 0.111, 0.222, 0.333, 0.444, 0.556, 0.667, 0.778, 0.889, 1.0]\n[-5.0, 0.263, 1.897, 2.692, 3.163, 3.475, 3.696, 3.861, 3.989, 4.091]\n```\n\n### Find Knee  \nThe knee (or elbow) point is calculated simply by instantiating the `KneeLocator` class with `x`, `y` and the appropriate `curve` and `direction`.  \nHere, `kneedle.knee` and/or `kneedle.elbow` store the point of maximum curvature.\n\n```python\nkneedle = KneeLocator(x, y, S=1.0, curve=\"concave\", direction=\"increasing\")\n\nprint(round(kneedle.knee, 3))\n0.222\n\nprint(round(kneedle.elbow, 3))\n0.222\n```\n\nThe knee point returned is a value along the `x` axis. The `y` value at the knee can be identified:\n\n```python\nprint(round(kneedle.knee_y, 3))\n1.897\n```\n\n### Visualize\nThe `KneeLocator` class also has two plotting functions for quick visualizations.\n**Note that all (x, y) are transformed for the normalized plots**\n```python\n# Normalized data, normalized knee, and normalized distance curve.\nkneedle.plot_knee_normalized()\n```\n\n![](https://raw.githubusercontent.com/arvkevi/kneed/main/images/figure2.knee.png)\n\n```python\n# Raw data and knee.\nkneedle.plot_knee()\n```\n\n![](https://raw.githubusercontent.com/arvkevi/kneed/main/images/figure2.knee.raw.png)\n\n## Documentation\nDocumentation of the parameters and a full API reference can be found [here](https://kneed.readthedocs.io/).\n\n## Interactive\nAn interactive streamlit app was developed to help users explore the effect of tuning the parameters.\nThere are two sites where you can test out kneed by copy-pasting your own data:\n1. https://share.streamlit.io/arvkevi/ikneed/main/ikneed.py\n2. https://ikneed.herokuapp.com/\n\nYou can also run your own version -- head over to the [source code for ikneed](https://github.com/arvkevi/ikneed).\n\n![ikneed](images/ikneed.gif)\n\n## Contributing\n\nContributions are welcome, please refer to [CONTRIBUTING](https://github.com/arvkevi/kneed/blob/main/CONTRIBUTING.md) \nto learn more about how to contribute.                            \n\n## Citation\n\nFinding a “Kneedle” in a Haystack:\nDetecting Knee Points in System Behavior\nVille Satopa\n†\n, Jeannie Albrecht†\n, David Irwin‡\n, and Barath Raghavan§\n†Williams College, Williamstown, MA\n‡University of Massachusetts Amherst, Amherst, MA\n§\nInternational Computer Science Institute, Berkeley, CA\n","funding_links":[],"categories":["Topics"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvkevi%2Fkneed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farvkevi%2Fkneed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farvkevi%2Fkneed/lists"}