This is python implementation for Kohonen Self Organizing map using numpy and tensor
Project description
# 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)```
![clusters](https://image.ibb.co/hS4uCH/figure_3.png "Clusters")
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)```
![clusters](https://image.ibb.co/hS4uCH/figure_3.png "Clusters")
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
somlib-0.0.4.tar.gz
(6.1 kB
view details)
Built Distribution
somlib-0.0.4-py2-none-any.whl
(10.2 kB
view details)
File details
Details for the file somlib-0.0.4.tar.gz
.
File metadata
- Download URL: somlib-0.0.4.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 620ddbf1beb61e25725b66198cb50e59847401e55ea270dc346d030bffe6e117 |
|
MD5 | 54fdc5e776ce81e7e15b68a2bc4b94a1 |
|
BLAKE2b-256 | 28c38d500699b256fda57c6ee2bee42cc34035fa30a71ed8b05e6fc9403fe9f2 |
File details
Details for the file somlib-0.0.4-py2-none-any.whl
.
File metadata
- Download URL: somlib-0.0.4-py2-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/2.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3dbeed2556138fc568a38a40a32ad755e4bbd877e09532ff91a5f2efd89d8094 |
|
MD5 | ae047c625289ed67a8650cdf99e0783f |
|
BLAKE2b-256 | c463be68a94599eaa0fb880751b86607dc09cb31a4918d96b60ea47e71833427 |