https://github.com/pankajr141/som
This is python implementation for Kohonen Self Organizing map using numpy and tensor
https://github.com/pankajr141/som
clustering gpu-computing neural-network self-organizing-map tensorflow
Last synced: 12 months ago
JSON representation
This is python implementation for Kohonen Self Organizing map using numpy and tensor
- Host: GitHub
- URL: https://github.com/pankajr141/som
- Owner: pankajr141
- Created: 2018-03-29T11:49:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-09T14:30:05.000Z (almost 8 years ago)
- Last Synced: 2025-04-14T21:54:02.495Z (about 1 year ago)
- Topics: clustering, gpu-computing, neural-network, self-organizing-map, tensorflow
- Language: Python
- Size: 14.6 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SOM
This is python implementation for Kohonen Self Organizing map using numpy and tensor
## Installtion
**Python 3**
`pip install somlib`
## Usage
1. Numpy implementation
```
from somlib import som
s = som.SOM(neurons=(5,5), dimentions=3, n_iter=500, learning_rate=0.1)
s.train(samples) # samples is a n x 3 matrix
print("Cluster centres:", s.weights_)
print("labels:", s.labels_)
result = s.predict(samples)
```
Here 5,5 is the dimention of neurons, 3 is the number of features. samples is numpy array with each sample a 3 dimentional vector
2. Tensor implementation
```
from somlib import som
s = SOM(neurons=(5,5), dimentions=3, n_iter=500, learning_rate=0.1, mode="tensor")
s.train(samples) # samples is a n x 3 matrix
print("Cluster centres:", s.weights_)
print("labels:", s.labels_)
result = s.predict(samples)
```
### Display clusters
To display clusters after training use this
```s.displayClusters(samples)```
