Metadata-Version: 2.0
Name: somlib
Version: 0.0.3
Summary: This is python implementation for Kohonen Self Organizing map using numpy and tensor
Home-page: https://github.com/pankajr141/SOM
Author: Pankaj Rawat
Author-email: pankajr141@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: scipy
Requires-Dist: tensorflow

# SOM
This is python implementation for Kohonen Self Organizing map using numpy and tensor

## Installtion

**Python 3**
`pip install somlib`

## Usage

1. Numpy implementation
```
    s = 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

```
    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")

