Skip to main content

EvoRBF: Evolving Radial Basis Function Network by Intelligent Nature-inspired Algorithms

Project description

EvoRBF


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

EvoRBF is a Python library that implements a framework for training Radial Basis Function (RBF) networks using Intelligence Nature-inspired Algorithms (INAs). It provides a comparable alternative to the traditional RBF network and is compatible with the Scikit-Learn library. With EvoRBF, you can perform searches and hyperparameter tuning using the functionalities provided by the Scikit-Learn library.

EvoRBF Evolving Radial Basis Function Network
Free software GNU General Public License (GPL) V3 license
Provided Estimator RbfRegressor, RbfClassifier, InaRbfRegressor, InaRbfClassifier, InaRbfTuner
Provided ML models > 400 Models
Supported 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 Request

If you want to understand how Intelligence Nature-inspired Algorithms is applied to Radial Basis Function Network, you need to read the paper titled "Application of artificial intelligence in estimating mining capital expenditure using radial basis function neural network optimized by metaheuristic algorithms". The paper can be accessed at the following this link

@software{thieu_2024_11136008,
  author       = {Nguyen Van Thieu},
  title        = {EvoRBF: Evolving Radial Basis Function Network by Intelligent Nature-inspired Algorithms},
  month        = may,
  year         = 2024,
  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}
}

Usage

$ pip install evorbf

After installation, you can check EvoRBF version:

$ python
>>> import evorbf
>>> evorbf.__version__

In this example below, we will use Whale Optimization Algorithm to optimize the sigmas (in non-linear Gaussian kernel) and weights (of hidden-output layer) in RBF network (WOA-RBF model) for Diabetes prediction problem.

import numpy as np
from evorbf import Data, InaRbfRegressor
from sklearn.datasets import load_diabetes

## Load data object
# total samples = 442, total features = 10
X, y = load_diabetes(return_X_y=True)
data = Data(X, y)

## Split train and test
data.split_train_test(test_size=0.2, random_state=2)
print(data.X_train.shape, data.X_test.shape)

## Scaling dataset
data.X_train, scaler_X = data.scale(data.X_train, scaling_methods=("standard"))
data.X_test = scaler_X.transform(data.X_test)

data.y_train, scaler_y = data.scale(data.y_train, scaling_methods=("standard", ))
data.y_test = scaler_y.transform(np.reshape(data.y_test, (-1, 1)))

## Create model
opt_paras = {"name": "WOA", "epoch": 500, "pop_size": 20}
model = InaRbfRegressor(size_hidden=25, center_finder="kmean", regularization=False, lamda=0.5, obj_name="MSE",
                        optimizer="BaseGA", optimizer_paras=opt_paras, verbose=True, seed=42)

## Train the model
model.fit(data.X_train, data.y_train, lb=-1., ub=2.)

## Test the model
y_pred = model.predict(data.X_test)

print(model.optimizer.g_best.solution)
## Calculate some metrics
print(model.score(X=data.X_test, y=data.y_test, method="RMSE"))
print(model.scores(X=data.X_test, y=data.y_test, list_methods=["R2", "R", "KGE", "MAPE"]))
print(model.evaluate(y_true=data.y_test, y_pred=y_pred, list_metrics=["MSE", "RMSE", "R2S", "NSE", "KGE", "MAPE"]))

Please go check out the examples folder. You'll be surprised by what this library can do for your problem. You can also read the documentation for more detailed installation instructions, explanations, and examples.

Official Links (Get support for questions and answers)

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

evorbf-1.0.0.tar.gz (36.0 kB view hashes)

Uploaded Source

Built Distribution

evorbf-1.0.0-py3-none-any.whl (37.2 kB view hashes)

Uploaded Python 3

Supported by

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