Skip to main content

A lightweight Python library for Kohonen Self-Organising Maps

Project description

Version 1.1

SimpSOM is a lightweight implementation of Kohonen Self-Organising Maps (SOM) for Python 2.7, useful for unsupervised learning, clustering and dimensionality reduction.

The package is now available on PyPI, to retrieve it just type pip install SimpSOM or download it from here and install with python setup.py install.

It allows to build and train SOM on your dataset, save/load the trained network weights, and display or print graphs of the network with selected features. The function run_colorsExample() will run a toy model, where a number of colors will be mapped from the 3D RGB space to the 2D network map and clustered according to their similarity in the origin space.

Dependencies

  • Numpy 1.11.0 (older versions may work);

  • Matplotlib 1.5.1 (older versions may work);

  • Sklearn 0.15 (older versions may work), optional, needed only for clustering with algorithms other than Quality Threshold.

Example of Usage

Here is a quick example on how to use the library with a raw_data dataset:

#Import the library
import SimpSOM as sps

#Build a network 20x20 with a weights format taken from the raw_data.
net = sps.somNet(20, 20, raw_data)

#Train the network for 10000 epochs and with initial learning rate of 0.1.
net.train(10000, 0.01)

#Save the weights to file
net.save('filename_weights')

#Print a map of the network nodes and colour them according to the first feature (column number 0) of the dataset
#and then according to the distance between each node and its neighbours.
net.nodes_graph(colnum=0)
net.diff_graph()

#Project the datapoints on the new 2D network map.
net.project(raw_data, labels=labels)

#Cluster the datapoints according to the Mean Shift algorithm from sklearn.
net.cluster(raw_data, type='MeanShift')

What’s New

  • Clustering is now possible with the cluster command, Quality Threshold and a few sklearn clustering algorithms are availabe.

TO DOs:

  • Update the available cluster algorithms from sklearn;

  • Add documentation.

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

SimpSOM-1.1.2.tar.gz (7.6 kB view details)

Uploaded Source

File details

Details for the file SimpSOM-1.1.2.tar.gz.

File metadata

  • Download URL: SimpSOM-1.1.2.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for SimpSOM-1.1.2.tar.gz
Algorithm Hash digest
SHA256 1833675bd0a8a77e1c17f9da07224a850d6730e3f392c4b7130398c01f2b312e
MD5 4958e6b2e995ecf3d3ca5fe8a02c63f2
BLAKE2b-256 33f47669d318ee0d3bf36e96bce1f2ca234bb4237034e83ff786f409813d5634

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page