Metadata-Version: 2.1
Name: spike-cluster-score
Version: 0.0.1
Summary: Spike Cluster Score (SCS) is a clustering performance metric designed with the purpose of spike sorting in mind
Home-page: https://github.com/ArdeleanRichard/Spike-Cluster-Score
Author: Eugen-Richard Ardelean
Author-email: ardeleaneugenrichard@gmail.com
License: MIT
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.7
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE.txt

# Spike-Cluster-Score
Spike Cluster Score (SCS) is a clustering performance metric designed with the purpose of spike sorting in mind. Like Purity, it will evaluate the clustering of each sample as its own cluster as a perfect clustering. SCS was developed to not punish overclustering, as overclustering is acceptable for some applications. SCS was developed as underclustering was considered unacceptable and Purity did not penalise enough the underclustering of K-Means and DBSCAN. As a result, the score of Purity was similar across all algorithms. It is the user’s responsibility to evaluate how much overclustering is acceptable for each dataset. Clustering each sample as its own cluster will receive a perfect score but will not provide information. We recommend using SCS together with other performance evaluation metrics, while taking into consideration the weaknesses of each metric.

SCS was published in Frontiers in Computational Neuroscience, alongside with a clustering algorithm.

Install:
```
pip install spike-cluster-score
```

Usage example:
```
import numpy as np
from sklearn.cluster import KMeans

from spike_cluster_score import spike_cluster_score

for sim_nr in [1,4,21,22,30]:
    X = np.load(f"./data/sim{sim_nr}_data.npy")
    y = np.load(f"./data/sim{sim_nr}_labels.npy")

    nr_clusters = len(np.unique(y))
    kmeans = KMeans(n_clusters=nr_clusters, random_state=0).fit(X)

    print(f"{spike_cluster_score(y, kmeans.labels_):.3f}")

```

## Citation
We would appreciate it, if you cite the paper when you use this work:

- For Plain Text:
```
E.-R. Ardelean, A.-M. Ichim, M. Dînşoreanu, and R. C. Mureşan, “Improved space breakdown method – A robust clustering technique for spike sorting,” Frontiers in Computational Neuroscience, vol. 17, 2023, doi: 10.3389/fncom.2023.1019637.
```

- BibTex:
```
@ARTICLE{10.3389/fncom.2023.1019637,
AUTHOR={Ardelean, Eugen-Richard and Ichim, Ana-Maria and Dînşoreanu, Mihaela and Mureşan, Raul Cristian},   
TITLE={Improved space breakdown method – A robust clustering technique for spike sorting},      
JOURNAL={Frontiers in Computational Neuroscience},      
VOLUME={17},           
YEAR={2023},      
URL={https://www.frontiersin.org/articles/10.3389/fncom.2023.1019637},       
DOI={10.3389/fncom.2023.1019637}      
}
```
