Skip to main content

Kernel Density Estimation classifier with scikit-learn style API, based on Yang Liu et al. (2020).

Project description

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/

Code adapted from: 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

pip install kde-classifier

Usage example

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:

pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kde_classifier-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kde_classifier-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file kde_classifier-0.1.0.tar.gz.

File metadata

  • Download URL: kde_classifier-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for kde_classifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f8ceb7f722eba56677770f208323555922e5b43bfa7d82efb6afca76c6058c69
MD5 4c4d771ff5846e9bbd3bc1a6ccb664c2
BLAKE2b-256 a6fb1ae53b49a52163f96b5fd2fb4cabb70ec2ff907eaee1a9fd1dc9558f46b4

See more details on using hashes here.

File details

Details for the file kde_classifier-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: kde_classifier-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for kde_classifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c978c81491ba3958c9699ee02ef1a939aa8f77a58300a4bdaa17bba837c0bcb
MD5 c8b4ee6bedd31ee48aecdd996864f52c
BLAKE2b-256 593877988782c054623399411ca68396474283a42a485d97756b9f09832a568e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page