Minimalistic implementation of the Self Organizing Maps (SOM) employing GPU.
Project description
MiniSom![](https://pypi-camo.freetls.fastly.net/010d748477908e418555e2428d24c26ecc87c87b/68747470733a2f2f332e62702e626c6f6773706f742e636f6d2f2d5f3655444745487a4972732f57536669796a6d6f6552492f41414141414141414248772f335551796c63434245685566484e6866353657534842426d5136675f6c58516877434c63422f733332302f6d696e69736f6d5f6c6f676f2e706e67)
Self Organizing Maps
MiniSom GPU is a minimalistic and PyTorch based implementation of the Self Organizing Maps (SOM). SOM is a type of Artificial Neural Network able to convert complex, nonlinear statistical relationships between high-dimensional data items into simple geometric relationships on a low-dimensional display. Minisom is designed to allow researchers to easily build on top of it and to give students the ability to quickly grasp its details.
This repository is a fork of the original MiniSom package.
Installation
Just use pip:
pip install minisom_gpu
How to use it
In order to use MiniSom you need your data organized as a PyTorch tensor where each row corresponds to an observation like the following:
import torch
data = torch.tensor([[ 0.80, 0.55, 0.22, 0.03],
[ 0.82, 0.50, 0.23, 0.03],
[ 0.80, 0.54, 0.22, 0.03],
[ 0.80, 0.53, 0.26, 0.03],
[ 0.79, 0.56, 0.22, 0.03],
[ 0.75, 0.60, 0.25, 0.03],
[ 0.77, 0.59, 0.22, 0.03]])
Then you can train MiniSom just as follows:
from minisom_gpu.som import MiniSom
som = MiniSom(6, 6, 4, sigma=0.3, learning_rate=0.5) # initialization of 6x6 SOM
som.train(data, 100) # trains the SOM with 100 iterations
You can obtain the position of the winning neuron on the map for a given sample as follows:
som.winner(data[0])
For an overview of all the features implemented in minisom you can browse the following examples: https://github.com/rctorres/minisom/tree/master/examples
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
Built Distribution
Hashes for minisom_gpu-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23eee85ea26db829becc14b031df4f27bc56bb06f39d8b7d2bf8b7cbee9e6933 |
|
MD5 | b2aa3273982f68a31c465809d0e6c3a2 |
|
BLAKE2b-256 | 376d97ad39db8685137b5d6c7750464dc208d09feb685fbcc114bb046f45e72d |