intelelm

IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine

https://github.com/thieu1995/intelelm

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.5%) to scientific vocabulary

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
Last synced: 4 months ago · JSON representation ·

Repository

IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine

Basic Info
Statistics
  • Stars: 16
  • Watchers: 2
  • Forks: 4
  • Open Issues: 0
  • Releases: 9
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
Created over 2 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License Code of conduct Citation

README.md

IntelELM


GitHub release Wheel PyPI version PyPI - Python Version PyPI - Downloads Downloads Tests & Publishes to PyPI Documentation Status Chat DOI License: GPL v3

IntelELM is an open-source Python library providing a framework for training Extreme Learning Machines (ELM) using Metaheuristic Algorithms. It is compatible with Scikit-Learn, enabling easy integration into existing machine learning pipelines such as hyperparameter tuning, feature selection,...


🚀 Features

  • Free software: GNU General Public License (GPL) V3 license
  • Provided Estimator: ElmRegressor, ElmClassifier, MhaElmRegressor, MhaElmClassifier, AutomatedMhaElmTuner, AutomatedMhaElmComparator
  • Total Optimization-based ELM Regression: > 200 Models
  • Total Optimization-based ELM Classification: > 200 Models
  • Supported datasets: 54 (47 classifications and 7 regressions)
  • Supported performance metrics: >= 67 (47 regressions and 20 classifications)
  • Supported objective functions (as fitness functions or loss functions): >= 67 (47 regressions and 20 classifications)
  • Documentation: https://intelelm.readthedocs.io/
  • Python versions: >= 3.8.x
  • Dependencies: numpy, scipy, scikit-learn, pandas, mealpy, permetrics

📄 Citation Request

If you want to understand how Metaheuristic is applied to Extreme Learning Machine, you need to read the paper titled "A new workload prediction model using extreme learning machine and enhanced tug of war optimization". The paper can be accessed at the following this link

Please include these citations if you plan to use this library:

```bibtex @article{van2025intelelm, title={IntelELM: A python framework for intelligent metaheuristic-based extreme learning machine}, author={Van Thieu, Nguyen and Houssein, Essam H and Oliva, Diego and Hung, Nguyen Duy}, journal={Neurocomputing}, volume={618}, pages={129062}, year={2025}, publisher={Elsevier}, doi={10.1016/j.neucom.2024.129062} }

@article{nguyen2020new, title={A new workload prediction model using extreme learning machine and enhanced tug of war optimization}, author={Nguyen, Thieu and Hoang, Bao and Nguyen, Giang and Nguyen, Binh Minh}, journal={Procedia Computer Science}, volume={170}, pages={362--369}, year={2020}, publisher={Elsevier}, doi={10.1016/j.procs.2020.03.063} }

@article{van2023mealpy, title={MEALPY: An open-source library for latest meta-heuristic algorithms in Python}, author={Van Thieu, Nguyen and Mirjalili, Seyedali}, journal={Journal of Systems Architecture}, year={2023}, publisher={Elsevier}, doi={10.1016/j.sysarc.2023.102871} } ```

📦 Installation

Installation

Install the latest version from PyPI:

bash $ pip install intelelm

Check installed version:

```bash $ python

import intelelm intelelm.version ```

📚 Documentation & Tutorials

🧪 Example Usage

  • In this section, we will explore the usage of the IntelELM model with the assistance of a dataset. While all the preprocessing steps mentioned below can be replicated using Scikit-Learn, we have implemented some utility functions to provide users with convenience and faster usage.

