waveletml

WaveletML: A Scalable and Extensible Wavelet Neural Network Framework

https://github.com/thieu1995/waveletml

Science Score: 57.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 4 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords

classification genetic-algorithm gpu-acceleration gradient-descent machine-learning metaheuristic-algorithm neural-network particle-swarm-optimization regression wavelet-based-net wavelet-layer wavelet-neural-network wavelet-transform wavelets whale-optimization-algorithm wnn
Last synced: 6 months ago · JSON representation ·

Repository

WaveletML: A Scalable and Extensible Wavelet Neural Network Framework

Basic Info
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
classification genetic-algorithm gpu-acceleration gradient-descent machine-learning metaheuristic-algorithm neural-network particle-swarm-optimization regression wavelet-based-net wavelet-layer wavelet-neural-network wavelet-transform wavelets whale-optimization-algorithm wnn
Created 10 months ago · Last pushed 9 months ago
Metadata Files
Readme Changelog License Code of conduct Citation

README.md

WaveletML: A Scalable and Extensible Wavelet Neural Network Framework

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


Overview

WaveletML is an open-source Python framework designed for building, training, and evaluating Wavelet Neural Networks (WNNs) tailored for supervised learning tasks such as regression and classification. Leveraging the power of PyTorch and the modularity of scikit-learn, WaveletML provides a unified, extensible, and scalable platform for researchers and practitioners to explore wavelet-based neural architectures.

Features

  • Modular Wavelet Neural Network (WNN) architectures
  • Support for multiple wavelet functions (e.g., Morlet, Mexican Hat)
  • Support for multiple wavelet layers (e.g., Weighed Linear, Product, Summation, etc.)
  • Gradient Descent-based training via Pytorch
  • Metaheuristic Algorithm-based training via Mealpy
  • scikit-learn-compatible API with BaseEstimator support
  • Built-in support for both classification and regression tasks
  • Customizable activation functions, training parameters, and loss functions
  • Designed for scalability, enabling deployment on CPU or GPU environments.

Whether you're prototyping WNN-based models or conducting advanced experimental research, WaveletML aims to bridge the gap between theory and practical implementation in wavelet-based learning systems.

Model Types

  • GdWnnClassifier: Wavelet-based classifier using gradient-based training
  • GdWnnRegressor: Wavelet-based regressor using gradient-based training
  • MhaWnnClassifier: Uses metaheuristics (e.g., PSO, GA) for training
  • MhaWnnRegressor: Wavelet-based regressor with metaheuristic training

Installation

Install the latest version using pip:

bash pip install waveletml

After that, check the version to ensure successful installation:

```sh $ python

import waveletml waveletml.version ```

Quick Start

Classification

In this example, we will use Adam optimizer to train Wavelet Weighted Linear Neural Network (WNN) for a classification task.

```python from sklearn.datasets import load_iris from waveletml import Data, GdWnnClassifier

Load data object

X, y = loadiris(returnX_y=True) data = Data(X, y)

Split train and test

data.splittraintest(testsize=0.2, randomstate=2, inplace=True, shuffle=True) print(data.Xtrain.shape, data.Xtest.shape)

Scaling dataset

data.Xtrain, scalerX = data.scale(data.Xtrain, scalingmethods=("standard", "minmax")) data.Xtest = scalerX.transform(data.X_test)

data.ytrain, scalery = data.encodelabel(data.ytrain) data.ytest = scalery.transform(data.y_test)

print(type(data.Xtrain), type(data.ytrain))

Create model

model = GdWnnClassifier(sizehidden=10, waveletfn="morlet", actoutput=None, epochs=100, batchsize=16, optim="Adam", optimparams=None, validrate=0.1, seed=42, verbose=True, device=None)

Train the model

model.fit(X=data.Xtrain, y=data.ytrain)

Test the model

ypred = model.predict(data.Xtest) print(ypred) print(model.predictproba(data.X_test))

Calculate some metrics

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

Print model parameters

for k, v in model.network.named_parameters(): print(f"{k}: {v.shape}, {v.data}") ```

Regression

In this example, we will use Genetic Algorithm - GA to train Wavelet Summation Neural Network (WNN) for a regression task.

