Home

Awesome

Build Status Win status Coverage Status codecov.io

Somoclu.jl - Julia Interface for Somoclu

Somoclu is a massively parallel implementation of self-organizing maps. It relies on OpenMP for multicore execution and it can be accelerated by CUDA. The topology of map is either planar or toroid, the grid is rectangular or hexagonal.

Key features of the Julia interface:

Usage

A simple example is as follows.

using Somoclu

ncolumns, nrows = 40, 30;
ndimensions, nvectors = 2, 50;
c1 = Array{Float32}(rand(ndimensions, nvectors) ./ 5);
c2 = Array{Float32}(rand(ndimensions, nvectors) ./ 5 .+ [0.2; 0.5]);
c3 = Array{Float32}(rand(ndimensions, nvectors) ./ 5 .+ [0.4; 0.1]);
data = hcat(c1, c2, c3);
som = Som(ncolumns, nrows, maptype="toroid")
train!(som, data);

Then you can plot the result with a plotting package of your choice. For example:

using PyPlot
class_colors = vcat(["red" for _=1:50], ["blue" for _=1:50], ["green" for _=1:50]);
imshow(som.umatrix, cmap="Spectral_r")
scatter(som.bmus[1, :], som.bmus[2, :], c=class_colors)

Citation

  1. Peter Wittek, Shi Chao Gao, Ik Soo Lim, Li Zhao (2015). Somoclu: An Efficient Parallel Library for Self-Organizing Maps. arXiv:1305.1422.