# kneed
Knee-point detection in Python
[![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) [![Build Status](https://travis-ci.com/arvkevi/kneed.svg?branch=master)](https://travis-ci.com/arvkevi/kneed) [![codecov](https://codecov.io/gh/arvkevi/kneed/branch/master/graph/badge.svg)](https://codecov.io/gh/arvkevi/kneed)
This 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.
![](https://raw.githubusercontent.com/arvkevi/kneed/master/images/functions_args_summary.png)
## Table of contents
- [Installation](#installation)
- [Usage](#usage)
- [Input Data](#input-data)
- [Find Knee](#find-knee)
- [Visualize](#visualize)
- [Documentation](#documentation)
- [Interactive](#interactive)
- [Contributing](#contributing)
- [Citation](#citation)
## Installation
`kneed` has been tested with Python 3.5, 3.6, 3.7 and 3.8.
**anaconda**
```bash
$ conda install -c conda-forge kneed
```
**pip**
```bash
$ pip install kneed
```
**Clone from GitHub**
```bash
$ git clone https://github.com/arvkevi/kneed.git
$ python setup.py install
```
## 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.plot_knee_normalized()
```
![](https://raw.githubusercontent.com/arvkevi/kneed/master/images/figure2.knee.png)
```python
# Raw data and knee.
kneedle.plot_knee()
```
![](https://raw.githubusercontent.com/arvkevi/kneed/master/images/figure2.knee.raw.png)
## Documentation
Documentation of the parameters and a full API reference can be found [here](https://kneed.readthedocs.io/).
## 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](https://github.com/arvkevi/ikneed).
![ikneed](images/ikneed.gif)
## Contributing
Contributions are welcome, please refer to [CONTRIBUTING](https://github.com/arvkevi/kneed/blob/master/CONTRIBUTING.md)
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
没有合适的资源?快使用搜索试试~ 我知道了~
kneed:Python中的拐点检测
共42个文件
png:11个
py:7个
rst:4个
需积分: 33 39 下载量 58 浏览量
2021-05-26
16:39:02
上传
评论 6
收藏 11.7MB ZIP 举报
温馨提示
跪着 Python中的拐点检测 该存储库是尝试实现下跪算法的尝试,发布。 给定一组x和y值, kneed将返回函数的拐点。 拐点是最大曲率的点。 目录 交互的 贡献 引文 安装 kneed已通过Python kneed和3.8进行了测试。 水蟒 $ conda install -c conda-forge kneed 点子 $ pip install kneed 从GitHub克隆 $ git clone https://github.com/arvkevi/kneed.git $ python setup.py install 用法 这些步骤通过从手稿中复制图2来介绍如何使用kneed 。 输入数据 DataGenerator类仅作为生成样本数据集的实用程序而包括在内。 注意: x和y必须为等长数组。 from kneed import DataGenerator ,
资源详情
资源评论
资源推荐
收起资源包目录
kneed-master.zip (42个子文件)
kneed-master
MANIFEST.in 88B
codecov.yml 315B
.gitattributes 61B
.github
workflows
pythonpublish.yml 619B
notebooks
kneedle_algorithm.ipynb 71KB
decreasing_function_walkthrough.ipynb 40KB
walkthrough.ipynb 162KB
images
functions_args_summary.png 41KB
figure2.knee.raw.png 13KB
concave.png 12KB
ikneed.gif 11.36MB
bumpy_line.smoothed.png 22KB
online_vs_offline.png 22KB
decreasing.png 13KB
S_parameter.png 27KB
bumpy_line.smoothed.degree2.png 24KB
figure2.knee.png 25KB
convex.png 12KB
bumpy_line.png 22KB
kneed
data_generator.py 4KB
__init__.py 114B
knee_locator.py 16KB
version.py 22B
requirements.txt 31B
CONTRIBUTING.md 4KB
.travis.yml 298B
pytest.ini 89B
LICENSE 1KB
postBuild 58B
setup.cfg 64B
setup.py 2KB
README.md 4KB
docs
make.bat 795B
parameters.rst 7KB
conf.py 2KB
interactive.rst 506B
index.rst 884B
Makefile 634B
api.rst 651B
tests
requirements.txt 29B
test_sample.py 14KB
.gitignore 410B
共 42 条
- 1
Dr熊吉
- 粉丝: 30
- 资源: 4603
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0