{"id":21186472,"url":"https://github.com/thieu1995/metacluster","last_synced_at":"2025-07-10T01:31:18.178Z","repository":{"id":185065804,"uuid":"670197315","full_name":"thieu1995/MetaCluster","owner":"thieu1995","description":"MetaCluster: An Open-Source Python Library for Metaheuristic-based Clustering Problems","archived":false,"fork":false,"pushed_at":"2023-12-07T02:01:22.000Z","size":3294,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-05T13:45:16.873Z","etag":null,"topics":["classification","clustering-methods","genetic-algorithm","global-search","k-center-problem","kmeans","kmeans-clustering","mealpy","metaheuristic-based-clustering","particle-swarm-optimization","unsupervised-learning","whale-optimization-algorithm"],"latest_commit_sha":null,"homepage":"https://metacluster.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thieu1995.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-07-24T14:00:40.000Z","updated_at":"2024-08-09T05:32:06.000Z","dependencies_parsed_at":"2023-12-22T10:12:07.981Z","dependency_job_id":"eb93d635-9363-414a-8119-002c8c20808e","html_url":"https://github.com/thieu1995/MetaCluster","commit_stats":{"total_commits":68,"total_committers":1,"mean_commits":68.0,"dds":0.0,"last_synced_commit":"e49fe74014d17046a8e1c5a8896f5271c2f00c20"},"previous_names":["thieu1995/metacluster"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FMetaCluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FMetaCluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FMetaCluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FMetaCluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thieu1995","download_url":"https://codeload.github.com/thieu1995/MetaCluster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225197747,"owners_count":17436767,"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":["classification","clustering-methods","genetic-algorithm","global-search","k-center-problem","kmeans","kmeans-clustering","mealpy","metaheuristic-based-clustering","particle-swarm-optimization","unsupervised-learning","whale-optimization-algorithm"],"created_at":"2024-11-20T18:23:51.953Z","updated_at":"2024-11-20T18:23:52.453Z","avatar_url":"https://github.com/thieu1995.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cimg style=\"max-width:100%;\" src=\"https://thieu1995.github.io/post/2023-08/MetaCluster-01.png\" alt=\"MetaCluster\"/\u003e\n\u003c/p\u003e\n\n---\n\n[![GitHub release](https://img.shields.io/badge/release-1.2.0-yellow.svg)](https://github.com/thieu1995/metacluster/releases)\n[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/metacluster) \n[![PyPI version](https://badge.fury.io/py/metacluster.svg)](https://badge.fury.io/py/metacluster)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/metacluster.svg)\n![PyPI - Status](https://img.shields.io/pypi/status/metacluster.svg)\n[![Downloads](https://static.pepy.tech/badge/MetaCluster)](https://pepy.tech/project/MetaCluster)\n[![Tests \u0026 Publishes to PyPI](https://github.com/thieu1995/metacluster/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/metacluster/actions/workflows/publish-package.yaml)\n![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/metacluster.svg)\n[![Documentation Status](https://readthedocs.org/projects/metacluster/badge/?version=latest)](https://metacluster.readthedocs.io/en/latest/?badge=latest)\n[![Chat](https://img.shields.io/badge/Chat-on%20Telegram-blue)](https://t.me/+fRVCJGuGJg1mNDg1)\n![GitHub contributors](https://img.shields.io/github/contributors/thieu1995/metacluster.svg)\n[![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)\n[![DOI](https://zenodo.org/badge/670197315.svg)](https://zenodo.org/badge/latestdoi/670197315)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n\nMetaCluster is the largest open-source nature-inspired optimization (Metaheuristic Algorithms) library for \nclustering problem in Python\n\n* **Free software:** GNU General Public License (GPL) V3 license\n* **Provided 3 classes: `MetaCluster`, `MhaKCentersClustering`, and `MhaKMeansTuner`**\n* **Total nature-inspired metaheuristic optimizers (Metaheuristic Algorithms)**: \u003e 200 optimizers\n* **Total objective functions (as fitness)**: \u003e 40 objectives\n* **Total supported datasets**: 48 datasets from Scikit learn, UCI, ELKI, KEEL...\n* **Total performance metrics**: \u003e 40 metrics\n* **Total different way of detecting the K value**: \u003e= 10 methods\n* **Documentation:** https://metacluster.readthedocs.io/en/latest/\n* **Python versions:** \u003e= 3.7.x\n* **Dependencies:** numpy, scipy, scikit-learn, pandas, mealpy, permetrics, plotly, kaleido\n\n\n\n# Citation Request\n\nPlease include these citations if you plan to use this library:\n\n```code\n@article{VanThieu2023,\n  author = {Van Thieu,  Nguyen and Oliva,  Diego and Pérez-Cisneros,  Marco},\n  title = {MetaCluster: An open-source Python library for metaheuristic-based clustering problems},\n  journal = {SoftwareX},\n  year = {2023},\n  pages = {101597},\n  volume = {24},\n  DOI = {10.1016/j.softx.2023.101597},\n}\n\n@article{van2023mealpy,\n  title={MEALPY: An open-source library for latest meta-heuristic algorithms in Python},\n  author={Van Thieu, Nguyen and Mirjalili, Seyedali},\n  journal={Journal of Systems Architecture},\n  year={2023},\n  publisher={Elsevier},\n  doi={10.1016/j.sysarc.2023.102871}\n}\n```\n\n\n# Installation\n\n* Install the [current PyPI release](https://pypi.python.org/pypi/metacluster):\n```sh \n$ pip install metacluster==1.2.0\n```\n\n* Install directly from source code\n```sh \n$ git clone https://github.com/thieu1995/metacluster.git\n$ cd metacluster\n$ python setup.py install\n```\n\n* In case, you want to install the development version from Github:\n```sh \n$ pip install git+https://github.com/thieu1995/permetrics \n```\n\nAfter installation, you can import MetaCluster as any other Python module:\n\n```sh\n$ python\n\u003e\u003e\u003e import metacluster\n\u003e\u003e\u003e metacluster.__version__\n```\n\n### Examples\n\nWe implement a dedicated Github repository for examples at [MetaCluster_examples](https://github.com/thieu1995/MetaCluster_examples)\n\nLet's go through some basic examples from here:\n\n#### 1. First, load dataset. You can use the available datasets from MetaCluster:\n\n```python \n# Load available dataset from MetaCluster\nfrom metacluster import get_dataset\n\n# Try unknown data\nget_dataset(\"unknown\")\n# Enter: 1      -\u003e This wil list all of avaialble dataset\n\ndata = get_dataset(\"Arrhythmia\")\n```\n\n* Or you can load your own dataset \n\n```python\nimport pandas as pd\nfrom metacluster import Data\n\n# load X and y\n# NOTE MetaCluster accepts numpy arrays only, hence use the .values attribute\ndataset = pd.read_csv('examples/dataset.csv', index_col=0).values\nX, y = dataset[:, 0:-1], dataset[:, -1]\ndata = Data(X, y, name=\"my-dataset\")\n```\n\n#### 2. Next, scale your features\n\n**You should confirm that your dataset is scaled and normalized**\n\n```python\n# MinMaxScaler \ndata.X, scaler = data.scale(data.X, method=\"MinMaxScaler\", feature_range=(0, 1))\n\n# StandardScaler \ndata.X, scaler = data.scale(data.X, method=\"StandardScaler\")\n\n# MaxAbsScaler \ndata.X, scaler = data.scale(data.X, method=\"MaxAbsScaler\")\n\n# RobustScaler \ndata.X, scaler = data.scale(data.X, method=\"RobustScaler\")\n\n# Normalizer \ndata.X, scaler = data.scale(data.X, method=\"Normalizer\", norm=\"l2\")   # \"l1\" or \"l2\" or \"max\"\n```\n\n\n#### 3. Next, select Metaheuristic Algorithm, Its parameters, list of objectives, and list of performance metrics \n\n```python\nlist_optimizer = [\"BaseFBIO\", \"OriginalGWO\", \"OriginalSMA\"]\nlist_paras = [\n    {\"name\": \"FBIO\", \"epoch\": 10, \"pop_size\": 30},\n    {\"name\": \"GWO\", \"epoch\": 10, \"pop_size\": 30},\n    {\"name\": \"SMA\", \"epoch\": 10, \"pop_size\": 30}\n]\nlist_obj = [\"SI\", \"RSI\"]\nlist_metric = [\"BHI\", \"DBI\", \"DI\", \"CHI\", \"SSEI\", \"NMIS\", \"HS\", \"CS\", \"VMS\", \"HGS\"]\n```\n\nYou can check all supported metaheuristic algorithms from: https://github.com/thieu1995/mealpy.\nAll supported clustering objectives and metrics from: https://github.com/thieu1995/permetrics.\n\nIf you don't want to read the documents, you can print out all supported information by:\n\n```python\nfrom metacluster import MetaCluster \n\n# Get all supported methods and print them out\nMetaCluster.get_support(name=\"all\")\n```\n\n\n#### 4. Next, create an instance of MetaCluster class and run it.\n\n```python\nmodel = MetaCluster(list_optimizer=list_optimizer, list_paras=list_paras, list_obj=list_obj, n_trials=3, seed=10)\n\nmodel.execute(data=data, cluster_finder=\"elbow\", list_metric=list_metric, save_path=\"history\", verbose=False)\n\nmodel.save_boxplots()\nmodel.save_convergences()\n```\n\nAs you can see, you can define different datasets and using the same model to run it. \nRemember to set the name to your dataset, because the folder that hold your results is the name of your dataset.\nMore examples can be found [here](/examples)\n\n\n# Support \n\n### Official links (questions, problems)\n\n* Official source code repo: https://github.com/thieu1995/metacluster\n* Official document: https://metacluster.readthedocs.io/\n* Download releases: https://pypi.org/project/metacluster/\n* Issue tracker: https://github.com/thieu1995/metacluster/issues\n* Notable changes log: https://github.com/thieu1995/metacluster/blob/master/ChangeLog.md\n* Official chat group: https://t.me/+fRVCJGuGJg1mNDg1\n\n* This project also related to our another projects which are optimization and machine learning. Check it here:\n    * https://github.com/thieu1995/metaheuristics\n    * https://github.com/thieu1995/mealpy\n    * https://github.com/thieu1995/mafese\n    * https://github.com/thieu1995/pfevaluator\n    * https://github.com/thieu1995/opfunu\n    * https://github.com/thieu1995/enoppy\n    * https://github.com/thieu1995/permetrics\n    * https://github.com/thieu1995/IntelELM\n    * https://github.com/thieu1995/MetaPerceptron\n    * https://github.com/thieu1995/GrafoRVFL\n    * https://github.com/aiir-team\n\n\n### Supported links \n\n```code \n1. https://jtemporal.com/kmeans-and-elbow-method/\n2. https://medium.com/@masarudheena/4-best-ways-to-find-optimal-number-of-clusters-for-clustering-with-python-code-706199fa957c\n3. https://github.com/minddrummer/gap/blob/master/gap/gap.py\n4. https://www.tandfonline.com/doi/pdf/10.1080/03610927408827101\n5. https://doi.org/10.1016/j.engappai.2018.03.013\n6. https://github.com/tirthajyoti/Machine-Learning-with-Python/blob/master/Clustering-Dimensionality-Reduction/Clustering_metrics.ipynb\n7. https://elki-project.github.io/\n8. https://sci2s.ugr.es/keel/index.php\n9. https://archive.ics.uci.edu/datasets\n10. https://python-charts.com/distribution/box-plot-plotly/\n11. https://plotly.com/python/box-plots/?_ga=2.50659434.2126348639.1688086416-114197406.1688086416#box-plot-styling-mean--standard-deviation\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthieu1995%2Fmetacluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthieu1995%2Fmetacluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthieu1995%2Fmetacluster/lists"}