Skip to main content

GrafoRVFL: A Gradient-Free Optimization Framework for Boosting Random Vector Functional Link Network

Project description

GrafoRVFL (GRAdient Free Optimized Random Vector Functional Link)


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

📑 Overview

GrafoRVFL is an open-source Python library designed to optimize Random Vector Functional Link (RVFL) networks using various gradient-free metaheuristic algorithms such as GA, PSO, WOA, TLO, DE, etc. It is fully implemented in NumPy and seamlessly integrates with the Scikit-Learn interface, making it easy to plug into standard ML workflows. GrafoRVFL enables hyperparameter tuning for RVFL networks without relying on gradient-based methods.

✨ Features

  • ✅ Free software under GNU GPL v3
  • 📘 Full documentation: https://graforvfl.readthedocs.io
  • 🧠 Estimators:
    • RvflRegressor
    • RvflClassifier
    • GfoRvflCV
    • GfoRvflTuner
    • GfoRvflComparator
  • 🐍 Python compatibility: >= 3.8
  • 🧩 Dependencies:
    • numpy, scipy, scikit-learn, pandas, mealpy, permetrics, matplotlib

📖 Citation Request

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

@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        = June,
  year         = 2025,
  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}
}
  • Learn more about Random Vector Functional Link from this paper

  • Learn more about on how to use Gradient Free Optimization to fine-tune the hyper-parameter of RVFL networks from this paper

🔧 Installation

Install the latest version from PyPI:

$ pip install graforvfl

Verify installation:

$ python
>>> import graforvfl
>>> graforvfl.__version__

🧪 Example Usage

Below is a simple example code of how to use Gradient Free Optimization to tune hyper-parameter of RVFL network.

from sklearn.datasets import load_breast_cancer
from graforvfl import Data, GfoRvflCV, StringVar, IntegerVar, FloatVar


## 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=3, ub=50, name="size_hidden"),
    StringVar(valid_sets=("none", "relu", "leaky_relu", "celu", "prelu", "gelu", "elu",
                          "selu", "rrelu", "tanh", "hard_tanh", "sigmoid", "hard_sigmoid",
                          "log_sigmoid", "silu", "swish", "hard_swish", "soft_plus", "mish",
                          "soft_sign", "tanh_shrink", "soft_shrink", "hard_shrink",
                          "softmin", "softmax", "log_softmax"), 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"),
    FloatVar(lb=0, ub=10., name="reg_alpha"),
]

model = GfoRvflCV(problem_type="classification", bounds=my_bounds,
                  optim="OriginalWOA", optim_params={"name": "WOA", "epoch": 10, "pop_size": 20},
                  scoring="AS", cv=3, seed=42, verbose=True)
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")))

👉 The more complicated cases in the folder: examples. You can also read the documentation for more detailed installation instructions, explanations, and examples.

📎 Official channels


Developed by: Thieu @ 2025

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graforvfl-2.2.0.tar.gz (51.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graforvfl-2.2.0-py3-none-any.whl (49.1 kB view details)

Uploaded Python 3

File details

Details for the file graforvfl-2.2.0.tar.gz.

File metadata

  • Download URL: graforvfl-2.2.0.tar.gz
  • Upload date:
  • Size: 51.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for graforvfl-2.2.0.tar.gz
Algorithm Hash digest
SHA256 f001c3035f9c7993642f9ca2a323232d55844df1b530b2da4ec36af16ea41753
MD5 83acd69c9ae1ac35a8490b528b5a11e5
BLAKE2b-256 14a0c9d33d88236a9ca9326727fc79b974006aeb82091a1276a7f206adb02724

See more details on using hashes here.

Provenance

The following attestation bundles were made for graforvfl-2.2.0.tar.gz:

Publisher: publish-package.yml on thieu1995/GrafoRVFL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graforvfl-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: graforvfl-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for graforvfl-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d0904dd1b2fbd27ee8f4b1e3410265050dbfe713a3e42590de16e1eb8066a97
MD5 c1d584abbbd3864de663fb6e1aa8f4db
BLAKE2b-256 0a90439b73cf3ddb97b65c27223f3b24acbd3b4bdc09e059e32d76e0cd99e4c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for graforvfl-2.2.0-py3-none-any.whl:

Publisher: publish-package.yml on thieu1995/GrafoRVFL

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page