{"id":49565217,"url":"https://github.com/aaronjs99/tk2nn","last_synced_at":"2026-05-03T11:13:10.158Z","repository":{"id":42871436,"uuid":"268274997","full_name":"aaronjs99/tk2NN","owner":"aaronjs99","description":"tk2NN: TKinter-based K-Nearest Neighbors","archived":false,"fork":false,"pushed_at":"2025-06-25T09:33:21.000Z","size":741,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-06T00:39:31.951Z","etag":null,"topics":["data-science","data-visualization","feature-extraction","gui","interactive","k-nearest-neighbours","knn","pattern-recognition","python","tkinter"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aaronjs99.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2020-05-31T12:26:17.000Z","updated_at":"2025-07-05T00:17:44.000Z","dependencies_parsed_at":"2025-05-13T23:41:23.424Z","dependency_job_id":"7ce118db-dd3e-4441-9756-5c519f1c7b8e","html_url":"https://github.com/aaronjs99/tk2NN","commit_stats":null,"previous_names":["aaronjs99/tk2nn","aaronjohnsabu1999/tk2nn"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aaronjs99/tk2NN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronjs99%2Ftk2NN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronjs99%2Ftk2NN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronjs99%2Ftk2NN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronjs99%2Ftk2NN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aaronjs99","download_url":"https://codeload.github.com/aaronjs99/tk2NN/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aaronjs99%2Ftk2NN/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32566492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-science","data-visualization","feature-extraction","gui","interactive","k-nearest-neighbours","knn","pattern-recognition","python","tkinter"],"created_at":"2026-05-03T11:13:09.224Z","updated_at":"2026-05-03T11:13:10.150Z","avatar_url":"https://github.com/aaronjs99.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TKinter-based K-Nearest Neighbors (tk2NN)\n\n**tk2NN** is an interactive visualization of the **k-nearest neighbors (k-NN)** algorithm built using **Tkinter**. It lets you tweak the number of labels, points, and the value of *k*, and watch how the classification map changes in real time. You can toggle between **Euclidean** and **Manhattan** distance metrics, and colors for each label are randomized every time the graph is redrawn - even with the same points. Don’t like the current color scheme? Just re-select the same distance type. Boom. Fresh new look.\n\n![3-kNN with k-level 2 on 20 points with 4 labels (Euclidean)](./assets/demo.png)\n\n## Features\n\n- Switch between Euclidean and Manhattan distances\n- Rerun classification instantly with updated parameters\n- Random color assignments for each label every time\n- Clear all points with a right-click\n- Visualizes decision boundaries pixel-by-pixel\n- Lightweight Tkinter GUI — no heavy dependencies\n- Fully customizable via `config.yaml` — canvas size, colors, default parameters\n\n## Getting Started\n\n### Requirements\n\n- Python **3.8+** (recommended)\n- `colour`\n- `Pillow`\n\nInstall the required packages:\n\n```bash\npip install -r requirements.txt\n```\n\n### Run the App\n\n```bash\npython run.py\n```\n\n\u003e If you're using Linux and want to install Python 3.8 explicitly:\n\n```bash\nsudo add-apt-repository ppa:deadsnakes/ppa\nsudo apt-get update\nsudo apt-get install python3.8\npython3.8 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\npython run.py\n```\n\n## Project Structure\n\n```\ntk2nn/\n├── app/                  # Core modules\n│   ├── gui.py            # Main Tkinter app\n│   ├── knn_canvas.py     # k-NN algorithm and classification logic\n│   └── utils.py          # Random point generation, color logic, multimode fallback\n│\n├── assets/               # Images and visual resources\n│   ├── bg.png\n│   ├── demo.png\n│   └── multidemo.png\n│\n├── config.yaml          # Centralized configuration\n├── run.py                # Entry point to launch the app\n├── requirements.txt\n├── README.md\n└── .gitignore\n```\n\n## Notes\n\n- The color scheme is randomized **every time** you update or re-select a distance metric.\n- This project was inspired by another GUI project [TKayTint](https://github.com/aaronjohnsabu1999/TKayTint) (same developer — different beast).\n- It’s a simple educational tool that can be extended to explore classification boundaries, real datasets, or even point dragging and manual labeling.\n\n## Future Ideas\n\n- [ ] Add click-to-label custom point placement\n- [ ] Export the canvas as a PNG snapshot\n- [ ] Add more distance metrics (Chebyshev? Cosine?)\n- [ ] Toggle persistent vs. random color palettes\n- [ ] Performance boost with NumPy or shaders (if you’re crazy)\n\n## Contributing\n\nGot ideas? Bugs? Feature requests? Feel free to:\n- Fork the repo\n- Submit a pull request\n- Or just open an issue and yell into the void\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronjs99%2Ftk2nn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faaronjs99%2Ftk2nn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faaronjs99%2Ftk2nn/lists"}