evorbf
EvoRBF: A Nature-inspired Algorithmic Framework for Evolving Radial Basis Function Networks
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 9 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 (14.4%) to scientific vocabulary
Keywords
Repository
EvoRBF: A Nature-inspired Algorithmic Framework for Evolving Radial Basis Function Networks
Basic Info
- Host: GitHub
- Owner: thieu1995
- License: gpl-3.0
- Language: Python
- Default Branch: main
- Homepage: https://evorbf.readthedocs.org
- Size: 4.04 MB
Statistics
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
- Releases: 4
Topics
Metadata Files
README.md
🌟 Introduction
EvoRBF is a powerful Python library for training Radial Basis Function (RBF) networks using nature-inspired algorithms (NIAs). It provides a wide range of RBF models from traditional to advanced, and supports hyperparameter tuning using optimizers like Whale Optimization Algorithm (WOA), Genetic Algorithm (GA), and more.
🚀 Key Features
| EvoRBF | Evolving Radial Basis Function Network |
|--------------------------------------|--------------------------------------------------------|
| Free software | GNU General Public License (GPL) V3 license |
| Traditional RBF models | RbfRegressor, RbfClassifier |
| Advanced RBF models | AdvancedRbfRegressor, AdvancedRbfClassifier |
| Nature-inspired RBF models | NiaRbfRegressor, NiaRbfClassifier |
| Tuner for traditional RBF models | NiaRbfTuner |
| Provided total ML models | > 400 Models |
| Supported total metrics | >= 67 (47 regressions and 20 classifications) |
| Supported loss functions | >= 61 (45 regressions and 16 classifications) |
| Documentation | https://evorbf.readthedocs.io |
| Python versions | >= 3.8.x |
| Dependencies | numpy, scipy, scikit-learn, pandas, mealpy, permetrics |
🧾 Citation
Please include these citations if you plan to use this library:
```bibtex @software{thieu202411136008, author = {Nguyen Van Thieu}, title = {EvoRBF: A Nature-inspired Algorithmic Framework for Evolving Radial Basis Function Networks}, month = June, year = 2025, publisher = {Zenodo}, doi = {10.5281/zenodo.11136007}, url = {https://doi.org/10.5281/zenodo.11136007} }
@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 latest version from PyPI:
bash
pip install evorbf
Verify installation:
```bash $ python
import evorbf evorbf.version ```
We have provided above several ways to import and call the proposed classes. If you need more details how to
use each of them, please check out the folder examples. In this short demonstration, we will use
Whale Optimization Algorithm to optimize the sigmas (in non-linear Gaussian kernel) and reg_lambda of
L2 regularization in RBF network (WOA-RBF model) for Diabetes prediction problem.
```python import numpy as np from evorbf import Data, NiaRbfRegressor from sklearn.datasets import load_diabetes
Load data object
total samples = 442, total features = 10
X, y = loaddiabetes(returnX_y=True) data = Data(X, y)
Split train and test
data.splittraintest(testsize=0.2, randomstate=2) print(data.Xtrain.shape, data.Xtest.shape)
Scaling dataset
data.Xtrain, scalerX = data.scale(data.Xtrain, scalingmethods=("standard")) data.Xtest = scalerX.transform(data.X_test)
data.ytrain, scalery = data.scale(data.ytrain, scalingmethods=("standard", )) data.ytest = scalery.transform(np.reshape(data.y_test, (-1, 1)))
Create model
optparas = {"name": "WOA", "epoch": 50, "popsize": 20} model = NiaRbfRegressor(sizehidden=25, # Set up big enough hidden size centerfinder="kmeans", # Use KMeans to find the centers regularization=True, # Use L2 regularization objname="MSE", # Mean squared error as fitness function for NIAs optim="OriginalWOA", # Use Whale Optimization optimparams={"epoch": 50, "pop_size": 20}, # Set up parameter for Whale Optimization verbose=True, seed=42)
Train the model
model.fit(data.Xtrain, data.ytrain)
Test the model
ypred = model.predict(data.Xtest)
print(model.optimizer.g_best.solution)
Calculate some metrics
print(model.score(X=data.Xtest, y=data.ytest)) print(model.scores(X=data.Xtest, y=data.ytest, listmetrics=["R2", "R", "KGE", "MAPE"])) print(model.evaluate(ytrue=data.ytest, ypred=ypred, listmetrics=["MSE", "RMSE", "R2S", "NSE", "KGE", "MAPE"])) ```
📚 Brief Theory Combine With Deep Usage
EvoRBF is mind-blowing framework for Radial Basis Function (RBF) networks. We explain several keys components and provide several types of RBF networks that you will never see in other places.
You can read several papers by using Google Scholar search. There are many ways we can use Nature-inspired Algorithms to optimize Radial Basis Function network, for example, you can read this paper. Here we will walk through some basic concepts and parameters that matter to this network.
Structure
The RBF network consists of three layers:
- Input layer: Accepts input features.
- Hidden layer: Applies radial basis functions (e.g., Gaussian).
- Output layer: Computes linear combinations of hidden outputs.
🛠️ Model Training
Traditional RBF models
In case of traditional RBF model. There are a few parameters need to identify to get the best model.
code
1. The number of hidden nodes in hidden layer
2. The centers and widths (sigmas) of Gaussian function
3. The output weights
4. The regularization factor (lambda) L2
To train their parameters,
code
1. Using hyper-parameter tuning model such as GridSearchCV or RandomizedSearchCV to get the best hidden nodes
2. The centers can be calculated by Random or KMeans or unsupervised learning algorithms
3. The widths (sigmas) can be computed by hyper-parameter tuning process.
+ Width can be a single value that represent all hidden nodes has the same curve of Gaussian function
+ Width can be multiple values that each hidden node has a different value.
4. The output weights can be calculated by Moore-Penrose inverse (Matrix multiplication). Do not use Gradient Descent.
5. When setting regularization L2. lambda can be computed by hyper-parameter tuning process.
Example, ```python from evorbf import RbfRegressor, RbfClassifier
model = RbfClassifier(sizehidden=10, centerfinder="kmeans", sigmas=2.0, reglambda=0.1, seed=None) model = RbfRegressor(sizehidden=4, centerfinder="random", sigmas=(1.5, 2, 2, 2.5), reglambda=0, seed=42)
model.fit(X=Xtrain, y=ytrain) ypred = model.predict(Xtest) ypredprob = model.predictproba(Xtest) ```
Advanced RBF models
In case of advanced RBF model. User can have so many different options.
code
1. Choice different RBF kernel function such as Multiquadric (MQ), Inverse Multiquadric (IMQ), Thin Plate Spline (TPS), Exponential, Power,...
2. Choice different unsupervised learning algorithms to calculate the centers, and may be the number of hidden nodes.
+ For example, KMeans, or random algorithms, you need to set up the number of hidden nodes.
+ But, for MeanShift or DBSCAN algorithms, you don't need to set that value. They can automatically identify the number of cluters (number of hidden nodes).
3. This version may have the bias in output layer.
Examples, ```python from evorbf import AdvancedRbfClassifier, AdvancedRbfRegressor
model = AdvancedRbfClassifier(centerfinder="random", finderparams={"ncenters": 15}, rbfkernel="gaussian", kernelparams={"sigma": 1.5}, reglambda=0.1, has_bias=True, seed=42)
model = AdvancedRbfClassifier(centerfinder="random", finderparams=None, # Default ncenters = 10 rbfkernel="gaussian", kernelparams=None, # Default sigma = 1.0 reglambda=0.1, has_bias=False, seed=42)
model = AdvancedRbfClassifier(centerfinder="kmeans", finderparams={"ncenters": 20}, rbfkernel="multiquadric", kernelparams=None, reglambda=0.1, has_bias=False, seed=42)
model = AdvancedRbfClassifier(centerfinder="meanshift", finderparams={"bandwidth": 0.6}, # Give us 28 hidden nodes rbfkernel="inversemultiquadric", kernelparams={"sigma": 1.5}, reglambda=0.5, has_bias=True, seed=42)
model = AdvancedRbfClassifier(centerfinder="dbscan", finderparams={"eps": 0.2}, # Give us 42 hidden nodes rbfkernel="multiquadric", kernelparams={"sigma": 1.5}, reglambda=0.5, hasbias=True, seed=42)
model = AdvancedRbfClassifier(centerfinder="dbscan", finderparams={"eps": 0.175}, # Give us 16 hidden nodes rbfkernel="multiquadric", kernelparams={"sigma": 1.5}, reglambda=None, hasbias=False, seed=42)
model.fit(X=Xtrain, y=ytrain) ypred = model.predict(Xtest) ypredprob = model.predictproba(Xtest) ```
Nature-inspired Algorithm-based RBF models
This is the main purpose of this library. In this type of models,
code
1. We use Nature-inspired Algorithm (NIA) to train widths (sigmas) value for each hidden node.
2. If you set up the Regularization technique, then NIA is automatically calculated the lambda factor
Examples, ```python from evorbf import NiaRbfRegressor, NiaRbfClassifier
model = NiaRbfClassifier(sizehidden=25, centerfinder="kmeans", regularization=False, objname="F1S", optim="OriginalWOA", optimparams={"epoch": 50, "pop_size": 20}, verbose=True, seed=42)
model = NiaRbfRegressor(sizehidden=10, centerfinder="random", regularization=True, objname="AS", optim="BaseGA", optimparams={"epoch": 50, "pop_size": 20}, verbose=True, seed=42)
model.fit(X=Xtrain, y=ytrain) ypred = model.predict(Xtest) ypredprob = model.predictproba(Xtest) ```
🎯 Nature-inspired Algorithm-based hyperparameter RBF tuning model
In this case, user can use NIA to tune hyper-parameters of traditional RBF models.
```python from evorbf import NiaRbfTuner, IntegerVar, StringVar, FloatVar
Design the boundary (for hyper-parameters)
mybounds = [ IntegerVar(lb=5, ub=21, name="sizehidden"), StringVar(validsets=("kmeans", "random"), name="centerfinder"), FloatVar(lb=(0.01,), ub=(3.0,), name="sigmas"), FloatVar(lb=(0, ), ub=(1.0, ), name="reg_lambda"), ]
model = NiaRbfTuner(problemtype="classification", bounds=mybounds, cv=3, scoring="AS", optim="OriginalWOA", optimparams={"epoch": 10, "popsize": 20}, verbose=True, seed=42) ```
My notes
- RBF networks require training of both the centers and the widths of the Gaussian activation functions (this is the 1st phase of training).
- RBF typically uses KMeans to find the centers:
- This increases both complexity and computation time.
- In this case, users need to define the widths: You can use a single global width or assign individual widths per hidden node.
- Alternatively, centers can be chosen randomly, but this often fails to properly separate the data into meaningful clusters.
- RBF also requires training the output weights (this is the 2nd phase).
- Unlike MLP networks, RBF does not use gradient descent to compute output weights. Instead, it uses the Moore–Penrose pseudoinverse (via matrix multiplication and the least squares method) → This makes it faster than MLPs.
- The Moore–Penrose inverse finds an exact solution, so there is no need for gradient descent or approximation algorithms in this step.
- If overfitting occurs, you can apply L2 regularization to control the model's complexity.
- For large-scale datasets, you should:
- Increase the number of hidden nodes.
- Increase the L2 regularization parameter to avoid overfitting.
```code 1. RbfRegressor, RbfClassifier: - You need to configure 4 types of hyperparameters.
AdvancedRbfRegressor, AdvancedRbfClassifier:
- These models require setting 6 types of hyperparameters.
- However, they offer much more flexibility—you can design your own custom RBF architectures.
- For example:
- RBF with bias in the output layer.
- RBF using DBSCAN for center initialization and an exponential kernel function.
NiaRbfRegressor, NiaRbfClassifier:
- You only need to set the hidden size.
- These are the best-performing classes in this library.
- Widths (sigmas) are automatically computed for each hidden node.
- The regularization factor is automatically tuned to find the optimal value.
NiaRbfTuner:
- Extremely useful for traditional RBF models.
- It can automatically tune the hidden size.
- However, only a single sigma value will be used across all hidden nodes. ```
📎 Official channels
- 🔗 Official source code repository
- 📘 Official document
- 📦 Download releases
- 🐞 Issue tracker
- 📝 Notable changes log
- 💬 Official discussion group
Developed by: Thieu @ 2025
Owner
- Name: Nguyen Van Thieu
- Login: thieu1995
- Kind: user
- Location: Earth
- Company: AIIR Group
- Website: https://thieu1995.github.io/
- Repositories: 13
- Profile: https://github.com/thieu1995
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: "EvoRBF: A Nature-inspired Algorithmic Framework for Evolving Radial Basis Function Networks"
version: 2.1.0
doi: 10.5281/zenodo.11136007
date-released: 2025-06-05
url: "https://github.com/thieu1995/EvoRBF"
GitHub Events
Total
- Release event: 2
- Watch event: 1
- Member event: 1
- Push event: 20
- Create event: 2
Last Year
- Release event: 2
- Watch event: 1
- Member event: 1
- Push event: 20
- Create event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 0
- Total 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
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
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 140 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
- Total maintainers: 1
pypi.org: evorbf
EvoRBF: A Nature-inspired Algorithmic Framework for Evolving Radial Basis Function Networks
- Homepage: https://github.com/thieu1995/evorbf
- Documentation: https://evorbf.readthedocs.io/
- License: GPLv3
-
Latest release: 2.1.0
published 7 months ago