```python

Step 1: Importing the libraries

from intelelm import ElmRegressor, ElmClassifier, MhaElmRegressor, MhaElmClassifier, get_dataset

Step 2: Reading the dataset

data = get_dataset("aniso")

Step 3: Next, split dataset into train and test set

data.splittraintest(testsize=0.2, shuffle=True, randomstate=100)

Step 4: Feature Scaling

data.Xtrain, scalerX = data.scale(data.Xtrain, scalingmethods=("standard", "minmax")) data.Xtest = scalerX.transform(data.X_test)

data.ytrain, scalery = data.encodelabel(data.ytrain) # This is for classification problem only data.ytest = scalery.transform(data.y_test)

Step 5: Fitting ELM-based model to the dataset

5.1: Use standard ELM model for regression problem

regressor = ElmRegressor(layersizes=(10, ), actname="relu", seed=42) regressor.fit(data.Xtrain, data.ytrain)

5.2: Use standard ELM model for classification problem

classifer = ElmClassifier(layersizes=(10, ), actname="tanh", seed=42) classifer.fit(data.Xtrain, data.ytrain)

5.3: Use Metaheuristic-based ELM model for regression problem

print(MhaElmClassifier.SUPPORTEDOPTIMIZERS) print(MhaElmClassifier.SUPPORTEDREGOBJECTIVES) optparas = {"name": "GA", "epoch": 10, "popsize": 30} regressor = MhaElmRegressor(layersizes=(10, ), actname="elu", objname="RMSE", optim="BaseGA", optimparams=optparas, seed=42, lb=None, ub=None, mode='single', nworkers=None, termination=None) regressor.fit(data.Xtrain, data.y_train)

5.4: Use Metaheuristic-based ELM model for classification problem

print(MhaElmClassifier.SUPPORTEDOPTIMIZERS) print(MhaElmClassifier.SUPPORTEDCLSOBJECTIVES) optparas = {"name": "GA", "epoch": 10, "popsize": 30} classifier = MhaElmClassifier(layersizes=(10, ), actname="elu", objname="KLDL", optim="BaseGA", optimparams=optparas, seed=42, lb=None, ub=None, mode='single', nworkers=None, termination=None) classifier.fit(data.Xtrain, data.y_train)

Step 6: Predicting a new result

ypred = regressor.predict(data.Xtest)

ypredcls = classifier.predict(data.Xtest) ypredlabel = scalery.inversetransform(ypred_cls)

Step 7: Calculate metrics using score or scores functions.

print("Try my AS metric with score function") print(regressor.score(data.Xtest, data.ytest, method="AS"))

print("Try my multiple metrics with scores function") print(classifier.scores(data.Xtest, data.ytest, list_methods=["AS", "PS", "F1S", "CEL", "BSL"]))

print("Try my evaluate functions") print(regressor.evaluate(data.ytest, ypred, list_metrics=("RMSE", "MAE", "MAPE", "NSE", "R2")))

Save results

regressor.savelosstrain(savepath="history", filename="losstrain.csv") regressor.savemetrics(data.ytest, ypred, listmetrics=("R2", "MAPE", "MAE", "MSE"), save_path="history", filename="metrics.csv") ```

A real-world dataset contains features that vary in magnitudes, units, and range. We would suggest performing normalization when the scale of a feature is irrelevant or misleading. Feature Scaling basically helps to normalize the data within a particular range.


❓ FAQ

1. How to list supported objective metrics?

Where do I find the supported metrics like above ["AS", "PS", "RS"]. What is that? You can find it here: https://github.com/thieu1995/permetrics or use this

```python from intelelm import MhaElmClassifier, MhaElmRegressor

print(MhaElmRegressor.SUPPORTEDREGOBJECTIVES) print(MhaElmClassifier.SUPPORTEDCLSOBJECTIVES) ```

2. ValueError: Existed at least one new label in y_pred?

I got this type of error python raise ValueError("Existed at least one new label in y_pred.") ValueError: Existed at least one new label in y_pred. How to solve this?

  • This occurs only when you are working on a classification problem with a small dataset that has many classes. For instance, the "Zoo" dataset contains only 101 samples, but it has 7 classes. If you split the dataset into a training and testing set with a ratio of around 80% - 20%, there is a chance that one or more classes may appear in the testing set but not in the training set. As a result, when you calculate the performance metrics, you may encounter this error. You cannot predict or assign new data to a new label because you have no knowledge about the new label. There are several solutions to this problem.

- 1st: Use SMOTE to rebalance the dataset:

Use the SMOTE method to address imbalanced data and ensure that all classes have the same number of samples.

```python import pandas as pd from imblearn.over_sampling import SMOTE from intelelm import Data

dataset = pd.readcsv('examples/dataset.csv', indexcol=0).values X, y = dataset[:, 0:-1], dataset[:, -1]

Xnew, ynew = SMOTE().fitresample(X, y) data = Data(Xnew, y_new) ```

  • 2st: Try changing random_state in splittraintest:

  • Use different randomstate numbers in splittrain_test() function.

```python import pandas as pd from intelelm import Data

dataset = pd.readcsv('examples/dataset.csv', indexcol=0).values X, y = dataset[:, 0:-1], dataset[:, -1] data = Data(X, y) data.splittraintest(testsize=0.2, randomstate=10) # Try different random_state value ```

3. Why don't MHA-based ELM models improve results?