```python from sklearn.datasets import load_diabetes from waveletml import Data, MhaWnnRegressor, CustomWaveletSummationNetwork

Load data object

X, y = loaddiabetes(returnX_y=True) data = Data(X, y)

Split train and test

data.splittraintest(testsize=0.2, randomstate=2, inplace=True) print(data.Xtrain.shape, data.Xtest.shape)

Scaling dataset

data.Xtrain, scalerX = data.scale(data.Xtrain, scalingmethods=("standard", "minmax")) data.Xtest = scalerX.transform(data.X_test)

data.ytrain, scalery = data.scale(data.ytrain, scalingmethods=("standard", "minmax")) data.ytest = scalery.transform(data.y_test.reshape(-1, 1))

print(type(data.Xtrain), type(data.ytrain))

Create model

model = MhaWnnRegressor(sizehidden=10, waveletfn="morlet", actoutput=None, optim="BaseGA", optimparams={"epoch": 40, "popsize": 20}, objname="MSE", seed=42, verbose=True, wnntype=CustomWaveletSummationNetwork, lb=None, ub=None, mode='single', nworkers=None, termination=None)

Train the model

model.fit(data.Xtrain, data.ytrain)

Test the model

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

Calculate some metrics

print(model.evaluate(ytrue=data.ytest, ypred=ypred, list_metrics=["R2", "NSE", "MAPE", "NNSE"]))

Print model parameters

for k, v in model.network.named_parameters(): print(f"{k}: {v.shape}, {v.data}") ```

Please read the examples folder for more use cases.

Documentation

Documentation is available at: https://waveletml.readthedocs.io

You can build the documentation locally:

shell cd docs make html

Testing

You can run unit tests using:

shell pytest tests/

Contributing

We welcome contributions to WaveletML! If you have suggestions, improvements, or bug fixes, feel free to fork the repository, create a pull request, or open an issue.

License

This project is licensed under the GPLv3 License. See the LICENSE file for more details.

Citation Request

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

```bibtex @software{thieu20250525WaveletML, author = {Nguyen Van Thieu}, title = {WaveletML: A Scalable and Extensible Wavelet Neural Network Framework}, month = June, year = 2025, doi = {10.6084/m9.figshare.29095376}, url = {https://github.com/thieu1995/WaveletML} }

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

Official Links

  • Official source code repo: https://github.com/thieu1995/WaveletML
  • Official document: https://waveletml.readthedocs.io/
  • Download releases: https://pypi.org/project/waveletml/
  • Issue tracker: https://github.com/thieu1995/WaveletML/issues
  • Notable changes log: https://github.com/thieu1995/WaveletML/blob/master/ChangeLog.md
  • Official chat group: https://t.me/+fRVCJGuGJg1mNDg1

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: "WaveletML: A Scalable and Extensible Wavelet Neural Network Framework"
version: v0.2.0
doi: 10.6084/m9.figshare.29095376
date-released: 2025-06-05
url: "https://github.com/thieu1995/WaveletML"

GitHub Events

Total
  • Release event: 3
  • Delete event: 2
  • Member event: 3
  • Push event: 27
  • Create event: 4
Last Year
  • Release event: 3
  • Delete event: 2
  • Member event: 3
  • Push event: 27
  • Create event: 4

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 104 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: waveletml

WaveletML: A Scalable and Extensible Wavelet Neural Network Framework

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 104 Last month
Rankings
Dependent packages count: 9.1%
Average: 30.2%
Dependent repos count: 51.2%
Maintainers (1)
Last synced: 7 months ago

Dependencies

docs/requirements.txt pypi
  • numpy >=1.17.1
  • pandas >=1.3.5
  • permetrics >=1.5.0
  • readthedocs-sphinx-search >=0.1.1
  • scikit-learn >=1.0.2
  • scipy >=1.7.1
  • sphinx >=4.4.0
  • sphinx_rtd_theme >=1.0.1
requirements.txt pypi
  • flake8 >=4.0.1
  • mealpy >=3.0.1
  • numpy >=1.17.1
  • pandas >=1.3.5
  • permetrics >=2.0.0
  • pytest ==7.1.2
  • pytest-cov ==4.0.0
  • scikit-learn >=1.2.1
  • scipy >=1.7.1
  • torch >=2.0.0
setup.py pypi
  • numpy >=1.17.1
  • pandas >=1.3.5