๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

unilvq

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unilvq

UniLVQ: A Unified Learning Vector Quantization Framework for Supervised Learning Tasks

0.2.0
PyPI
Maintainers
1

UniLVQ: A Unified Learning Vector Quantization Framework for Supervised Learning Tasks

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

๐Ÿ“Œ 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

TypeAlgorithmsModule
Rule-based LVQLVQ1, LVQ2.1, LVQ3, Optimized LVQ1 (Classifiers)classic_lvq.py
Generalized LVQGLVQ (Classifier, Regressor)glvq.py
Generalized Relevance LVQGRLVQ (Classifier, Regressor)grlvq.py
Local Generalized Matrix LVQLGMLVQ (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

Developed by: Thieu @ 2025

Keywords

Learning Vector Quantization

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts