{"id":21471001,"url":"https://github.com/saadarazzaq/cluster-analysis-elbow-method","last_synced_at":"2025-06-11T03:33:13.362Z","repository":{"id":183394639,"uuid":"670069103","full_name":"SaadARazzaq/Cluster-Analysis-Elbow-Method","owner":"SaadARazzaq","description":"implements the elbow method to determine the optimal number of clusters (k) for a given dataset using the K-means clustering algorithm.","archived":false,"fork":false,"pushed_at":"2023-07-24T08:25:00.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T06:48:04.655Z","etag":null,"topics":["elbow-method","euclidean-distances","kmeans-algorithm","python","unsupervised-learning"],"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/SaadARazzaq.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}},"created_at":"2023-07-24T08:20:26.000Z","updated_at":"2024-03-01T18:10:12.000Z","dependencies_parsed_at":"2023-07-24T09:52:49.431Z","dependency_job_id":null,"html_url":"https://github.com/SaadARazzaq/Cluster-Analysis-Elbow-Method","commit_stats":null,"previous_names":["saadarazzaq/cluster-analysis-elbow-method"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FCluster-Analysis-Elbow-Method","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FCluster-Analysis-Elbow-Method/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FCluster-Analysis-Elbow-Method/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FCluster-Analysis-Elbow-Method/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SaadARazzaq","download_url":"https://codeload.github.com/SaadARazzaq/Cluster-Analysis-Elbow-Method/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SaadARazzaq%2FCluster-Analysis-Elbow-Method/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259191971,"owners_count":22819409,"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-method","euclidean-distances","kmeans-algorithm","python","unsupervised-learning"],"created_at":"2024-11-23T09:30:14.693Z","updated_at":"2025-06-11T03:33:13.314Z","avatar_url":"https://github.com/SaadARazzaq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cluster-Analysis-Elbow-Method\n\n## Introduction\n\nThis repository implements the elbow method to determine the optimal number of clusters (k) for a given dataset using the K-means clustering algorithm. The elbow method is a common technique to find the ideal value of k by plotting the total within-cluster sum of squares (WCSS) against different k values.\n\n## Dataset\n\nThe dataset used for this project is available in the \"Data.csv\" file.\n\n## Code Explanation\n\nThe code is written in Python and uses the following functions:\n\n- `euclidean_distance(a, b)`: Calculates the Euclidean distance between two points `a` and `b`.\n- `k_means(data, k)`: Implements the K-means clustering algorithm with `k` clusters.\n- `total_within_cluster_sum_of_squares(data, centroids, assignments)`: Calculates the total within-cluster sum of squares (WCSS) for a given set of data points, centroids, and cluster assignments.\n- `elbow_method(data, max_k)`: Uses the K-means algorithm to find WCSS for different values of `k` and returns a list of WCSS values.\n- `visualize_elbow_method(wcss)`: Plots the WCSS values against different `k` values to visualize the elbow method.\n\n## Usage\n\n1. Clone the repository to your local machine.\n2. Make sure you have Python and the required libraries installed (NumPy, Pandas, and Matplotlib).\n3. Run the Python script `main.py`.\n4. The script will output the optimal value of k and plot the elbow method graph.\n\n## Screenshot\n\n![image](https://github.com/SaadARazzaq/Cluster-Analysis-Elbow-Method/assets/123338307/06ba16d9-bb30-4903-9bbc-c2d1950bf28c)\n\n## Results\n\nAfter running the code, the elbow method graph will be displayed showing the WCSS values for different k values. The optimal number of clusters (k) can be identified at the \"elbow point\" in the graph where the rate of WCSS reduction starts to slow down.\n\n## Contributing\n\nContributions to this project are welcome. If you find any issues or have suggestions for improvements, please feel free to open a pull request or submit an issue.\n\n## Contact\nFor any questions or inquiries, you can reach me at sabdurrazzaq124@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaadarazzaq%2Fcluster-analysis-elbow-method","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaadarazzaq%2Fcluster-analysis-elbow-method","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaadarazzaq%2Fcluster-analysis-elbow-method/lists"}