Skip to main content

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for somlib, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size somlib-0.0.4-py2-none-any.whl (10.2 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size somlib-0.0.4.tar.gz (6.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page