Skip to main content

Multi-Center Minimum Spanning Tree Clustering algorithm

Project description

Motivation

MCMSTClustering is a minimum-cost MST based clustering algorithm.
It uses MST distances and optional DBSCAN to detect clusters in high-dimensional data.

Installation

pip install MCMSTClustering

Usage

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_moons, make_blobs, make_circles
from sklearn.preprocessing import MinMaxScaler
# Import the MCMSTClustering package
from mcmst_clust import MCMSTClustering, normalize

# =============================================================================
# EXAMPLE 1: BASIC USAGE WITH SYNTHETIC DATA
# =============================================================================

print("=" * 60)
print(" BASIC USAGE WITH SYNTHETIC DATA")
print("=" * 60)

# Generate synthetic data (two moons)
X_moons, y_moons = make_moons(n_samples=300, noise=0.05, random_state=42)

# Normalize the data (important for distance-based clustering)
X_moons_normalized = normalize(X_moons)

# Initialize the MCMSTClustering model
# Parameters from the paper:
# N: Minimum number of data points to define a Micro Cluster (default: 5)
# r: Radius of the Micro Cluster (default: 0.05)
# n_micro: Minimum number of Micro Clusters to define a Macro Cluster (default: 5)
model = MCMSTClustering(N=5, r=0.05, n_micro=3)

# Fit the model to the data
model.fit(X_moons_normalized)

# Get cluster labels
labels = model.labels_

Oerview

MCMSTClustering (Defining Non-Spherical Clusters by using Minimum Spanning Tree over KD-Tree-based Micro-Clusters) is designed to overcome limitations of conventional clustering algorithms when handling:

- High-dimensional data

- Imbalanced datasets

- Clusters with varying densities

- Noisy data/outliers

- Arbitrary-shaped clusters

The algorithm consists of three main steps:

1. Micro-cluster Formation: Defines micro-clusters using a KD-Tree data structure with range search.

2. Macro-cluster Construction: Builds a minimum spanning tree (MST) over the micro-clusters to form macro-clusters.

3. Cluster Regulation: Refines the clusters to improve accuracy and overall clustering quality.

Extensive experiments against state-of-the-art algorithms show that MCMSTClustering achieves high-quality clustering results with acceptable runtime.

Key Features

- Clusters datasets with high quality

- Detects arbitrary-shaped clusters

- Robust against outliers/noisy data

- Handles clusters with varying densities

- Efficient on imbalanced datasets

Cite

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

Şenol, A. MCMSTClustering: defining non-spherical clusters by using minimum 
spanning tree over KD-tree-based micro-clusters. Neural Comput & Applic 35, 
13239–13259 (2023). https://doi.org/10.1007/s00521-023-08386-3

BibTeX

@article{csenol2023mcmstclustering,
  title={MCMSTClustering: defining non-spherical clusters by using minimum spanning tree over KD-tree-based micro-clusters},
  author={{\c{S}}enol, Ali},
  journal={Neural Computing and Applications},
  volume={35},
  number={18},
  pages={13239--13259},
  year={2023},
  publisher={Springer}
}

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

mcmst_clust-1.0.3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

mcmst_clust-1.0.3-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file mcmst_clust-1.0.3.tar.gz.

File metadata

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

File hashes

Hashes for mcmst_clust-1.0.3.tar.gz
Algorithm Hash digest
SHA256 bc9a95243f29299612c1018b936f79b47b7239be734d216eef8a7b2082d3546a
MD5 29e430727458b34ed8a5fb00388b8067
BLAKE2b-256 a6777928633b8954100886b46673348e516e981d9e1589d5982c651cbecc681a

See more details on using hashes here.

File details

Details for the file mcmst_clust-1.0.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mcmst_clust-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 59456680367c443c956b715ced07b65b8334701193f497b00bf8beaf1c3e4e04
MD5 e3774b5d19cdb1e4bc57293c8e0a97b4
BLAKE2b-256 52892f7206de82a74264a402761467fa852ced424d156bf8f96f6fd96a212de1

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