metaperceptron

MetaPerceptron: A Standardized Framework For Metaheuristic-Driven Multi-layer Perceptron Optimization

https://github.com/thieu1995/metaperceptron

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 7 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 (16.2%) to scientific vocabulary

Keywords

adagrad-approach adam-optimizer adelta-optimizer classification-models genetic-algorithm global-search gradient-free-based-multi-layer-perceptron metaheuristic-algorithms metaheuristic-based-multi-layer-perceptron metaheuristics mlp multi-layer-perceptron nature-inspired-optimization neural-network particle-swarm-optimization regression-models sgd-optimizer whale-optimization-algorithm
Last synced: 4 months ago · JSON representation ·

Repository

MetaPerceptron: A Standardized Framework For Metaheuristic-Driven Multi-layer Perceptron Optimization

Basic Info
Statistics
  • Stars: 12
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 6
Topics
adagrad-approach adam-optimizer adelta-optimizer classification-models genetic-algorithm global-search gradient-free-based-multi-layer-perceptron metaheuristic-algorithms metaheuristic-based-multi-layer-perceptron metaheuristics mlp multi-layer-perceptron nature-inspired-optimization neural-network particle-swarm-optimization regression-models sgd-optimizer whale-optimization-algorithm
Created over 2 years ago · Last pushed 7 months ago
Metadata Files
Readme Changelog License Code of conduct Citation

README.md

MetaPerceptron


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

MetaPerceptron (Metaheuristic-optimized Multi-Layer Perceptron) is a powerful and extensible Python library that brings the best of both worlds: metaheuristic optimization and deep learning via Multi-Layer Perceptron (MLP). Whether you're working with classic Gradient Descent techniques or state-of-the-art metaheuristic algorithms like GA, PSO, WOA, DE, etc., MetaPerceptron has you covered. With MetaPerceptron, you can perform searches, feature selection, and hyperparameter tuning using the features provided by the Scikit-Learn library.

🚀 Features at a Glance

  • 🔧 Estimators: MlpRegressor, MlpClassifier, MhaMlpRegressor, MhaMlpClassifier
  • 📊 Utilities: MhaMlpTuner, MhaMlpComparator
  • 🧠 Model Zoo:
    • 200+ Metaheuristic-trained MLP Regressors
    • 200+ Metaheuristic-trained MLP Classifiers
    • 12 Gradient Descent-trained MLP Regressors
    • 12 Gradient Descent-trained MLP Classifiers
  • 📏 67+ Performance Metrics (47 for regression, 20 for classification)
  • ⚙️ Support: GPU support (for GD-based models), Scikit-learn compatible API
  • 📚 Documentation: https://metaperceptron.readthedocs.io
  • 🐍 Python: 3.8+
  • 📦 Dependencies: numpy, scipy, scikit-learn, pytorch, mealpy, pandas, permetrics

📖 Citation

If MetaPerceptron supports your work, please consider citing the following:

```bibtex @article{van2025metaperceptron, title={MetaPerceptron: A Standardized Framework for Metaheuristic-Driven Multi-Layer Perceptron Optimization}, author={Van Thieu, Nguyen and Mirjalili, Seyedali and Garg, Harish and Hoang, Nguyen Thanh}, journal={Computer Standards & Interfaces}, pages={103977}, year={2025}, publisher={Elsevier}, doi={10.1016/j.csi.2025.103977}, url={https://doi.org/10.1016/j.csi.2025.103977} }

@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} }

@article{van2023groundwater, title={Groundwater level modeling using Augmented Artificial Ecosystem Optimization}, author={Van Thieu, Nguyen and Barma, Surajit Deb and Van Lam, To and Kisi, Ozgur and Mahesha, Amai}, journal={Journal of Hydrology}, volume={617}, pages={129034}, year={2023}, publisher={Elsevier}, doi={10.1016/j.jhydrol.2022.129034} } ```

🧪 Quick Start

Install the latest version using pip:

bash pip install metaperceptron

After that, check the version to ensure successful installation:

python import metaperceptron print(metaperceptron.__version__)

✅ Import core components

Here is how you can import all provided classes from MetaPerceptron

python from metaperceptron import DataTransformer, Data from metaperceptron import MhaMlpRegressor, MhaMlpClassifier, MlpRegressor, MlpClassifier from metaperceptron import MhaMlpTuner, MhaMlpComparator

🔍 Example: Training an MLP Classifier with Genetic Algorithm

In this tutorial, we will use Genetic Algorithm to train Multi-Layer Perceptron network for classification task. For more complex examples and use cases, please check the folder examples.

```python from sklearn.datasets import loadiris from sklearn.modelselection import traintestsplit from metaperceptron import DataTransformer, MhaMlpClassifier

Load the dataset

X, y = loadiris(returnX_y=True)

Split train and test

Xtrain, ytrain, Xtest, ytest = traintestsplit(X, y, test_size=0.2)

Scale dataset with two methods: standard and minmax

dt = DataTransformer(scalingmethods=("standard", "minmax")) Xtrainscaled = dt.fittransform(Xtrain) Xtestscaled = dt.transform(Xtest)

Define Genetic Algorithm-trained Multi-Layer Perceptron

model = MhaMlpClassifier(hiddenlayers=(50, 15), actnames="Tanh", dropoutrates=None, actoutput=None, optim="BaseGA", optimparams={"epoch": 100, "popsize": 20, "name": "GA"}, obj_name="F1S", seed=42, verbose=True)

Train the model

model.fit(X=Xtrainscaled, y=y_train)

Test the model

ypred = model.predict(Xtest) print(y_pred)

Print the score

print(model.score(Xtestscaled, y_test))

Calculate some metrics

print(model.evaluate(ytrue=ytest, ypred=ypred, list_metrics=["AS", "PS", "RS", "F2S", "CKS", "FBS"])) ```

💬 Support


Developed by: Thieu @ 2025

Owner

  • Name: Nguyen Van Thieu
  • Login: thieu1995
  • Kind: user
  • Location: Earth
  • Company: AIIR Group

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: "MetaPerceptron: A Standardized Framework for Metaheuristic-Trained Multi-Layer Perceptron"
version: v2.2.0
doi: 10.5281/zenodo.10251021
date-released: 2023-12-02
url: "https://github.com/thieu1995/MetaPerceptron"

GitHub Events

Total
  • Release event: 3
  • Watch event: 4
  • Delete event: 1
  • Member event: 2
  • Push event: 17
  • Pull request event: 6
  • Fork event: 2
  • Create event: 4
Last Year
  • Release event: 3
  • Watch event: 4
  • Delete event: 1
  • Member event: 2
  • Push event: 17
  • Pull request event: 6
  • Fork event: 2
  • Create event: 4

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • anh9895 (5)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/publish-package.yaml actions
  • actions/cache v1 composite
  • actions/checkout v1 composite
  • actions/download-artifact v2 composite
  • actions/setup-python v1 composite
  • actions/upload-artifact master composite
  • pypa/gh-action-pypi-publish master composite
requirements.txt pypi
  • flake8 >=4.0.1
  • mealpy >=3.0.1
  • numpy >=1.17.1
  • pandas >=1.3.5
  • permetrics >=1.5.0
  • pytest ==7.1.2
  • pytest-cov ==4.0.0
  • scikit-learn >=1.0.2
  • scipy >=1.7.1
  • skorch >=0.13.0
  • torch >=2.0.0
setup.py pypi
  • numpy >=1.17.1
  • pandas >=1.3.5
  • torch >=2.0.0