{"id":21186476,"url":"https://github.com/thieu1995/intelelm","last_synced_at":"2025-07-10T01:31:19.133Z","repository":{"id":188439748,"uuid":"676116509","full_name":"thieu1995/IntelELM","owner":"thieu1995","description":"IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine","archived":false,"fork":false,"pushed_at":"2024-10-09T06:08:33.000Z","size":4395,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-15T10:54:54.464Z","etag":null,"topics":["classification-models","elm","evolutionary-computation","extreme-learning-machine","genetic-algorithm","machine-learning","metaheuristic-algorithms","metaheuristic-based-extreme-learning-machine","mha-elm","nature-inspired-algorithms","neural-networks","particle-swarm-optimization","regression-models","scikit-learn","swarm-intelligence-algorithms","whale-optimization-algorithm"],"latest_commit_sha":null,"homepage":"https://intelelm.readthedocs.io","language":"Jupyter Notebook","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-08T13:18:41.000Z","updated_at":"2024-10-09T06:07:27.000Z","dependencies_parsed_at":"2024-11-15T10:42:43.473Z","dependency_job_id":"c052d14b-e4cb-4e6d-a2c8-4a72599c17cc","html_url":"https://github.com/thieu1995/IntelELM","commit_stats":null,"previous_names":["thieu1995/intelelm"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FIntelELM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FIntelELM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FIntelELM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thieu1995%2FIntelELM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thieu1995","download_url":"https://codeload.github.com/thieu1995/IntelELM/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225608356,"owners_count":17495897,"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-models","elm","evolutionary-computation","extreme-learning-machine","genetic-algorithm","machine-learning","metaheuristic-algorithms","metaheuristic-based-extreme-learning-machine","mha-elm","nature-inspired-algorithms","neural-networks","particle-swarm-optimization","regression-models","scikit-learn","swarm-intelligence-algorithms","whale-optimization-algorithm"],"created_at":"2024-11-20T18:23:53.906Z","updated_at":"2025-07-10T01:31:19.125Z","avatar_url":"https://github.com/thieu1995.png","language":"Jupyter Notebook","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/intelelm.png\" alt=\"IntelELM\"/\u003e\n\u003c/p\u003e\n\n---\n\n[![GitHub release](https://img.shields.io/badge/release-1.3.0-yellow.svg)](https://github.com/thieu1995/intelelm/releases)\n[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/intelelm) \n[![PyPI version](https://badge.fury.io/py/intelelm.svg)](https://badge.fury.io/py/intelelm)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/intelelm.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/intelelm.svg)\n[![Downloads](https://static.pepy.tech/badge/intelelm)](https://pepy.tech/project/intelelm)\n[![Tests \u0026 Publishes to PyPI](https://github.com/thieu1995/intelelm/actions/workflows/publish-package.yml/badge.svg)](https://github.com/thieu1995/intelelm/actions/workflows/publish-package.yml)\n[![Documentation Status](https://readthedocs.org/projects/intelelm/badge/?version=latest)](https://intelelm.readthedocs.io/en/latest/?badge=latest)\n[![Chat](https://img.shields.io/badge/Chat-on%20Telegram-blue)](https://t.me/+fRVCJGuGJg1mNDg1)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8249045.svg)](https://doi.org/10.5281/zenodo.8249045)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n\n**IntelELM** is an open-source Python library providing a framework for training Extreme Learning Machines (ELM) using \nMetaheuristic Algorithms. It is compatible with Scikit-Learn, enabling easy integration into existing machine learning\npipelines such as hyperparameter tuning, feature selection,...\n\n\n---\n\n## 🚀 Features\n\n* **Free software:** GNU General Public License (GPL) V3 license\n* **Provided Estimator**: `ElmRegressor`, `ElmClassifier`, `MhaElmRegressor`, `MhaElmClassifier`, `AutomatedMhaElmTuner`, `AutomatedMhaElmComparator`\n* **Total Optimization-based ELM Regression**: \u003e 200 Models \n* **Total Optimization-based ELM Classification**: \u003e 200 Models\n* **Supported datasets**: 54 (47 classifications and 7 regressions)\n* **Supported performance metrics**: \u003e= 67 (47 regressions and 20 classifications)\n* **Supported objective functions (as fitness functions or loss functions)**: \u003e= 67 (47 regressions and 20 classifications)\n* **Documentation:** https://intelelm.readthedocs.io/\n* **Python versions:** \u003e= 3.8.x\n* **Dependencies:** numpy, scipy, scikit-learn, pandas, mealpy, permetrics\n\n\n## 📄 Citation Request\n\nIf you want to understand how Metaheuristic is applied to Extreme Learning Machine, you need to read the paper \ntitled \"A new workload prediction model using extreme learning machine and enhanced tug of war optimization\". \nThe paper can be accessed at the following [this link](https://doi.org/10.1016/j.procs.2020.03.063)\n\n\nPlease include these citations if you plan to use this library:\n\n```bibtex\n@article{van2025intelelm,\n  title={IntelELM: A python framework for intelligent metaheuristic-based extreme learning machine},\n  author={Van Thieu, Nguyen and Houssein, Essam H and Oliva, Diego and Hung, Nguyen Duy},\n  journal={Neurocomputing},\n  volume={618},\n  pages={129062},\n  year={2025},\n  publisher={Elsevier},\n  doi={10.1016/j.neucom.2024.129062}\n}\n\n@article{nguyen2020new,\n  title={A new workload prediction model using extreme learning machine and enhanced tug of war optimization},\n  author={Nguyen, Thieu and Hoang, Bao and Nguyen, Giang and Nguyen, Binh Minh},\n  journal={Procedia Computer Science},\n  volume={170},\n  pages={362--369},\n  year={2020},\n  publisher={Elsevier},\n  doi={10.1016/j.procs.2020.03.063}\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## 📦 Installation\n\n# Installation\n\nInstall the latest version from PyPI:\n\n```bash\n$ pip install intelelm\n```\n\nCheck installed version:\n\n```bash\n$ python\n\u003e\u003e\u003e import intelelm\n\u003e\u003e\u003e intelelm.__version__\n```\n\n## 📚 Documentation \u0026 Tutorials\n\n- **Documentation:** [https://intelelm.readthedocs.io/en/latest/](https://intelelm.readthedocs.io/en/latest/)\n- **Tutorials:**\n  - [Handwritten Digits Classification](./tutorials/example_hand_written_digits.ipynb)\n  - [California Housing Price Regression](./tutorials/example_california_housing.ipynb)\n\n\n## 🧪 Example Usage\n\n* In this section, we will explore the usage of the IntelELM model with the assistance of a dataset. While all the \npreprocessing steps mentioned below can be replicated using Scikit-Learn, we have implemented some utility functions \nto provide users with convenience and faster usage.\n\n\n```python\n### Step 1: Importing the libraries\nfrom intelelm import ElmRegressor, ElmClassifier, MhaElmRegressor, MhaElmClassifier, get_dataset\n\n#### Step 2: Reading the dataset\ndata = get_dataset(\"aniso\")\n\n#### Step 3: Next, split dataset into train and test set\ndata.split_train_test(test_size=0.2, shuffle=True, random_state=100)\n\n#### Step 4: Feature Scaling\ndata.X_train, scaler_X = data.scale(data.X_train, scaling_methods=(\"standard\", \"minmax\"))\ndata.X_test = scaler_X.transform(data.X_test)\n\ndata.y_train, scaler_y = data.encode_label(data.y_train)   # This is for classification problem only\ndata.y_test = scaler_y.transform(data.y_test)\n\n#### Step 5: Fitting ELM-based model to the dataset\n\n##### 5.1: Use standard ELM model for regression problem\nregressor = ElmRegressor(layer_sizes=(10, ), act_name=\"relu\", seed=42)\nregressor.fit(data.X_train, data.y_train)\n\n##### 5.2: Use standard ELM model for classification problem \nclassifer = ElmClassifier(layer_sizes=(10, ), act_name=\"tanh\", seed=42)\nclassifer.fit(data.X_train, data.y_train)\n\n##### 5.3: Use Metaheuristic-based ELM model for regression problem\nprint(MhaElmClassifier.SUPPORTED_OPTIMIZERS)\nprint(MhaElmClassifier.SUPPORTED_REG_OBJECTIVES)\nopt_paras = {\"name\": \"GA\", \"epoch\": 10, \"pop_size\": 30}\nregressor = MhaElmRegressor(layer_sizes=(10, ), act_name=\"elu\", obj_name=\"RMSE\", \n                            optim=\"BaseGA\", optim_params=opt_paras, seed=42,\n                            lb=None, ub=None, mode='single', n_workers=None, termination=None)\nregressor.fit(data.X_train, data.y_train)\n\n##### 5.4: Use Metaheuristic-based ELM model for classification problem\nprint(MhaElmClassifier.SUPPORTED_OPTIMIZERS)\nprint(MhaElmClassifier.SUPPORTED_CLS_OBJECTIVES)\nopt_paras = {\"name\": \"GA\", \"epoch\": 10, \"pop_size\": 30}\nclassifier = MhaElmClassifier(layer_sizes=(10, ), act_name=\"elu\", obj_name=\"KLDL\", \n                              optim=\"BaseGA\", optim_params=opt_paras, seed=42,\n                              lb=None, ub=None, mode='single', n_workers=None, termination=None)\nclassifier.fit(data.X_train, data.y_train)\n\n#### Step 6: Predicting a new result\ny_pred = regressor.predict(data.X_test)\n\ny_pred_cls = classifier.predict(data.X_test)\ny_pred_label = scaler_y.inverse_transform(y_pred_cls)\n\n#### Step 7: Calculate metrics using score or scores functions.\nprint(\"Try my AS metric with score function\")\nprint(regressor.score(data.X_test, data.y_test, method=\"AS\"))\n\nprint(\"Try my multiple metrics with scores function\")\nprint(classifier.scores(data.X_test, data.y_test, list_methods=[\"AS\", \"PS\", \"F1S\", \"CEL\", \"BSL\"]))\n\nprint(\"Try my evaluate functions\")\nprint(regressor.evaluate(data.y_test, y_pred, list_metrics=(\"RMSE\", \"MAE\", \"MAPE\", \"NSE\", \"R2\")))\n\n#### Save results\nregressor.save_loss_train(save_path=\"history\", filename=\"loss_train.csv\")\nregressor.save_metrics(data.y_test, y_pred, list_metrics=(\"R2\", \"MAPE\", \"MAE\", \"MSE\"), save_path=\"history\", filename=\"metrics.csv\")\n```\n\nA real-world dataset contains features that vary in magnitudes, units, and range. We would suggest performing \nnormalization when the scale of a feature is irrelevant or misleading. Feature Scaling basically helps to normalize \nthe data within a particular range.\n\n---\n\n## ❓ FAQ\n\n### 1. How to list supported objective metrics?\n\nWhere do I find the supported metrics like above [\"AS\", \"PS\", \"RS\"]. What is that?\nYou can find it here: https://github.com/thieu1995/permetrics or use this\n\n```python\nfrom intelelm import MhaElmClassifier, MhaElmRegressor\n\nprint(MhaElmRegressor.SUPPORTED_REG_OBJECTIVES)\nprint(MhaElmClassifier.SUPPORTED_CLS_OBJECTIVES)\n```\n\n### 2. ValueError: Existed at least one new label in y_pred?\nI got this type of error\n```python\nraise ValueError(\"Existed at least one new label in y_pred.\")\nValueError: Existed at least one new label in y_pred.\n``` \nHow to solve this?\n\n+ This occurs only when you are working on a classification problem with a small dataset that has many classes. For \n  instance, the \"Zoo\" dataset contains only 101 samples, but it has 7 classes. If you split the dataset into a \n  training and testing set with a ratio of around 80% - 20%, there is a chance that one or more classes may appear \n  in the testing set but not in the training set. As a result, when you calculate the performance metrics, you may \n  encounter this error. You cannot predict or assign new data to a new label because you have no knowledge about the \n  new label. There are several solutions to this problem.\n\n- **1st: Use SMOTE to rebalance the dataset:**\n- \nUse the SMOTE method to address imbalanced data and ensure that all classes have the same number of samples.\n\n```python\nimport pandas as pd\nfrom imblearn.over_sampling import SMOTE\nfrom intelelm import Data\n\ndataset = pd.read_csv('examples/dataset.csv', index_col=0).values\nX, y = dataset[:, 0:-1], dataset[:, -1]\n\nX_new, y_new = SMOTE().fit_resample(X, y)\ndata = Data(X_new, y_new)\n```\n\n- **2st: Try changing `random_state` in split_train_test:**\n\n- Use different random_state numbers in split_train_test() function.\n\n```python\nimport pandas as pd\nfrom intelelm import Data\n\ndataset = pd.read_csv('examples/dataset.csv', index_col=0).values\nX, y = dataset[:, 0:-1], dataset[:, -1]\ndata = Data(X, y)\ndata.split_train_test(test_size=0.2, random_state=10)  # Try different random_state value \n```\n\n### 3. Why don't MHA-based ELM models improve results?\n\nWhen testing several algorithms based on Extreme Learning Machines (ELM), they all produce the same results. \n   Even during the training process, the global best solution remains unchanged.\n\n+ This issue was identified in version \u003c= v1.0.2 when the default values for the lower bound (lb) and upper bound \n  (ub) were set in the narrow range of (-1, 1). This limited range proved to be too small, causing all algorithms to \n  converge to local optima. Fortunately, this problem has been addressed in versions \u003e v1.0.3, where the default \n  range has been extended to (-10., 10.). You also can define your own lb and ub ranges depend on your problem.\n+ In traditional neural network like MLP, they weights (weights + biases) are typically initialized within the range \n  of (-1., 1.). However, during training using gradient-based methods, these values are updated, and there are no \n  strict bounds on them.\n+ Meanwhile, in metaheuristic optimization, it's necessary to set boundaries for decision variables (weights) each \n  time a new search agent is formed. Therefore, if you define a narrow range, your optimizer may converge more \n  quickly, but it's more likely to get stuck in local optima (which explains why the global best value remains \n  unchanged during training). Moreover, in some cases, there might not even be a global optimum within that narrow \n  range. Conversely, if you set a wider range, the optimization process may be slower, and the global best value may \n  change more gradually. In such cases, you might need to increase the number of epochs, perhaps up to 1000, for the \n  optimizer to explore the solution space thoroughly.\n\n```python\nfrom intelelm import MhaElmClassifier\n\nopt_paras = {\"name\": \"GA\", \"epoch\": 30, \"pop_size\": 30}\nmodel = MhaElmClassifier(layer_sizes=(10, ), act_name=\"elu\", obj_name=\"KLDL\", \n                         optim=\"BaseGA\", optim_params=opt_paras, verbose=True, seed=42,\n                         lb=-10., ub=10., mode='single', n_workers=None, termination=None)\nmodel.fit(X_train, y_train)\ny_pred = model.predict(X_test)\n```\n\n## 🔗 Useful Links\n\n- 📦 [Source Code](https://github.com/thieu1995/intelelm)\n- 📖 [Documentation](https://intelelm.readthedocs.io/)\n- ⬇️ [PyPI Releases](https://pypi.org/project/intelelm/)\n- ❗ [Report Issues](https://github.com/thieu1995/intelelm/issues)\n- 📝 [Changelog](https://github.com/thieu1995/MetaPerceptron/blob/master/ChangeLog.md)\n- 💬 [Chat Group](https://t.me/+fRVCJGuGJg1mNDg1)\n\n\n## 🤝 Related Projects\n\n- [MEALPY](https://github.com/thieu1995/mealpy)\n- [Metaheuristics](https://github.com/thieu1995/metaheuristics)\n- [Opfunu](https://github.com/thieu1995/opfunu)\n- [Enoppy](https://github.com/thieu1995/enoppy)\n- [Permetrics](https://github.com/thieu1995/permetrics)\n- [MetaCluster](https://github.com/thieu1995/MetaCluster)\n- [Pfevaluator](https://github.com/thieu1995/pfevaluator)\n- [AIIR Team](https://github.com/aiir-team)\n\n\n---\n\nDeveloped by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=IntelELM_QUESTIONS) @ 2023\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthieu1995%2Fintelelm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthieu1995%2Fintelelm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthieu1995%2Fintelelm/lists"}