MCMSTStream: applying minimum spanning tree to KD-tree-based micro-clusters to define arbitrary-shaped clusters in streaming data
Project description
MCMSTStream
MCMSTStream is a density-based stream clustering algorithm that applies a Minimum Spanning Tree (MST) over KD-tree-based micro-clusters to define arbitrary-shaped clusters in streaming data.
Published in Neural Computing and Applications (2024) 36:7025–7042.
Key features
- Online (sliding-window) stream clustering
- Detects arbitrary-shaped (non-spherical) clusters
- Robust to outliers and noisy data
- Handles high-dimensional streams via KD-tree range search
- Scikit-learn-style API:
fit,partial_fit,fit_predict,predict,get_params,set_params
Installation
pip install mcmststream
For the built-in visualization support:
pip install "mcmststream[viz]"
Quick start
import numpy as np
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import adjusted_rand_score
from mcmststream import MCMSTStream, load_exclastar
# Load the bundled ExclaStar benchmark dataset
X, y_true = load_exclastar()
X = MinMaxScaler().fit_transform(X)
clusterer = MCMSTStream(
W=190, # sliding window width
N=2, # min points to define a micro-cluster
r=0.23, # micro-cluster radius
n_micro=2, # min micro-clusters to define a macro-cluster
dense_mc_promotion=True,
random_state=42,
keep_history=True,
)
# Process the stream point by point
for point in X:
clusterer.partial_fit(point)
clusterer.visualize(title="MCMSTStream on ExclaStar") # to see step-by-step visual redults
print("ARI = %.4f" % adjusted_rand_score(y_true, clusterer.history_labels_))
Optional visualization of the current window:
clusterer.visualize(title="MCMSTStream on ExclaStar")
Parameters
| Parameter | Description | Paper symbol |
|---|---|---|
W |
Sliding window width | W |
N |
Minimum number of points within radius r to define a micro-cluster |
N |
r |
Micro-cluster radius; micro-clusters within 2r are linked by the MST |
r |
n_micro |
Minimum number of micro-clusters to form a macro-cluster | n_micro |
dense_mc_promotion |
If True, a component whose total point count is ≥ n_micro * N also becomes a macro-cluster even with fewer than n_micro micro-clusters (extension beyond the paper; default False) |
— |
How it works
- Micro-clusters are formed with a KD-tree range search: at least
Npoints within radiusr. - Macro-clusters are built by running Prim's MST over micro-cluster
centers, connecting those within
2r. - As the stream evolves, micro/macro-clusters are updated, merged, or deleted, adapting to concept drift.
Citation
If you use this package in your research, please cite:
@article{erdinc2024mcmststream,
title = {MCMSTStream: applying minimum spanning tree to KD-tree-based
micro-clusters to define arbitrary-shaped clusters in streaming data},
author = {Erdin{\c{c}}, Berfin and Kaya, Mahmut and {\c{S}}enol, Ali},
journal = {Neural Computing and Applications},
volume = {36},
number = {13},
pages = {7025--7042},
year = {2024},
doi = {10.1007/s00521-024-09443-1}
}
Related projects
- MCMSTClustering — the batch (static data) counterpart
- KD-AR Stream — KD-tree and adaptive radius stream clustering
License
MIT — see LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcmststream-1.2.2.tar.gz.
File metadata
- Download URL: mcmststream-1.2.2.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a1669dad10324aad5035dd75903a2142a096f906936485038cd86179d84668b
|
|
| MD5 |
9e8780aa747c8e1c4e21745d15951c41
|
|
| BLAKE2b-256 |
f13d4323c5199d362b34ca13259b1fe9c3ec74d32bffeaabcd95e94e1a355418
|
Provenance
The following attestation bundles were made for mcmststream-1.2.2.tar.gz:
Publisher:
publish.yml on senolali/MCMSTStream
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcmststream-1.2.2.tar.gz -
Subject digest:
6a1669dad10324aad5035dd75903a2142a096f906936485038cd86179d84668b - Sigstore transparency entry: 2083233974
- Sigstore integration time:
-
Permalink:
senolali/MCMSTStream@8cff5188784fd985675fa98302b6437d5617a816 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/senolali
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8cff5188784fd985675fa98302b6437d5617a816 -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcmststream-1.2.2-py3-none-any.whl.
File metadata
- Download URL: mcmststream-1.2.2-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e67a529c1a926d5660d2e4a1fe329ff16b7aeb2348551095779214ae7795136f
|
|
| MD5 |
f4cd474f250c649580ab2e671e887818
|
|
| BLAKE2b-256 |
59911d07c69769df62fdb2117939d4a56f36bf8122e661a9f0fb73ca7f4a1fd7
|
Provenance
The following attestation bundles were made for mcmststream-1.2.2-py3-none-any.whl:
Publisher:
publish.yml on senolali/MCMSTStream
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcmststream-1.2.2-py3-none-any.whl -
Subject digest:
e67a529c1a926d5660d2e4a1fe329ff16b7aeb2348551095779214ae7795136f - Sigstore transparency entry: 2083234064
- Sigstore integration time:
-
Permalink:
senolali/MCMSTStream@8cff5188784fd985675fa98302b6437d5617a816 -
Branch / Tag:
refs/tags/v1.2.2 - Owner: https://github.com/senolali
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8cff5188784fd985675fa98302b6437d5617a816 -
Trigger Event:
release
-
Statement type: