# GrafoRVFL (GRAdient Free Optimized Random Vector Functional Link)
---
[![GitHub release](https://img.shields.io/badge/release-1.2.0-yellow.svg)](https://github.com/thieu1995/GrafoRVFL/releases)
[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/graforvfl)
[![PyPI version](https://badge.fury.io/py/graforvfl.svg)](https://badge.fury.io/py/graforvfl)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/graforvfl.svg)
![PyPI - Status](https://img.shields.io/pypi/status/graforvfl.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/graforvfl.svg)
[![Downloads](https://pepy.tech/badge/graforvfl)](https://pepy.tech/project/graforvfl)
[![Tests & Publishes to PyPI](https://github.com/thieu1995/graforvfl/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/graforvfl/actions/workflows/publish-package.yaml)
![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/graforvfl.svg)
[![Documentation Status](https://readthedocs.org/projects/graforvfl/badge/?version=latest)](https://graforvfl.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/graforvfl.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.10258280.svg)](https://doi.org/10.5281/zenodo.10258280)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
GrafoRVFL is an open-source library in Python that employs gradient-free optimization (GA, PSO, WOA, TLO, DE, ...) to
optimize Random Vector Functional Link Networks. It is entirely implemented based on Numpy and fully compatible
with the interfaces of the Scikit-Learn library. With GrafoRVFL, you can fine-tune the hyper-parameters of network in the network using gradient-free optimizers.
* **Free software:** GNU General Public License (GPL) V3 license
* **Documentation:** https://graforvfl.readthedocs.io
* **Provided Estimator**: `RvflRegressor`, `RvflClassifier`, `GfoRvflTuner`
* **Python versions:** >= 3.8.x
* **Dependencies:** numpy, scipy, scikit-learn, pandas, mealpy, permetrics
# Citation Request
* Learn more about Random Vector Functional Link from [this paper](https://doi.org/10.1016/j.ins.2015.09.025)
* Learn more about on how to use Gradient Free Optimization to fine-tune the hyper-parameter of RVFL networks from
[this paper](https://doi.org/10.1016/j.neucom.2018.07.080)
Please include these citations if you plan to use this library:
```bibtex
@software{nguyen_van_thieu_2023_10258280,
author = {Nguyen Van Thieu},
title = {GrafoRVFL: A Gradient-Free Optimization Framework for Boosting Random Vector Functional Link Network},
month = dec,
year = 2023,
publisher = {Zenodo},
doi = {10.5281/zenodo.10258280},
url = {https://github.com/thieu1995/GrafoRVFL}
}
@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}
}
@inproceedings{nguyen2019building,
title={Building resource auto-scaler with functional-link neural network and adaptive bacterial foraging optimization},
author={Nguyen, Thieu and Nguyen, Binh Minh and Nguyen, Giang},
booktitle={International Conference on Theory and Applications of Models of Computation},
pages={501--517},
year={2019},
organization={Springer}
}
@inproceedings{nguyen2018resource,
title={A resource usage prediction system using functional-link and genetic algorithm neural network for multivariate cloud metrics},
author={Nguyen, Thieu and Tran, Nhuan and Nguyen, Binh Minh and Nguyen, Giang},
booktitle={2018 IEEE 11th conference on service-oriented computing and applications (SOCA)},
pages={49--56},
year={2018},
organization={IEEE},
doi={10.1109/SOCA.2018.00014}
}
```
# Installation
* Install the [current PyPI release](https://pypi.python.org/pypi/graforvfl):
```sh
$ pip install graforvfl
```
After installation, you can check the installed version by:
```sh
$ python
>>> import graforvfl
>>> graforvfl.__version__
```
# Example
Below is the example code of how to use Gradient Free Optimization to tune hyper-parameter of RVFL network.
The more complicated cases in the folder: [examples](/examples). You can also read the [documentation](https://graforvfl.readthedocs.io/)
for more detailed installation instructions, explanations, and examples.
```python
from sklearn.datasets import load_breast_cancer
from mealpy import StringVar, IntegerVar
from graforvfl import Data, GfoRvflTuner
## Load data object
X, y = load_breast_cancer(return_X_y=True)
data = Data(X, y)
## Split train and test
data.split_train_test(test_size=0.2, random_state=2, inplace=True)
print(data.X_train.shape, data.X_test.shape)
## Scaling dataset
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)
data.y_test = scaler_y.transform(data.y_test)
# Design the boundary (parameters)
my_bounds = [
IntegerVar(lb=2, ub=1000, name="size_hidden"),
StringVar(valid_sets=("none", "relu", "leaky_relu", "celu", "prelu", "gelu",
"elu", "selu", "rrelu", "tanh", "sigmoid"), name="act_name"),
StringVar(valid_sets=("orthogonal", "he_uniform", "he_normal", "glorot_uniform", "glorot_normal",
"lecun_uniform", "lecun_normal", "random_uniform", "random_normal"), name="weight_initializer")
]
opt_paras = {"name": "WOA", "epoch": 10, "pop_size": 20}
model = GfoRvflTuner(problem_type="classification", bounds=my_bounds, cv=3, scoring="AS",
optimizer="OriginalWOA", optimizer_paras=opt_paras, verbose=True, seed=42)
model.fit(data.X_train, data.y_train)
print(model.best_params)
print(model.best_estimator)
print(model.best_estimator.scores(data.X_test, data.y_test, list_metrics=("PS", "RS", "NPV", "F1S", "F2S")))
```
# Official channels
* [Official source code repository](https://github.com/thieu1995/GrafoRVFL)
* [Official document](https://graforvfl.readthedocs.io/)
* [Download releases](https://pypi.org/project/graforvfl/)
* [Issue tracker](https://github.com/thieu1995/GrafoRVFL/issues)
* [Notable changes log](/ChangeLog.md)
* [Official discussion group](https://t.me/+fRVCJGuGJg1mNDg1)
---
Developed by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=GrafoRVFL_QUESTIONS) @ 2023
Raw data
{
"_id": null,
"home_page": "https://github.com/thieu1995/GrafoRVFL",
"name": "graforvfl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "random vector functional link, machine learning, artificial intelligence, deep learning, neural networks, single hidden layer network, random projection, RVFL, feed-forward neural network, artificial neural network, classification, regression, supervised learning, online learning, generalization, optimization algorithms, Kernel RVFL, 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, pearson correlation coefficient (PCC), spearman correlation coefficient (SCC), Global optimization, Convergence analysis, Search space exploration, Local search, Computational intelligence, Robust optimization, metaheuristic, metaheuristic algorithms, nature-inspired computing, nature-inspired algorithms, swarm-based computation, metaheuristic-based RVFL, gradient-free optimizationgradient-free optimized RVFL, metaheuristic-optimized RVFL, Performance analysis, Intelligent optimization, Simulations",
"author": "Thieu",
"author_email": "nguyenthieu2102@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1d/b3/17f7f6215033d5ed407a136c544ea1242148b9cbe61e10f4e325de0a4b3f/graforvfl-1.2.0.tar.gz",
"platform": null,
"description": "\n# GrafoRVFL (GRAdient Free Optimized Random Vector Functional Link)\n\n---\n\n[![GitHub release](https://img.shields.io/badge/release-1.2.0-yellow.svg)](https://github.com/thieu1995/GrafoRVFL/releases)\n[![Wheel](https://img.shields.io/pypi/wheel/gensim.svg)](https://pypi.python.org/pypi/graforvfl) \n[![PyPI version](https://badge.fury.io/py/graforvfl.svg)](https://badge.fury.io/py/graforvfl)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/graforvfl.svg)\n![PyPI - Status](https://img.shields.io/pypi/status/graforvfl.svg)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/graforvfl.svg)\n[![Downloads](https://pepy.tech/badge/graforvfl)](https://pepy.tech/project/graforvfl)\n[![Tests & Publishes to PyPI](https://github.com/thieu1995/graforvfl/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/graforvfl/actions/workflows/publish-package.yaml)\n![GitHub Release Date](https://img.shields.io/github/release-date/thieu1995/graforvfl.svg)\n[![Documentation Status](https://readthedocs.org/projects/graforvfl/badge/?version=latest)](https://graforvfl.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/graforvfl.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.10258280.svg)](https://doi.org/10.5281/zenodo.10258280)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n\nGrafoRVFL is an open-source library in Python that employs gradient-free optimization (GA, PSO, WOA, TLO, DE, ...) to \noptimize Random Vector Functional Link Networks. It is entirely implemented based on Numpy and fully compatible \nwith the interfaces of the Scikit-Learn library. With GrafoRVFL, you can fine-tune the hyper-parameters of network in the network using gradient-free optimizers.\n\n\n* **Free software:** GNU General Public License (GPL) V3 license\n* **Documentation:** https://graforvfl.readthedocs.io\n* **Provided Estimator**: `RvflRegressor`, `RvflClassifier`, `GfoRvflTuner`\n* **Python versions:** >= 3.8.x\n* **Dependencies:** numpy, scipy, scikit-learn, pandas, mealpy, permetrics\n\n\n# Citation Request \n\n* Learn more about Random Vector Functional Link from [this paper](https://doi.org/10.1016/j.ins.2015.09.025)\n\n* Learn more about on how to use Gradient Free Optimization to fine-tune the hyper-parameter of RVFL networks from \n[this paper](https://doi.org/10.1016/j.neucom.2018.07.080)\n\n\nPlease include these citations if you plan to use this library:\n\n```bibtex\n\n@software{nguyen_van_thieu_2023_10258280,\n author = {Nguyen Van Thieu},\n title = {GrafoRVFL: A Gradient-Free Optimization Framework for Boosting Random Vector Functional Link Network},\n month = dec,\n year = 2023,\n publisher = {Zenodo},\n doi = {10.5281/zenodo.10258280},\n url = {https://github.com/thieu1995/GrafoRVFL}\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@inproceedings{nguyen2019building,\n title={Building resource auto-scaler with functional-link neural network and adaptive bacterial foraging optimization},\n author={Nguyen, Thieu and Nguyen, Binh Minh and Nguyen, Giang},\n booktitle={International Conference on Theory and Applications of Models of Computation},\n pages={501--517},\n year={2019},\n organization={Springer}\n}\n\n@inproceedings{nguyen2018resource,\n title={A resource usage prediction system using functional-link and genetic algorithm neural network for multivariate cloud metrics},\n author={Nguyen, Thieu and Tran, Nhuan and Nguyen, Binh Minh and Nguyen, Giang},\n booktitle={2018 IEEE 11th conference on service-oriented computing and applications (SOCA)},\n pages={49--56},\n year={2018},\n organization={IEEE},\n doi={10.1109/SOCA.2018.00014}\n}\n\n```\n\n# Installation\n\n* Install the [current PyPI release](https://pypi.python.org/pypi/graforvfl):\n```sh \n$ pip install graforvfl\n```\n\nAfter installation, you can check the installed version by:\n\n```sh\n$ python\n>>> import graforvfl\n>>> graforvfl.__version__\n```\n\n# Example\n\nBelow is the example code of how to use Gradient Free Optimization to tune hyper-parameter of RVFL network.\nThe more complicated cases in the folder: [examples](/examples). You can also read the [documentation](https://graforvfl.readthedocs.io/) \nfor more detailed installation instructions, explanations, and examples.\n\n```python\nfrom sklearn.datasets import load_breast_cancer\nfrom mealpy import StringVar, IntegerVar\nfrom graforvfl import Data, GfoRvflTuner\n\n## Load data object\nX, y = load_breast_cancer(return_X_y=True)\ndata = Data(X, y)\n\n## Split train and test\ndata.split_train_test(test_size=0.2, random_state=2, inplace=True)\nprint(data.X_train.shape, data.X_test.shape)\n\n## Scaling dataset\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)\ndata.y_test = scaler_y.transform(data.y_test)\n\n# Design the boundary (parameters)\nmy_bounds = [\n IntegerVar(lb=2, ub=1000, name=\"size_hidden\"),\n StringVar(valid_sets=(\"none\", \"relu\", \"leaky_relu\", \"celu\", \"prelu\", \"gelu\",\n \"elu\", \"selu\", \"rrelu\", \"tanh\", \"sigmoid\"), name=\"act_name\"),\n StringVar(valid_sets=(\"orthogonal\", \"he_uniform\", \"he_normal\", \"glorot_uniform\", \"glorot_normal\",\n \"lecun_uniform\", \"lecun_normal\", \"random_uniform\", \"random_normal\"), name=\"weight_initializer\")\n]\n\nopt_paras = {\"name\": \"WOA\", \"epoch\": 10, \"pop_size\": 20}\nmodel = GfoRvflTuner(problem_type=\"classification\", bounds=my_bounds, cv=3, scoring=\"AS\",\n optimizer=\"OriginalWOA\", optimizer_paras=opt_paras, verbose=True, seed=42)\nmodel.fit(data.X_train, data.y_train)\nprint(model.best_params)\nprint(model.best_estimator)\nprint(model.best_estimator.scores(data.X_test, data.y_test, list_metrics=(\"PS\", \"RS\", \"NPV\", \"F1S\", \"F2S\")))\n```\n\n# Official channels \n\n* [Official source code repository](https://github.com/thieu1995/GrafoRVFL)\n* [Official document](https://graforvfl.readthedocs.io/)\n* [Download releases](https://pypi.org/project/graforvfl/) \n* [Issue tracker](https://github.com/thieu1995/GrafoRVFL/issues) \n* [Notable changes log](/ChangeLog.md)\n* [Official discussion group](https://t.me/+fRVCJGuGJg1mNDg1)\n\n---\n\nDeveloped by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=GrafoRVFL_QUESTIONS) @ 2023\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "GrafoRVFL: A Gradient-Free Optimization Framework for Boosting Random Vector Functional Link Network",
"version": "1.2.0",
"project_urls": {
"Bug Tracker": "https://github.com/thieu1995/GrafoRVFL/issues",
"Change Log": "https://github.com/thieu1995/GrafoRVFL/blob/main/ChangeLog.md",
"Documentation": "https://graforvfl.readthedocs.io/",
"Forum": "https://t.me/+fRVCJGuGJg1mNDg1",
"Homepage": "https://github.com/thieu1995/GrafoRVFL",
"Source Code": "https://github.com/thieu1995/GrafoRVFL"
},
"split_keywords": [
"random vector functional link",
" machine learning",
" artificial intelligence",
" deep learning",
" neural networks",
" single hidden layer network",
" random projection",
" rvfl",
" feed-forward neural network",
" artificial neural network",
" classification",
" regression",
" supervised learning",
" online learning",
" generalization",
" optimization algorithms",
" kernel rvfl",
" 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",
" pearson correlation coefficient (pcc)",
" spearman correlation coefficient (scc)",
" global optimization",
" convergence analysis",
" search space exploration",
" local search",
" computational intelligence",
" robust optimization",
" metaheuristic",
" metaheuristic algorithms",
" nature-inspired computing",
" nature-inspired algorithms",
" swarm-based computation",
" metaheuristic-based rvfl",
" gradient-free optimizationgradient-free optimized rvfl",
" metaheuristic-optimized rvfl",
" performance analysis",
" intelligent optimization",
" simulations"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b6cdecb15832cf87137dd90e5db9362fe18addd9a39fd5c5f3591006b9a39ffc",
"md5": "34d4b343e0a02fbd93ab6e41ade00486",
"sha256": "cc27a62b14e47ea041131175f53a43cf92ac700e5e7ba3c00f01a1683dc0da46"
},
"downloads": -1,
"filename": "graforvfl-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "34d4b343e0a02fbd93ab6e41ade00486",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 37540,
"upload_time": "2024-11-13T01:53:30",
"upload_time_iso_8601": "2024-11-13T01:53:30.793089Z",
"url": "https://files.pythonhosted.org/packages/b6/cd/ecb15832cf87137dd90e5db9362fe18addd9a39fd5c5f3591006b9a39ffc/graforvfl-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1db317f7f6215033d5ed407a136c544ea1242148b9cbe61e10f4e325de0a4b3f",
"md5": "e8cd5d2840dcd636c187c3db61d31734",
"sha256": "8f8d89826b939c8edbdcc04cf9581a1f7b95a89d5a8e0f3d2c7dde91303c9b96"
},
"downloads": -1,
"filename": "graforvfl-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "e8cd5d2840dcd636c187c3db61d31734",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 37810,
"upload_time": "2024-11-13T01:53:32",
"upload_time_iso_8601": "2024-11-13T01:53:32.483400Z",
"url": "https://files.pythonhosted.org/packages/1d/b3/17f7f6215033d5ed407a136c544ea1242148b9cbe61e10f4e325de0a4b3f/graforvfl-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 01:53:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "thieu1995",
"github_project": "GrafoRVFL",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "graforvfl"
}