{"id":42191527,"url":"https://github.com/jayshkhan/kmeanvisualizing","last_synced_at":"2026-01-26T23:03:37.369Z","repository":{"id":251347402,"uuid":"799813138","full_name":"JayshKhan/KmeanVisualizing","owner":"JayshKhan","description":"This project implements a K-means clustering algorithm with data visualization using Matplotlib and SciPy, including an Elbow method for optimal cluster determination and animated visualizations of the clustering process. It generates random data, performs clustering, and visualizes the results with cluster boundaries.","archived":false,"fork":false,"pushed_at":"2024-08-05T11:53:52.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-05T13:42:17.381Z","etag":null,"topics":["ai","kmeans-algorithm","kmeans-clustering","kmeans-clustering-algorithm","machine-learning-algorithms","visulization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JayshKhan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-13T06:42:17.000Z","updated_at":"2024-08-05T11:53:56.000Z","dependencies_parsed_at":"2024-08-02T11:45:43.893Z","dependency_job_id":"b4067085-3911-43d7-a6be-9e442bed340f","html_url":"https://github.com/JayshKhan/KmeanVisualizing","commit_stats":null,"previous_names":["jayshkhan/kmeanvisualizing"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JayshKhan/KmeanVisualizing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayshKhan%2FKmeanVisualizing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayshKhan%2FKmeanVisualizing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayshKhan%2FKmeanVisualizing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayshKhan%2FKmeanVisualizing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JayshKhan","download_url":"https://codeload.github.com/JayshKhan/KmeanVisualizing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayshKhan%2FKmeanVisualizing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28791165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"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":["ai","kmeans-algorithm","kmeans-clustering","kmeans-clustering-algorithm","machine-learning-algorithms","visulization"],"created_at":"2026-01-26T23:03:36.216Z","updated_at":"2026-01-26T23:03:37.356Z","avatar_url":"https://github.com/JayshKhan.png","language":"Python","readme":"# K-means Clustering Visualization Project\n\nThis project implements a K-means clustering algorithm with data visualization using Matplotlib and SciPy. The project includes the following key components:\n\n## Components\n\n1. **Data Generation**: \n   - The `generate_data` function creates random data points with specified features and value ranges.\n\n2. **Elbow Method**: \n   - The `elbow_method` function determines the optimal number of clusters by plotting the cost/inertia for different values of \\( k \\).\n\n3. **K-means Clustering**: \n   - The `kmeans` function performs the K-means clustering algorithm, iteratively updating centroids and assigning data points to clusters until convergence or a maximum number of iterations is reached.\n\n4. **Visualization**: \n   - The `animate_kmeans` function visualizes the clustering process by plotting the data points, centroids, and cluster boundaries at each iteration, saving the plots as images before updating.\n\n5. **Execution**: \n   - The script generates random data, runs the Elbow method to determine the optimal number of clusters, performs K-means clustering, and displays the clustering process using Matplotlib.\n\n## Files\n\n- `kmeans_visualizing_without_boundary.py`: Implements the K-means clustering algorithm with data visualization.\n- `kmeans_visualizing_with_boundary.py`: Implements the K-means clustering algorithm with data visualization and cluster boundary.\n## Usage\n\n1. **Generate Data**: \n   - Use the `generate_data` function to create random data points.\n\n2. **Determine Optimal Clusters**: \n   - Use the `elbow_method` function to determine the optimal number of clusters.\n\n3. **Run K-means Clustering**: \n   - Use the `kmeans` function to perform the clustering.\n\n4. **Visualize Clustering Process**: \n   - Use the `animate_kmeans` function to visualize and save the clustering process.\n\n## Requirements\n\n- Python 3.x\n- Matplotlib\n- SciPy\n\n## Installation\n\nInstall the required packages using pip:\n\n```sh\npip install matplotlib scipy\n```\n\n## Running the Project\n\n1. Generate random data.\n2. Determine the optimal number of clusters using the Elbow method.\n3. Perform K-means clustering.\n4. Visualize the clustering process.\n\n```sh\npython3 kmean_visualizing_without_boundary.py\n\npython3 kmean_visualilzing_with_boundary.py\n\n```\n\n## License\n\nThis project is licensed under the MIT License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayshkhan%2Fkmeanvisualizing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayshkhan%2Fkmeanvisualizing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayshkhan%2Fkmeanvisualizing/lists"}