intelelm


Nameintelelm JSON
Version 1.1.1 PyPI version JSON
download
home_pagehttps://github.com/thieu1995/intelelm
SummaryIntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine
upload_time2024-03-27 11:51:12
maintainerNone
docs_urlNone
authorThieu
requires_python>=3.8
licenseGPLv3
keywords extreme learning machine machine learning artificial intelligence deep learning neural networks single hidden layer network metaheuristic-based elmrandom projection kernel methods feature extraction classification regression supervised learning optimization algorithms kernel elm cross-validationgenetic algorithm (ga) particle swarm optimization (pso) ant colony optimization (aco) differential evolution (de) simulated annealing grey wolf optimizer (gwo) whale optimization algorithm (woa) confusion matrix recall precision accuracy k-nearest neighbors random forest support vector machine scikit-learn models estimator robust machine learning shallow neural network nature-inspired elm elm network convergence analysis search space exploration local search computational intelligence robust optimization performance analysis intelligent optimization simulations
VCS
bugtrack_url
requirements numpy scipy scikit-learn pandas mealpy permetrics pytest pytest-cov flake8
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<p align="center">
<img style="max-width:100%;" src="https://thieu1995.github.io/post/2023-08/intelelm.png" alt="IntelELM"/>
</p>

---

[![GitHub release](https://img.shields.io/badge/release-1.1.1-yellow.svg)](https://github.com/thieu1995/intelelm/releases)
[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/intelelm) 
[![PyPI version](https://badge.fury.io/py/intelelm.svg)](https://badge.fury.io/py/intelelm)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/intelelm.svg)
![PyPI - Status](https://img.shields.io/pypi/status/intelelm.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/intelelm.svg)
[![Downloads](https://static.pepy.tech/badge/intelelm)](https://pepy.tech/project/intelelm)
[![Tests & Publishes to PyPI](https://github.com/thieu1995/intelelm/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/intelelm/actions/workflows/publish-package.yaml)
![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/intelelm.svg)
[![Documentation Status](https://readthedocs.org/projects/intelelm/badge/?version=latest)](https://intelelm.readthedocs.io/en/latest/?badge=latest)
[![Chat](https://img.shields.io/badge/Chat-on%20Telegram-blue)](https://t.me/+fRVCJGuGJg1mNDg1)
![GitHub contributors](https://img.shields.io/github/contributors/thieu1995/intelelm.svg)
[![GitTutorial](https://img.shields.io/badge/PR-Welcome-%23FF8300.svg?)](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8249045.svg)](https://doi.org/10.5281/zenodo.8249045)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)


IntelELM (Intelligent Metaheuristic-based Extreme Learning Machine) is a Python library that implements a framework 
for training Extreme Learning Machine (ELM) networks using Metaheuristic Algorithms. It provides a comparable 
alternative to the traditional ELM network and is compatible with the Scikit-Learn library. With IntelELM, you can 
perform searches and hyperparameter tuning using the functionalities provided by the Scikit-Learn library.

* **Free software:** GNU General Public License (GPL) V3 license
* **Provided Estimator**: ElmRegressor, ElmClassifier, MhaElmRegressor, MhaElmClassifier
* **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/en/latest/
* **Python versions:** >= 3.7.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](https://doi.org/10.1016/j.procs.2020.03.063)


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

```code
@software{nguyen_van_thieu_2023_8249046,
  author       = {Nguyen Van Thieu},
  title        = {IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine},
  month        = aug,
  year         = 2023,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.8249045},
  url          = {https://github.com/thieu1995/IntelELM}
}

@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

* Install the [current PyPI release](https://pypi.python.org/pypi/intelelm):
```sh 
$ pip install intelelm
```

After installation, you can check the version of current installed IntelELM by:

```sh
$ python
>>> import intelelm
>>> intelelm.__version__
```

### Tutorials

* Tutorials can be found inside [tutorials](./tutorials) directory.
  * [Building a handwritten digits classifier using IntelELM](./tutorials/example_hand_written_digits.ipynb)
  * [Building a house price predictor using IntelELM](./tutorials/example_california_housing.ipynb)

### Examples

* 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.split_train_test(test_size=0.2, shuffle=True, random_state=100)

#### Step 4: Feature Scaling
data.X_train, scaler_X = data.scale(data.X_train, scaling_methods=("standard", "minmax"))
data.X_test = scaler_X.transform(data.X_test)

data.y_train, scaler_y = data.encode_label(data.y_train)   # This is for classification problem only
data.y_test = scaler_y.transform(data.y_test)

#### Step 5: Fitting ELM-based model to the dataset

##### 5.1: Use standard ELM model for regression problem
regressor = ElmRegressor(hidden_size=10, act_name="relu", seed=42)
regressor.fit(data.X_train, data.y_train)

##### 5.2: Use standard ELM model for classification problem 
classifer = ElmClassifier(hidden_size=10, act_name="tanh", seed=42)
classifer.fit(data.X_train, data.y_train)

##### 5.3: Use Metaheuristic-based ELM model for regression problem
print(MhaElmClassifier.SUPPORTED_OPTIMIZERS)
print(MhaElmClassifier.SUPPORTED_REG_OBJECTIVES)
opt_paras = {"name": "GA", "epoch": 10, "pop_size": 30}
regressor = MhaElmRegressor(hidden_size=10, act_name="elu", obj_name="RMSE", 
                            optimizer="BaseGA", optimizer_paras=opt_paras, seed=42)
regressor.fit(data.X_train, data.y_train)

##### 5.4: Use Metaheuristic-based ELM model for classification problem
print(MhaElmClassifier.SUPPORTED_OPTIMIZERS)
print(MhaElmClassifier.SUPPORTED_CLS_OBJECTIVES)
opt_paras = {"name": "GA", "epoch": 10, "pop_size": 30}
classifier = MhaElmClassifier(hidden_size=10, act_name="elu", obj_name="KLDL", 
                              optimizer="BaseGA", optimizer_paras=opt_paras, seed=42)
classifier.fit(data.X_train, data.y_train)

#### Step 6: Predicting a new result
y_pred = regressor.predict(data.X_test)

y_pred_cls = classifier.predict(data.X_test)
y_pred_label = scaler_y.inverse_transform(y_pred_cls)

#### Step 7: Calculate metrics using score or scores functions.
print("Try my AS metric with score function")
print(regressor.score(data.X_test, data.y_test, method="AS"))

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

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

#### Save results
regressor.save_loss_train(save_path="history", filename="loss_train.csv")
regressor.save_metrics(data.y_test, y_pred, list_metrics=("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.


1) 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.SUPPORTED_REG_OBJECTIVES)
print(MhaElmClassifier.SUPPORTED_CLS_OBJECTIVES)
```

2) 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 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.read_csv('examples/dataset.csv', index_col=0).values
X, y = dataset[:, 0:-1], dataset[:, -1]

X_new, y_new = SMOTE().fit_resample(X, y)
data = Data(X_new, y_new)
```

+ 2nd: Use different random_state numbers in split_train_test() function.

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

dataset = pd.read_csv('examples/dataset.csv', index_col=0).values
X, y = dataset[:, 0:-1], dataset[:, -1]
data = Data(X, y)
data.split_train_test(test_size=0.2, random_state=10)  # Try different random_state value 
```

3) **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
opt_paras = {"name": "GA", "epoch": 30, "pop_size": 30}
model = MhaElmClassifier(hidden_size=10, act_name="elu", obj_name="KLDL", optimizer="BaseGA", 
                         optimizer_paras=opt_paras, verbose=True, seed=42)
model.fit(X_train, y_train, lb=(-10., ), ub=(10., ))
y_pred = model.predict(X_test)
```

# Support (questions, problems)

### Official Links 

* Official source code repo: https://github.com/thieu1995/intelelm
* Official document: https://intelelm.readthedocs.io/
* Download releases: https://pypi.org/project/intelelm/
* Issue tracker: https://github.com/thieu1995/intelelm/issues
* Notable changes log: https://github.com/thieu1995/intelelm/blob/master/ChangeLog.md
* Official chat group: https://t.me/+fRVCJGuGJg1mNDg1

* This project also related to our another projects which are "optimization" and "machine learning", check it here:
    * https://github.com/thieu1995/mealpy
    * https://github.com/thieu1995/metaheuristics
    * https://github.com/thieu1995/opfunu
    * https://github.com/thieu1995/enoppy
    * https://github.com/thieu1995/permetrics
    * https://github.com/thieu1995/MetaCluster
    * https://github.com/thieu1995/pfevaluator
    * https://github.com/aiir-team

### Related Documents

1. https://analyticsindiamag.com/a-beginners-guide-to-extreme-learning-machine/
2. https://medium.datadriveninvestor.com/extreme-learning-machine-for-simple-classification-e776ad797a3c
3. https://www.extreme-learning-machines.org/
4. https://web.njit.edu/~usman/courses/cs675_fall20/ELM-NC-2006.pdf
5. https://m-clark.github.io/models-by-example/elm.html
6. https://github.com/ivallesp/simplestELM
7. https://www.javatpoint.com/elm-in-machine-learning

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thieu1995/intelelm",
    "name": "intelelm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "extreme learning machine, machine learning, artificial intelligence, deep learning, neural networks, single hidden layer network, metaheuristic-based ELMrandom projection, kernel methods, feature extraction, classification, regression, supervised learning, optimization algorithms, Kernel ELM, Cross-validationGenetic algorithm (GA), Particle swarm optimization (PSO), Ant colony optimization (ACO), Differential evolution (DE), Simulated annealing, Grey wolf optimizer (GWO), Whale Optimization Algorithm (WOA), confusion matrix, recall, precision, accuracy, K-Nearest Neighbors, random forest, support vector machine, scikit-learn models, estimator, Robust machine learning, shallow neural network, nature-inspired ELM, ELM network, Convergence analysis, Search space exploration, Local search, Computational intelligence, Robust optimization, Performance analysis, Intelligent optimization, Simulations",
    "author": "Thieu",
    "author_email": "nguyenthieu2102@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/d6/77bbbff0bc747854044473fcc97f34bdc85cecdc7b5e2123d003f4b68bd2/intelelm-1.1.1.tar.gz",
    "platform": null,
    "description": "\n<p align=\"center\">\n<img style=\"max-width:100%;\" src=\"https://thieu1995.github.io/post/2023-08/intelelm.png\" alt=\"IntelELM\"/>\n</p>\n\n---\n\n[![GitHub release](https://img.shields.io/badge/release-1.1.1-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 - Status](https://img.shields.io/pypi/status/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 & Publishes to PyPI](https://github.com/thieu1995/intelelm/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/intelelm/actions/workflows/publish-package.yaml)\n![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/intelelm.svg)\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![GitHub contributors](https://img.shields.io/github/contributors/thieu1995/intelelm.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/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\nIntelELM (Intelligent Metaheuristic-based Extreme Learning Machine) is a Python library that implements a framework \nfor training Extreme Learning Machine (ELM) networks using Metaheuristic Algorithms. It provides a comparable \nalternative to the traditional ELM network and is compatible with the Scikit-Learn library. With IntelELM, you can \nperform searches and hyperparameter tuning using the functionalities provided by the Scikit-Learn library.\n\n* **Free software:** GNU General Public License (GPL) V3 license\n* **Provided Estimator**: ElmRegressor, ElmClassifier, MhaElmRegressor, MhaElmClassifier\n* **Total Optimization-based ELM Regression**: > 200 Models \n* **Total Optimization-based ELM Classification**: > 200 Models\n* **Supported datasets**: 54 (47 classifications and 7 regressions)\n* **Supported performance metrics**: >= 67 (47 regressions and 20 classifications)\n* **Supported objective functions (as fitness functions or loss functions)**: >= 67 (47 regressions and 20 classifications)\n* **Documentation:** https://intelelm.readthedocs.io/en/latest/\n* **Python versions:** >= 3.7.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```code\n@software{nguyen_van_thieu_2023_8249046,\n  author       = {Nguyen Van Thieu},\n  title        = {IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine},\n  month        = aug,\n  year         = 2023,\n  publisher    = {Zenodo},\n  doi          = {10.5281/zenodo.8249045},\n  url          = {https://github.com/thieu1995/IntelELM}\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* Install the [current PyPI release](https://pypi.python.org/pypi/intelelm):\n```sh \n$ pip install intelelm\n```\n\nAfter installation, you can check the version of current installed IntelELM by:\n\n```sh\n$ python\n>>> import intelelm\n>>> intelelm.__version__\n```\n\n### Tutorials\n\n* Tutorials can be found inside [tutorials](./tutorials) directory.\n  * [Building a handwritten digits classifier using IntelELM](./tutorials/example_hand_written_digits.ipynb)\n  * [Building a house price predictor using IntelELM](./tutorials/example_california_housing.ipynb)\n\n### Examples\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(hidden_size=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(hidden_size=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(hidden_size=10, act_name=\"elu\", obj_name=\"RMSE\", \n                            optimizer=\"BaseGA\", optimizer_paras=opt_paras, seed=42)\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(hidden_size=10, act_name=\"elu\", obj_name=\"KLDL\", \n                              optimizer=\"BaseGA\", optimizer_paras=opt_paras, seed=42)\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\n1) Where 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\n2) I 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 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+ 2nd: 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\n3) **When 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+ This issue was identified in version <= 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 > 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\nopt_paras = {\"name\": \"GA\", \"epoch\": 30, \"pop_size\": 30}\nmodel = MhaElmClassifier(hidden_size=10, act_name=\"elu\", obj_name=\"KLDL\", optimizer=\"BaseGA\", \n                         optimizer_paras=opt_paras, verbose=True, seed=42)\nmodel.fit(X_train, y_train, lb=(-10., ), ub=(10., ))\ny_pred = model.predict(X_test)\n```\n\n# Support (questions, problems)\n\n### Official Links \n\n* Official source code repo: https://github.com/thieu1995/intelelm\n* Official document: https://intelelm.readthedocs.io/\n* Download releases: https://pypi.org/project/intelelm/\n* Issue tracker: https://github.com/thieu1995/intelelm/issues\n* Notable changes log: https://github.com/thieu1995/intelelm/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/mealpy\n    * https://github.com/thieu1995/metaheuristics\n    * https://github.com/thieu1995/opfunu\n    * https://github.com/thieu1995/enoppy\n    * https://github.com/thieu1995/permetrics\n    * https://github.com/thieu1995/MetaCluster\n    * https://github.com/thieu1995/pfevaluator\n    * https://github.com/aiir-team\n\n### Related Documents\n\n1. https://analyticsindiamag.com/a-beginners-guide-to-extreme-learning-machine/\n2. https://medium.datadriveninvestor.com/extreme-learning-machine-for-simple-classification-e776ad797a3c\n3. https://www.extreme-learning-machines.org/\n4. https://web.njit.edu/~usman/courses/cs675_fall20/ELM-NC-2006.pdf\n5. https://m-clark.github.io/models-by-example/elm.html\n6. https://github.com/ivallesp/simplestELM\n7. https://www.javatpoint.com/elm-in-machine-learning\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "IntelELM: A Python Framework for Intelligent Metaheuristic-based Extreme Learning Machine",
    "version": "1.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/thieu1995/intelelm/issues",
        "Change Log": "https://github.com/thieu1995/intelelm/blob/master/ChangeLog.md",
        "Documentation": "https://intelelm.readthedocs.io/",
        "Forum": "https://t.me/+fRVCJGuGJg1mNDg1",
        "Homepage": "https://github.com/thieu1995/intelelm",
        "Source Code": "https://github.com/thieu1995/intelelm"
    },
    "split_keywords": [
        "extreme learning machine",
        " machine learning",
        " artificial intelligence",
        " deep learning",
        " neural networks",
        " single hidden layer network",
        " metaheuristic-based elmrandom projection",
        " kernel methods",
        " feature extraction",
        " classification",
        " regression",
        " supervised learning",
        " optimization algorithms",
        " kernel elm",
        " cross-validationgenetic algorithm (ga)",
        " particle swarm optimization (pso)",
        " ant colony optimization (aco)",
        " differential evolution (de)",
        " simulated annealing",
        " grey wolf optimizer (gwo)",
        " whale optimization algorithm (woa)",
        " confusion matrix",
        " recall",
        " precision",
        " accuracy",
        " k-nearest neighbors",
        " random forest",
        " support vector machine",
        " scikit-learn models",
        " estimator",
        " robust machine learning",
        " shallow neural network",
        " nature-inspired elm",
        " elm network",
        " convergence analysis",
        " search space exploration",
        " local search",
        " computational intelligence",
        " robust optimization",
        " performance analysis",
        " intelligent optimization",
        " simulations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5d10c2fa1b3dbdeb2565c0157a35af274993f660a47337a1feb09d34b95e165a",
                "md5": "91349cdd9db75c0334cf38012a2eb904",
                "sha256": "d2fe44c832e8febb3a9c6fe84c5dcba3b61157033a7ae0ca81f0186781786390"
            },
            "downloads": -1,
            "filename": "intelelm-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "91349cdd9db75c0334cf38012a2eb904",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4198181,
            "upload_time": "2024-03-27T11:51:10",
            "upload_time_iso_8601": "2024-03-27T11:51:10.853569Z",
            "url": "https://files.pythonhosted.org/packages/5d/10/c2fa1b3dbdeb2565c0157a35af274993f660a47337a1feb09d34b95e165a/intelelm-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7d677bbbff0bc747854044473fcc97f34bdc85cecdc7b5e2123d003f4b68bd2",
                "md5": "1b4c92c4f11a4eaf5a7289e4aa71e8b4",
                "sha256": "b7fd85a0fe29173ccb528dcb91459ee4b5c6ae4cc677b240532d2791fb59f0ed"
            },
            "downloads": -1,
            "filename": "intelelm-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1b4c92c4f11a4eaf5a7289e4aa71e8b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4111203,
            "upload_time": "2024-03-27T11:51:12",
            "upload_time_iso_8601": "2024-03-27T11:51:12.427470Z",
            "url": "https://files.pythonhosted.org/packages/b7/d6/77bbbff0bc747854044473fcc97f34bdc85cecdc7b5e2123d003f4b68bd2/intelelm-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-27 11:51:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thieu1995",
    "github_project": "intelelm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.17.1"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.7.1"
                ]
            ]
        },
        {
            "name": "scikit-learn",
            "specs": [
                [
                    ">=",
                    "1.2.1"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.3.5"
                ]
            ]
        },
        {
            "name": "mealpy",
            "specs": [
                [
                    ">=",
                    "3.0.1"
                ]
            ]
        },
        {
            "name": "permetrics",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "7.1.2"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    "==",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "4.0.1"
                ]
            ]
        }
    ],
    "lcname": "intelelm"
}
        
Elapsed time: 0.25348s