https://github.com/orrorcol/soinn
SOINN / 聚类 / 无监督聚类 / 快速 / clustering / unsupervised clustering / fast
https://github.com/orrorcol/soinn
clustering clustering-algorithm cpp14 python soinn unsupervised-clustering unsupervised-learning
Last synced: 13 days ago
JSON representation
SOINN / 聚类 / 无监督聚类 / 快速 / clustering / unsupervised clustering / fast
- Host: GitHub
- URL: https://github.com/orrorcol/soinn
- Owner: orrorcol
- License: mit
- Created: 2021-04-21T07:10:54.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-28T12:45:11.000Z (almost 4 years ago)
- Last Synced: 2025-04-10T01:14:13.664Z (13 days ago)
- Topics: clustering, clustering-algorithm, cpp14, python, soinn, unsupervised-clustering, unsupervised-learning
- Language: C++
- Homepage:
- Size: 1.05 MB
- Stars: 19
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
```
____ ___ ___ _ _ _ _
/ ___| / _ \_ _| \ | | \ | |
\___ \| | | | || \| | \| |
___) | |_| | || |\ | |\ |
|____/ \___/___|_| \_|_| \_|```
SOINN is a blazing fast unsupervised clustering algorithm.
This is the repo for python package soinn.## Install
`
pip install soinn
`## Build by hand
`
python -m build
`## API
`learn(data: object = None, dead_age: int = 100, lambda: int = 100, noise: float = 0.5, num_layer: int = 1) -> object`
**input** : numpy array of shape (n, dim)
**dead_age** : the dead age of edges during the learning process, default 100
**lamda** : the number of iterations before removing noise, default 100
**noise** : the ratio of noise in input data, default 0.5
**num_layer** : the number of soinn layer, default 1
**return** : return a numpy array contaning all learned cendrioids, shape (n1, dim) where
n1 represents the number of cendrioids.## Run demo
Here is a simple code using SOINN to learn cendroids of the input data```python
from scipy.io import loadmatimport matplotlib.pyplot as plt
import soinn
data = loadmat("train.mat")['train']
print('Load data with shape', data.shape)
ax=plt.subplot(121)
ax.set_title('origin data')
plt.plot(data[:,0], data[:,1], '.')
clus = soinn.learn(data)
print('soinn learned clusters with shape', clus.shape)
ax=plt.subplot(122)
ax.set_title('learned cendroids')
plt.plot(clus[:,0], clus[:,1], '.')
plt.show()
```You can run it by:
`
cd demo && python demo.py
`You can get the following result
