Metadata-Version: 2.4
Name: pylwl
Version: 0.1.0
Summary: PyLWL: A Python Framework for Locally Weighted Learning
Home-page: https://github.com/thieu1995/PyLWL
Author: Thieu
Author-email: nguyenthieu2102@gmail.com
License: GPLv3
Project-URL: Documentation, https://pylwl.readthedocs.io/
Project-URL: Source Code, https://github.com/thieu1995/PyLWL
Project-URL: Bug Tracker, https://github.com/thieu1995/PyLWL/issues
Project-URL: Change Log, https://github.com/thieu1995/PyLWL/blob/main/ChangeLog.md
Project-URL: Forum, https://t.me/+fRVCJGuGJg1mNDg1
Keywords: Locally Weighted Learning,Gradient Descent,Instance-Based Learning,Nonparametric Models,Local Models,PyTorch,Machine Learning,Classification,Regression,Supervised Learning,Adaptive Models,Distance-Based Learning,Kernel Methods,Weighted Loss,Local Approximation,Model Training,Python Framework,Neural Network,Bias-Free Models,Sample-Weighted Optimization,Open-source Machine Learning,Model Interpretability,Gradient Descent Optimization,Metaheuristic Optimization,Model Wrapping,Benchmarking,machine learning,artificial intelligence,metaheuristics,metaheuristic optimization,nature-inspired algorithms,generalization,optimization algorithms,model selection,Cross-validationGenetic algorithm (GA),Particle swarm optimization (PSO),Ant colony optimization (ACO),Differential evolution (DE),Simulated annealing,Grey wolf optimizer (GWO),Whale Optimization Algorithm (WOA),automl,parameter search,mealpy,search algorithm,optimization framework,global optimization,local optimization,Computational intelligence,Robust optimization,metaheuristic algorithms,nature-inspired computing,swarm-based computation,gradient-free optimization
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: System :: Benchmark
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.17.1
Requires-Dist: scipy>=1.7.1
Requires-Dist: scikit-learn>=1.0.2
Requires-Dist: pandas>=1.3.5
Requires-Dist: mealpy>=3.0.1
Requires-Dist: permetrics>=2.0.0
Requires-Dist: torch>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov==4.0.0; extra == "dev"
Requires-Dist: flake8>=4.0.1; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# PyLWL: A Python Framework for Locally Weighted Learning

[![GitHub release](https://img.shields.io/badge/release-0.1.0-yellow.svg)](https://github.com/thieu1995/PyLWL/releases)
[![PyPI version](https://badge.fury.io/py/pylwl.svg)](https://badge.fury.io/py/pylwl)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pylwl.svg)
![PyPI - Downloads](https://img.shields.io/pypi/dm/pylwl.svg)
[![Downloads](https://pepy.tech/badge/pylwl)](https://pepy.tech/project/pylwl)
[![Tests & Publishes to PyPI](https://github.com/thieu1995/PyLWL/actions/workflows/publish-package.yaml/badge.svg)](https://github.com/thieu1995/PyLWL/actions/workflows/publish-package.yaml)
[![Documentation Status](https://readthedocs.org/projects/pylwl/badge/?version=latest)](https://pylwl.readthedocs.io/en/latest/?badge=latest)
[![Chat](https://img.shields.io/badge/Chat-on%20Telegram-blue)](https://t.me/+fRVCJGuGJg1mNDg1)
[![DOI](https://img.shields.io/badge/DOI-10.6084%2Fm9.figshare.29089784-blue)](https://doi.org/10.6084/m9.figshare.29089784)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)

---


## 📌 Overview

**PyLWL** is an open-source Python library that provides a unified, extensible, and user-friendly 
implementation of *Locally Weighted Learning* (LWL) algorithms for supervised learning.
It implements differentiable and gradient-descent-based local models for both classification and regression tasks.

## Features

- 📌 **GdLwClassifier**: Local weighted classifier using logistic regression with support for binary and multiclass classification.
- 📌 **GdLwRegressor**: Local weighted regressor using linear regression optimized with MSE loss.
- 📌 **LwClassifier** and **LwRegressor**: Local weighted classifier/regressor with a fixed kernel.
- 🧠 Supports any **differentiable kernel function** (e.g., Gaussian, Epanechnikov).
- ⚙️ Built with **PyTorch**, and fully compatible with **Scikit-Learn** pipeline and metrics.
- 🔧 Configurable optimizer (`Adam`, `SGD`, etc.) and hyperparameters.
- 🔍 Built-in support for model evaluation and scoring.


## 📦 Installation

You can install the library using `pip` (once published to PyPI):

```bash
pip install pylwl
```

After installation, you can import `PyLWL` as any other Python module:

```sh
$ python
>>> import pylwl
>>> pylwl.__version__
```

## 🚀 Quick Start


### Classification

```python
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from pylwl import LwClassifier

# 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 = LwClassifier(kernel="gaussian", tau=1.0)
model.fit(X_train, y_train)

# Evaluate
y_pred = model.predict(X_test)
print("Accuracy:", model.score(X_test, y_test))
```

### Regression

```python
from sklearn.datasets import fetch_california_housing
from sklearn.model_selection import train_test_split
from pylwl import LwRegressor

X, y = fetch_california_housing(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)

reg = LwRegressor(kernel='gaussian', tau=1.0)
reg.fit(X_train, y_train)
print("R2 score:", reg.score(X_test, y_test))
```

Please read the [examples](/examples) folder for more use cases.


## 📚 Documentation

Documentation is available at: 👉 https://pylwl.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 `PyLWL`! 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{thieu20250517PyLWL,
  author       = {Nguyen Van Thieu},
  title        = {PyLWL: A Python Framework for Locally Weighted Learning},
  month        = may,
  year         = 2025,
  doi         = {10.6084/m9.figshare.29089784},
  url          = {https://github.com/thieu1995/PyLWL}
}
```

## Official Links 

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

---

Developed by: [Thieu](mailto:nguyenthieu2102@gmail.com?Subject=GrafoRVFL_QUESTIONS) @ 2025
