{"id":17578992,"url":"https://github.com/incognito124/knarrow","last_synced_at":"2025-04-13T15:52:22.919Z","repository":{"id":38049326,"uuid":"408521894","full_name":"InCogNiTo124/knarrow","owner":"InCogNiTo124","description":"Shoot a knarrow to the knee","archived":false,"fork":false,"pushed_at":"2025-02-27T23:35:00.000Z","size":183,"stargazers_count":18,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T06:44:56.471Z","etag":null,"topics":["elbow","knee","machine-learning","optimization","python","python3"],"latest_commit_sha":null,"homepage":"https://knarrow.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InCogNiTo124.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-20T16:39:14.000Z","updated_at":"2024-11-29T10:18:04.000Z","dependencies_parsed_at":"2024-04-05T03:25:28.918Z","dependency_job_id":"1eded4bc-4b29-42d1-a936-72621be2e1e6","html_url":"https://github.com/InCogNiTo124/knarrow","commit_stats":{"total_commits":117,"total_committers":2,"mean_commits":58.5,"dds":"0.042735042735042694","last_synced_commit":"656d6d183b73b41fac78274b3ddae37eee415874"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InCogNiTo124%2Fknarrow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InCogNiTo124%2Fknarrow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InCogNiTo124%2Fknarrow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InCogNiTo124%2Fknarrow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InCogNiTo124","download_url":"https://codeload.github.com/InCogNiTo124/knarrow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741148,"owners_count":21154249,"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":["elbow","knee","machine-learning","optimization","python","python3"],"created_at":"2024-10-22T00:25:01.248Z","updated_at":"2025-04-13T15:52:22.901Z","avatar_url":"https://github.com/InCogNiTo124.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# knarrow\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/knarrow)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/knarrow)\n![PyPI - License](https://img.shields.io/pypi/l/knarrow)\n![PyPI](https://img.shields.io/pypi/v/knarrow)\n![PyPI - Format](https://img.shields.io/pypi/format/knarrow)\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/InCogNiTo124/knarrow)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/InCogNiTo124/knarrow/.github/workflows/lint-and-test.yml?branch=master)\n![Read the Docs](https://img.shields.io/readthedocs/knarrow)\n![Website](https://img.shields.io/website?url=https%3A%2F%2Fknarrow.readthedocs.org)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nShoot a `knarrow` to the knee ;)\n\n_(The lib is better than this pun, I swear.)_\n\nDetect knee points in various scenarios using a plethora of methods\n\n\n## Usage\nJust plug in your values in a `list`, `tuple` or an `np.ndarray` and watch `knarrow` hit the knee:\n\n```pycon\n\u003e\u003e\u003e from knarrow import find_knee\n\u003e\u003e\u003e find_knee([1, 2, 3, 4, 6])  # use a list\n3\n\u003e\u003e\u003e find_knee((1, 2, 3, 4, 6))  # or a tuple\n3\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e y = np.array([1.0, 1.05, 1.15, 1.28, 1.30, 2.5, 3.6, 4.9])\n\u003e\u003e\u003e find_knee(y)  # provide just the values\n4\n\u003e\u003e\u003e x = np.arange(8)\n\u003e\u003e\u003e find_knee(x, y)  # or both x and y\n4\n\u003e\u003e\u003e A = np.vstack((x, y))\n\u003e\u003e\u003e A\narray([[0.  , 1.  , 2.  , 3.  , 4.  , 5.  , 6.  , 7.  ],\n       [1.  , 1.05, 1.15, 1.28, 1.3 , 2.5 , 3.6 , 4.9 ]])\n\u003e\u003e\u003e find_knee(A)  # works with x in first row, y in the second\n4\n\u003e\u003e\u003e A.T\narray([[0.  , 1.  ],\n       [1.  , 1.05],\n       [2.  , 1.15],\n       [3.  , 1.28],\n       [4.  , 1.3 ],\n       [5.  , 2.5 ],\n       [6.  , 3.6 ],\n       [7.  , 4.9 ]])\n\u003e\u003e\u003e find_knee(A.T)  # also works with x in the first column, y in the second column\n4\n\u003e\u003e\u003e find_knee(x, y, smoothing=0.01)  # for better results use cubic spline smoothing\n4\n```\n\n### CLI\nThis library can also come with a handy CLI if you install it with the `cli` extra:\n```shell\n$ pip install \"knarrow[cli]\"\n$ cat data.txt | knarrow -\n\u003cstdin\u003e 11\n$ cat data.txt | knarrow -o value -\n\u003cstdin\u003e 59874.14171519781845532648\n$ knarrow --sort -d ',' -o value shuf_delim.txt\nshuf_delim.txt 20\n```\n_(the `-` for stdin is, unfortunately, mandatory)_\nTry writing `knarrow --help` for more info.\n\n## Similar projects\n\nWhile I've come up with most of these methods by myself, I am not the only one. Here is a (non-comprehensive) list of projects I've found that implement a similar functionality and may have been an inspiration for me:\n- [mariolpantunes/knee](https://github.com/mariolpantunes/knee)\n\nNote: this project was bootstrapped by [python-blueprint](https://github.com/johnthagen/python-blueprint). Since then, it has been heavily modified, though.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincognito124%2Fknarrow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fincognito124%2Fknarrow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fincognito124%2Fknarrow/lists"}