When testing several algorithms based on Extreme Learning Machines (ELM), they all produce the same results. Even during the training process, the global best solution remains unchanged.

  • This issue was identified in version <= v1.0.2 when the default values for the lower bound (lb) and upper bound (ub) were set in the narrow range of (-1, 1). This limited range proved to be too small, causing all algorithms to converge to local optima. Fortunately, this problem has been addressed in versions > v1.0.3, where the default range has been extended to (-10., 10.). You also can define your own lb and ub ranges depend on your problem.
  • In traditional neural network like MLP, they weights (weights + biases) are typically initialized within the range of (-1., 1.). However, during training using gradient-based methods, these values are updated, and there are no strict bounds on them.
  • Meanwhile, in metaheuristic optimization, it's necessary to set boundaries for decision variables (weights) each time a new search agent is formed. Therefore, if you define a narrow range, your optimizer may converge more quickly, but it's more likely to get stuck in local optima (which explains why the global best value remains unchanged during training). Moreover, in some cases, there might not even be a global optimum within that narrow range. Conversely, if you set a wider range, the optimization process may be slower, and the global best value may change more gradually. In such cases, you might need to increase the number of epochs, perhaps up to 1000, for the optimizer to explore the solution space thoroughly.

```python from intelelm import MhaElmClassifier

optparas = {"name": "GA", "epoch": 30, "popsize": 30} model = MhaElmClassifier(layersizes=(10, ), actname="elu", objname="KLDL", optim="BaseGA", optimparams=optparas, verbose=True, seed=42, lb=-10., ub=10., mode='single', nworkers=None, termination=None) model.fit(Xtrain, ytrain) ypred = model.predict(Xtest) ```

🔗 Useful Links

🤝 Related Projects


Developed by: Thieu @ 2023

Owner

  • Name: Nguyen Van Thieu
  • Login: thieu1995
  • Kind: user
  • Location: Earth
  • Company: AIIR Group

Knowledge is power, sharing it is the premise of progress in life. It seems like a burden to someone, but it is the only way to achieve immortality.

Citation (CITATION.cff)

cff-version: 1.1.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: "Van Thieu"
    given-names: "Nguyen"
    orcid: "https://orcid.org/0000-0001-9994-8747"
title: "IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine"
version: 1.3.0
doi: 10.5281/zenodo.8249045
date-released: 2023-09-25
url: "https://github.com/thieu1995/IntelELM"

GitHub Events

Total
  • Watch event: 4
  • Member event: 1
  • Push event: 6
  • Fork event: 2
  • Create event: 1
Last Year
  • Watch event: 4
  • Member event: 1
  • Push event: 6
  • Fork event: 2
  • Create event: 1

Issues and Pull Requests

Last synced: 5 months ago

All Time
  • Total issues: 3
  • Total pull requests: 1
  • Average time to close issues: 26 days
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 3
  • Total pull request authors: 1
  • Average comments per issue: 2.67
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • OlutokiJohn (1)
  • syyd87 (1)
  • tangling123 (1)
Pull Request Authors
  • hungnd11 (1)
Top Labels
Issue Labels
enhancement (2) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 230 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 9
  • Total maintainers: 1
pypi.org: intelelm

IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 230 Last month
Rankings
Dependent packages count: 7.6%
Average: 38.6%
Dependent repos count: 69.6%
Maintainers (1)
Last synced: 5 months ago

Dependencies

.github/workflows/publish-package.yaml actions
  • actions/cache v1 composite
  • actions/checkout v1 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v1 composite
  • actions/upload-artifact master composite
  • pypa/gh-action-pypi-publish master composite
requirements.txt pypi
  • flake8 >=4.0.1
  • kaleido >=0.2.1
  • mealpy >=2.5.4
  • numpy >=1.17.1
  • pandas >=1.3.5
  • permetrics >=1.4.3
  • plotly >=5.10.0
  • pytest ==7.1.2
  • pytest-cov ==4.0.0
  • scikit-learn >=1.0.2
  • scipy >=1.7.1
setup.py pypi
  • numpy >=1.17.1
  • pandas >=1.3.5
  • plotly >=5.10.0
docs/requirements.txt pypi
  • mealpy >=3.0.1
  • numpy >=1.17.1
  • pandas >=1.3.5
  • permetrics >=2.0.0
  • readthedocs-sphinx-search ==0.1.1
  • scikit-learn >=1.2.1
  • scipy >=1.7.1
  • sphinx ==4.4.0
  • sphinx_rtd_theme ==1.0.0