{"id":25666477,"url":"https://github.com/parvvaresh/clustering-with-genetic","last_synced_at":"2025-04-22T19:11:30.161Z","repository":{"id":215728402,"uuid":"737882552","full_name":"parvvaresh/clustering-with-genetic","owner":"parvvaresh","description":"This Python script implements a genetic algorithm for clustering data. The algorithm optimizes the cluster assignments of data points using a genetic approach, aiming to improve the silhouette score. The silhouette score is a measure of how well-defined the clusters are in the data.","archived":false,"fork":false,"pushed_at":"2025-01-03T09:02:59.000Z","size":164,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T04:03:43.974Z","etag":null,"topics":["clustering","genetic-algorithm","python3"],"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/parvvaresh.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-01-01T20:49:57.000Z","updated_at":"2025-02-20T03:01:46.000Z","dependencies_parsed_at":"2024-01-13T04:11:52.837Z","dependency_job_id":"13309840-66c4-4367-82db-84119512d5de","html_url":"https://github.com/parvvaresh/clustering-with-genetic","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"60d23f21520e2b07c9203181e39e121d232d5284"},"previous_names":["parvvaresh/clustering-with-genetic"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parvvaresh%2Fclustering-with-genetic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parvvaresh%2Fclustering-with-genetic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parvvaresh%2Fclustering-with-genetic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parvvaresh%2Fclustering-with-genetic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parvvaresh","download_url":"https://codeload.github.com/parvvaresh/clustering-with-genetic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250306638,"owners_count":21408926,"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":["clustering","genetic-algorithm","python3"],"created_at":"2025-02-24T08:30:22.548Z","updated_at":"2025-04-22T19:11:30.144Z","avatar_url":"https://github.com/parvvaresh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Genetic Clustering Algorithm\n\nThis Python script implements a genetic algorithm for clustering data. The algorithm optimizes the cluster assignments of data points using a genetic approach, aiming to improve the silhouette score. The silhouette score is a measure of how well-defined the clusters are in the data.\n\n## Table of Contents\n- [Installation](#installation)\n- [Usage](#usage)\n- [Algorithm Overview](#algorithm-overview)\n  - [Genetic Class](#genetic-class)\n  - [Cluster Class](#cluster-class)\n- [Parameters](#parameters)\n- [Results](#results)\n- [License](#license)\n- [Acknowledgments](#acknowledgments)\n\n\n\n## Installation\n\n\n\n\n```bash\npip install cluster_ga\n```\n\n## Usage\n\n\n\n```python\nfrom sklearn import datasets\nimport numpy as np\nimport pandas as pd\nfrom cluster_ga.cluster import cluster\n\n# this is a for test\n\niris = datasets.load_iris()\niris_df = pd.DataFrame(iris.data, columns=iris.feature_names)\nx = np.array(iris_df[[\"petal length (cm)\", \"petal width (cm)\"]])\ny = iris.target\n\n# Instantiate and fit the model\nmodel = cluster(x, y, 500, 0.9,150) \nmodel.fit()\n\n\n# show fitness plot\nmodel.show_plot()\n\n```\n\n## Algorithm Overview\n\nThe genetic clustering algorithm consists of the following components:\n\n### Genetic Class\n\nDefines the genetic operations such as mutation, generation, and fitness calculation.\n\n### Cluster Class\n\nManages the clustering process, including the initialization of populations, evolution, and convergence.\n\n\n\n## Parameters\n\n- `size_population`: Number of individuals in the population.\n- `goal`: The desired fitness score to achieve.\n- `repeat`: Number of generations to run the algorithm.\n- `is_mutation`: Boolean flag to enable or disable mutation.\n\n## Results\n\nThe script outputs the progress of the algorithm, including the generation number and the fitness score achieved. Additionally, a plot of the fitness scores over generations is displayed at the end of the execution.\n\n![result](./assets/result.png)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.\n\n## Acknowledgments\n\n- This implementation is inspired by genetic algorithms and clustering techniques.\n- Special thanks to the scikit-learn library for providing the silhouette score metric.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparvvaresh%2Fclustering-with-genetic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparvvaresh%2Fclustering-with-genetic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparvvaresh%2Fclustering-with-genetic/lists"}