Metadata-Version: 2.4
Name: kde_classifier
Version: 0.1.0
Summary: Kernel Density Estimation classifier with scikit-learn style API, based on Yang Liu et al. (2020).
Author: Yang Liu, Hongxia He, Zhi-Xiong Xiao, Anquan Ji, Jian Ye, Qifan Sun, Yang Cao, Daniel Grønhaug
License: MIT
Project-URL: Homepage, https://github.com/danielftg/KDEClassifier
Project-URL: Repository, https://github.com/danielftg/KDEClassifier
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.26.4
Dynamic: license-file

# KDEClassifier

A pip-installable distribution of KDEClassifier introduced by:  
Yang Liu, Hongxia He, Zhi-Xiong Xiao, Anquan Ji, Jian Ye, Qifan Sun, Yang Cao.  
See: [https://pubmed.ncbi.nlm.nih.gov/33313714/](https://pubmed.ncbi.nlm.nih.gov/33313714/)

Code adapted from: [http://cao.labshare.cn/KDEClassifier/index.html](http://cao.labshare.cn/KDEClassifier/index.html)

This repository provides two implementations:

* **`kde_classifier.KDEClassifier`** — An enhanced version of the original implementation; vectorized and sklearn-compatible.
* **`tests/KDEClassifier_orig.py`** — the original reference implementation (kept for comparison and tests).

---


## Installation
```bash
pip install kde-classifier
```

## Usage example

```python
from kde_classifier import KDEClassifier

clf = KDEClassifier(mybandwidth=0.7)
clf.fit(X_train, y_train)
probs = clf.predict_proba(X_test)
preds = clf.predict(X_test)
```

`predict_proba` always returns a 2-D array shaped `(n_samples, n_classes)` (even when `n_samples==0`).

---


## Tests

A pytest test file is provided under `tests/` that compares the original implementation with the new one on synthetic datasets. Run tests with:

```bash
pytest -q
```

---

