UniLVQ: A Unified Learning Vector Quantization Framework for Supervised Learning Tasks
Project description
UniLVQ: A Unified Learning Vector Quantization Framework for Supervised Learning Tasks
📌 Overview
UniLVQ is an open-source Python library that provides a unified, extensible, and user-friendly implementation of Learning Vector Quantization (LVQ) algorithms for supervised learning. It supports both classification and regression tasks, and is designed to work seamlessly with the scikit-learn API.
Built on top of NumPy and PyTorch, UniLVQ combines rule-based and neural-inspired LVQ variants, making it suitable for both research and practical applications.
🚀 Features
- ✅ Unified base API compatible with
scikit-learn - ✅ Traditional rule-based LVQ variants: LVQ1, LVQ2.1, LVQ3, Optimized LVQ1:
Lvq1Classifier,Lvq2Classifier,Lvq3Classifier,OptimizedLvq1Classifier
- ✅ Loss-based LVQ models: GLVQ, GRLVQ, LGMLVQ (PyTorch-based):
GlvqClassifier,GlvqRegressor,GrlvqClassifier,GrlvqRegressor,LgmlvqClassifier
- ✅ Support for both classification and regression
- ✅ Built-in support for early stopping, metric evaluation, data scaling
- ✅ Modular design for easy extension and customization
- ✅ CI-tested, documented, and easy to use
🧠 Supported Models
| Type | Algorithms | Module |
|---|---|---|
| Rule-based LVQ | LVQ1, LVQ2.1, LVQ3, Optimized LVQ1 (Classifiers) | classic_lvq.py |
| Generalized LVQ | GLVQ (Classifier, Regressor) | glvq.py |
| Generalized Relevance LVQ | GRLVQ (Classifier, Regressor) | grlvq.py |
| Local Generalized Matrix LVQ | LGMLVQ (Classifier) | lgmlvq.py |
📖 Citation Request
Please include these citations if you plan to use this library:
@software{thieu20250515UniLVQ,
author = {Nguyen Van Thieu},
title = {UniLVQ: A Unified Learning Vector Quantization Framework for Supervised Learning Tasks},
month = June,
year = 2025,
doi = {10.6084/m9.figshare.28802435},
url = {https://github.com/thieu1995/UniLVQ}
}
📦 Installation
Install the latest version from PyPI:
pip install unilvq
Verify installation:
$ python
>>> import unilvq
>>> unilvq.__version__
🚀 Quick Start
For classification problem using LVQ1 classifier:
from unilvq import Lvq1Classifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
# Load data
X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)
# Train LVQ1 model
model = Lvq1Classifier(n_prototypes_per_class=1, learning_rate=0.1, seed=42)
model.fit(X_train, y_train)
# Evaluate
y_pred = model.predict(X_test)
print("Accuracy:", accuracy_score(y_test, y_pred))
As can be seen, you do it like any model from Scikit-Learn library such as SVC, RF, DT,... Please read the examples folder for more use cases.
📚 Documentation
Documentation is available at: 👉 https://unilvq.readthedocs.io
You can build the documentation locally:
cd docs
make html
🧪 Testing
You can run unit tests using:
pytest tests/
🤝 Contributing
We welcome contributions to UniLVQ! 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.
📎 Official channels
- 🔗 Official source code repository
- 📘 Official document
- 📦 Download releases
- 🐞 Issue tracker
- 📝 Notable changes log
- 💬 Official discussion group
Developed by: Thieu @ 2025
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file unilvq-0.2.0.tar.gz.
File metadata
- Download URL: unilvq-0.2.0.tar.gz
- Upload date:
- Size: 43.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a066443d6ef0a175bbb84cf7034e09d8341e669fc793a34df77cede71f00b55
|
|
| MD5 |
0c5166d7e5ad69f4468374653c677a73
|
|
| BLAKE2b-256 |
fb3d29acf96189f83efa0cf31c58005e7893280e90b08721fbd2465dd97d92ab
|
Provenance
The following attestation bundles were made for unilvq-0.2.0.tar.gz:
Publisher:
publish-package.yml on thieu1995/UniLVQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unilvq-0.2.0.tar.gz -
Subject digest:
1a066443d6ef0a175bbb84cf7034e09d8341e669fc793a34df77cede71f00b55 - Sigstore transparency entry: 230318478
- Sigstore integration time:
-
Permalink:
thieu1995/UniLVQ@1902728c9df95fea6b926238534e6c3f67050554 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/thieu1995
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@1902728c9df95fea6b926238534e6c3f67050554 -
Trigger Event:
release
-
Statement type:
File details
Details for the file unilvq-0.2.0-py3-none-any.whl.
File metadata
- Download URL: unilvq-0.2.0-py3-none-any.whl
- Upload date:
- Size: 46.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5588bd88e6d3c3f47fcad1e0e3462c67b46bd409287f4e54246b5f3fae0d11dd
|
|
| MD5 |
0b03490b3f0a2b6949b6be88bbd92f6e
|
|
| BLAKE2b-256 |
c50b8ce07e6278e3351687692ec09e64b729c54acc111cb15ba51904010b089e
|
Provenance
The following attestation bundles were made for unilvq-0.2.0-py3-none-any.whl:
Publisher:
publish-package.yml on thieu1995/UniLVQ
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
unilvq-0.2.0-py3-none-any.whl -
Subject digest:
5588bd88e6d3c3f47fcad1e0e3462c67b46bd409287f4e54246b5f3fae0d11dd - Sigstore transparency entry: 230318485
- Sigstore integration time:
-
Permalink:
thieu1995/UniLVQ@1902728c9df95fea6b926238534e6c3f67050554 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/thieu1995
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@1902728c9df95fea6b926238534e6c3f67050554 -
Trigger Event:
release
-
Statement type: