https://github.com/sunho/kmor-np
K-means clustering with outlier removal algorithm numpy implementation
https://github.com/sunho/kmor-np
Last synced: about 2 months ago
JSON representation
K-means clustering with outlier removal algorithm numpy implementation
- Host: GitHub
- URL: https://github.com/sunho/kmor-np
- Owner: sunho
- License: mit
- Created: 2020-05-08T17:23:31.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-10T00:26:45.000Z (about 5 years ago)
- Last Synced: 2025-03-25T20:33:04.040Z (2 months ago)
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KMOR Numpy
The python implementation for k-means clustering with outlier removal from the paper written by Guojun Gan et al. [[1]](#1)
## Installation
```
pip install kmor
```You can also install by conda
```
conda install -c ksunhokim kmor
```## Example
```python
import numpy as np
from kmor import kmor
X = np.array([
[1,0,0],
[0,1,0],
[0,0,1],
[0,0,100]
])
U = kmor(X, 1)
print(U) # [0,0,0,1]
```The outliers are assigned to the extra cluster k.
## Documentation
kmor(X, k, y, nc0, max_iteration, gamma)
| Parameter | Description |
|---------------|--------------------------------------------------------------------------------|
| X | Your data. |
| k | Number of clusters. |
| y | Parameter for outlier detection. (default=3) Increase this to make outlier removal subtle. |
| nc0 | Maximum percentage of your data that can be assigned to outlier cluster. (default=0.1) |
| max_iteration | Maximum number of iterations. |
| gamma | Used to check the convergence. |## References
[1] Gan, Guojun, and Michael Kwok-Po Ng. "K-means clustering with outlier removal." Pattern Recognition Letters 90 (2017): 8-14.