Skip to main content

ImpKMeans: Improved K-Means initialization using KDE + KD-Tree

Project description

PyPI version License: MIT Python 3.7+

ImpKMeans

ImpKMeans is an improved version of the K-Means clustering algorithm, designed to automatically determine high-quality initial centroids using:

  • Multivariate Kernel Density Estimation (KDE)
  • KD-Tree–based radius suppression
  • Mode-seeking peak extraction

Motivation

🚀 Features

  • KDE-based high-density region detection
  • Intelligent centroid selection via KD-Tree radius filtering
  • Deterministic behavior with random_state
  • Fully compatible with scikit-learn API (fit, fit_predict, predict, get_params, set_params)
  • Lightweight and fast

📦 Installation

Install directly from PyPI:

pip install impkmeans

Basic Usage

from sklearn.datasets import load_iris
from impkmeans import ImpKmeans

# Load dataset
data = load_iris()
X, y = data.data, data.target

model = ImpKMeans(k=7, r=0.7245, random_state=42)
labels = model.fit_predict(X)

ARI=adjusted_rand_score(y, labels)
print("Adjusted Rand Index = %0.4f"%ARI)

Cite

If you use the code in your works, please cite the paper given below:

Şenol, A. (2024). Impkmeans: An improved version of the k-means algorithm, by determining 
optimum initial centroids, based on multivariate kernel density estimation and kd-tree. 
Acta Polytechnica Hungarica, 21(2), 111-131.
@article{csenol2024impkmeans,
  title={Impkmeans: An improved version of the k-means algorithm, by determining optimum initial centroids, based on multivariate kernel density estimation and kd-tree},
  author={{\c{S}}enol, Ali},
  journal={Acta Polytechnica Hungarica},
  volume={21},
  number={2},
  pages={111--131},
  year={2024}
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

impkmeans-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

impkmeans-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file impkmeans-1.0.0.tar.gz.

File metadata

  • Download URL: impkmeans-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for impkmeans-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5e7489ac85bb6e4d09398e31b0150d1c68a4aa4872fab2765c001aff01f290c8
MD5 1f794487bf3b474c8f3c5faad9c49fe1
BLAKE2b-256 4b83c92812a4062f5cbe1db7e78363de31caf288cf2ba6c8cd3c592eda0925c9

See more details on using hashes here.

File details

Details for the file impkmeans-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: impkmeans-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for impkmeans-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e31a51e5213e608c711bc54b71e39b43090ba0b3f5d80abe2d11758100c5bec8
MD5 eaeecba78d31331deeccf6642d0e687f
BLAKE2b-256 b3fbf0f5bf1185adf9fff93371c231df4dc6a1f442689fd7cde40a42e13b6a95

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