Skip to main content

Massively parallel implementation of self-organizing maps

Project description

Somoclu is a massively parallel implementation of self-organizing maps. It relies on OpenMP for multicore execution, MPI for distributing the workload, and it can be accelerated by CUDA. A sparse kernel is also included, which is useful for training maps on vector spaces generated in text mining processes. The topology of map is either planar or toroid, the grid is rectangular or hexagonal. Currently a subset of the command line version is supported with this Python module.

Key features of the Python interface:

  • Fast execution by parallelization: OpenMP and CUDA are supported.

  • Multi-platform: Linux, OS X, and Windows are supported.

  • Planar and toroid maps.

  • Rectangular and hexagonal grids.

  • Gaussian or bubble neighborhood functions.

  • Visualization of maps, including those that were trained outside of Python.

The documentation is available on Read the Docs. Further details are found in the manuscript describing the library [1].

Usage

A simple example is below. For more example, please refer to the documentation and a more thorough ipython notebook example at Somoclu in Python.ipynb.

import somoclu
import numpy as np
import matplotlib.pyplot as plt

c1 = np.random.rand(50, 2)/5
c2 = (0.2, 0.5) + np.random.rand(50, 2)/5
c3 = (0.4, 0.1) + np.random.rand(50, 2)/5
data = np.float32(np.concatenate((c1, c2, c3)))
colors = ["red"] * 50
colors.extend(["green"] * 50)
colors.extend(["blue"] * 50)

labels = list(range(150))
#labels[2] = None
#labels[41] = None
#labels[40] = None
n_rows, n_columns = 30, 50
som = somoclu.Somoclu(n_columns, n_rows, data=data, maptype="planar",
                      gridtype="rectangular")
som.train(epochs=10)
som.view_umatrix(bestmatches=True, bestmatchcolors=colors, labels=labels)

Installation

The code is available on PyPI, hence it can be installed by

$ sudo pip install somoclu

Some pre-built binaries in the wheel format or windows installer are provided at PyPI Dowloads, they are tested with Anaconda distributions. If you encounter errors like ImportError: DLL load failed: The specified module could not be found when import somoclu, you may need to use Dependency Walker as shown here on _somoclu_wrap.pyd to find out missing DLLs and place them at the write place. Usually right version (32/64bit) of vcomp90.dll, msvcp90.dll, msvcr90.dll should be put to C:\Windows\System32 or C:\Windows\SysWOW64.

The wheel binaries for OSX are compiled with clang-omp , and depend on libiomp5, which you can install by:

$ brew install libiomp

If you want the latest git version, first git clone the repo, install swig and run:

$ ./autogen.sh
$ ./configure [options]
$ make
$ make python

to generate python interface files.

Then follow the standard procedure for installing Python modules:

$ sudo python setup.py install

Build on Mac OS X

Using GCC

Since OS X 10.9, gcc is just symlink to clang. To build somoclu and this extension correctly, it is recommended to install gcc using something like:

$ brew install gcc --without-multilib

and set environment using:

export CC=/usr/local/bin/gcc-5
export CXX=/usr/local/bin/g++-5
export CPP=/usr/local/bin/cpp-5
export LD=/usr/local/bin/gcc-5
alias c++=/usr/local/bin/c++-5
alias g++=/usr/local/bin/g++-5
alias gcc=/usr/local/bin/gcc-5
alias cpp=/usr/local/bin/cpp-5
alias ld=/usr/local/bin/gcc-5
alias cc=/usr/local/bin/gcc-5

Using clang-omp

To install clang-omp, follow instructions at http://clang-omp.github.io/. And set environment using:

export CC=/usr/local/bin/clang-omp
export CXX=/usr/local/bin/clang-omp++
export CPP=/usr/local/bin/clang-omp++
export LD=/usr/local/bin/clang-omp
alias c++=/usr/local/bin/clang-omp++
alias g++=/usr/local/bin/clang-omp++
alias gcc=/usr/local/bin/clang-omp
alias cpp=/usr/local/bin/clang-omp++
alias ld=/usr/local/bin/clang-omp
alias cc=/usr/local/bin/clang-omp
export PATH=/usr/local/bin/:$PATH
export C_INCLUDE_PATH=/usr/local/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/include/:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

Before building the module manually with:

$ python setup.py build

Build with CUDA support on Linux and OS X:

If the CUDAHOME variable is set, the usual install command will build and install the library:

$ sudo python setup.py install

Build with CUDA support on Windows:

You should first follow the instructions to build the Windows binary with HAVE_MPI and CLI disabled with the same version Visual Studio as your Python is built with.(Since currently Python is built by VS2008 by default and CUDA v6.5 removed VS2008 support, you may use CUDA 6.0 with VS2008 or find a Python prebuilt with VS2010. And remember to install VS2010 or Windows SDK7.1 to get the option in Platform Toolset if you use VS2013.) The recommended configuration is VS2010 Platform Toolset with Python 3.4. Then you should copy the .obj files generated in the release build path to the Python\somoclu\src folder.

Then modify the environment variable CUDA_PATH or win_cuda_dir in setup.py to your CUDA path and run the install command

$ sudo python setup.py install

Then it should be able to build and install the module.

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.

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

somoclu-1.6.1.tar.gz (5.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

somoclu-1.6.1.win-amd64-py3.5.exe (176.6 kB view details)

Uploaded Source

somoclu-1.6.1.win-amd64-py3.4.exe (259.1 kB view details)

Uploaded Source

somoclu-1.6.1.win-amd64-py2.7.exe (258.3 kB view details)

Uploaded Source

somoclu-1.6.1.win32-py3.4.exe (222.7 kB view details)

Uploaded Source

somoclu-1.6.1.win32-py2.7.exe (226.0 kB view details)

Uploaded Source

somoclu-1.6.1-cp35-cp35m-win_amd64.whl (40.0 kB view details)

Uploaded CPython 3.5mWindows x86-64

somoclu-1.6.1-cp35-cp35m-macosx_10_11_x86_64.whl (40.2 kB view details)

Uploaded CPython 3.5mmacOS 10.11+ x86-64

somoclu-1.6.1-cp34-none-win_amd64.whl (36.3 kB view details)

Uploaded CPython 3.4Windows x86-64

somoclu-1.6.1-cp34-none-win32.whl (31.2 kB view details)

Uploaded CPython 3.4Windows x86

somoclu-1.6.1-cp34-cp34m-macosx_10_5_x86_64.whl (38.2 kB view details)

Uploaded CPython 3.4mmacOS 10.5+ x86-64

somoclu-1.6.1-cp27-none-win_amd64.whl (34.1 kB view details)

Uploaded CPython 2.7Windows x86-64

somoclu-1.6.1-cp27-none-win32.whl (29.3 kB view details)

Uploaded CPython 2.7Windows x86

somoclu-1.6.1-cp27-none-macosx_10_11_x86_64.whl (40.3 kB view details)

Uploaded CPython 2.7macOS 10.11+ x86-64

File details

Details for the file somoclu-1.6.1.tar.gz.

File metadata

  • Download URL: somoclu-1.6.1.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for somoclu-1.6.1.tar.gz
Algorithm Hash digest
SHA256 8f8d4a957c6a44494f54b1d00bcf8d9c5129cb6319bb8bbe925a611aa7215637
MD5 b75ab473d40cba60f5d7f4784b41577c
BLAKE2b-256 67372867d1952178a25d91282bcde57a84fe8473ab7088be19627bf6eb7e8134

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1.win-amd64-py3.5.exe.

File metadata

File hashes

Hashes for somoclu-1.6.1.win-amd64-py3.5.exe
Algorithm Hash digest
SHA256 2c2048a8ad2321867e422dcb5f7d09b823a75f11eaca069107b82403b8ecd69d
MD5 7ff4c0ea28bcd28b9398993382f4f1e4
BLAKE2b-256 d1981cdf6fa66c9a615045a8b0986a9211526fa31e34f6dd9c3617260b4060ae

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1.win-amd64-py3.4.exe.

File metadata

File hashes

Hashes for somoclu-1.6.1.win-amd64-py3.4.exe
Algorithm Hash digest
SHA256 91b514fd91942ca73b0c3a6d811a01bdfe4c99853642d3b88a7acca1411423a8
MD5 64399b0cd809cb35bf4b6c5f1d88ee66
BLAKE2b-256 d5b7cb9616b66cc8b16315b2651ba92ae06721247ea8e74d5067e798938d15e5

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1.win-amd64-py2.7.exe.

File metadata

File hashes

Hashes for somoclu-1.6.1.win-amd64-py2.7.exe
Algorithm Hash digest
SHA256 a0c32b5b60a89cbe4dd740c34cef5afe49ecb9934f184d584d08b3828e6abba6
MD5 81c1925d0d89737f6e0d8ed1985db274
BLAKE2b-256 e1ddaca2d55e33ca3b16248cf6d971d22a509a5ea87e2940bbcad6c175ba5ef7

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1.win32-py3.4.exe.

File metadata

File hashes

Hashes for somoclu-1.6.1.win32-py3.4.exe
Algorithm Hash digest
SHA256 a516612c8d28c0dca2ff7fdb2d5dd75f69c3f6c77cbb22f0856e904a0519b3ed
MD5 2504a51efc6650b3879fba8f6be80c1d
BLAKE2b-256 ca9218cd03cd7b88ce624e1fa4378baf19965d73f0e628a5a49bcfe03fff11a2

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1.win32-py2.7.exe.

File metadata

File hashes

Hashes for somoclu-1.6.1.win32-py2.7.exe
Algorithm Hash digest
SHA256 5bd069041e4d31d72061bd5e26a534879c538582f8efcaf02fc60f8ace7c1574
MD5 6c4288b80a9612a83e8294dfe017f530
BLAKE2b-256 e2595670ae17c5388f6e40167e200c0490a3d94f01c96c7c9b44dc38ec7f3428

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 093c8d47020a569bebcae89628e983d68eb06c027ecfe0618418fa01bcaaef74
MD5 a38e2dd4566412c63ec5b5101c227f6f
BLAKE2b-256 c5a4d0e46c612023502b24588b3f23b697959749793b0ba05ed9f423cd3df636

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp35-cp35m-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp35-cp35m-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 312bf0d831ee90efda52940f262e6e65e3ef836fea057daafece1e588a0a0a49
MD5 e8aef774e93fe47a990798e7771173a2
BLAKE2b-256 d1c1286a6e3bb83c39d1f2938678b722cd22c224a34ca94f9638928b9af0a8f8

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp34-none-win_amd64.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp34-none-win_amd64.whl
Algorithm Hash digest
SHA256 70a93a5706099120085c13b1a0b6313d70e26abef0808953cd43e3bbf8a2423f
MD5 607fbd88a725fcf5f6ee38af2365d733
BLAKE2b-256 13d8f7071468e13d30787dccb44d492f784ea096763e774ac05c7b5fd20f5d5a

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp34-none-win32.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp34-none-win32.whl
Algorithm Hash digest
SHA256 dddf5e422dd4a90b43d755f9418ee0f482d5a973f044c1ed118212f5d68c2786
MD5 7b6c9e0a24c610c52363229ee0f64700
BLAKE2b-256 3644b450ed43a3ae7ff74a74783350b57bf0e65b4470b61635edb270dfd65f4d

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp34-cp34m-macosx_10_5_x86_64.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp34-cp34m-macosx_10_5_x86_64.whl
Algorithm Hash digest
SHA256 36d71ee18d7b198c81cdceb394a3813624a2e4b563d3478831f78712e5e74424
MD5 b1e7b2ad72d0693953c85295eb2b9112
BLAKE2b-256 ad69cd196fd44d7b52e2d8402edf196e5eaf3e162d1f2e5141f4ead28447bd5f

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 9726359866d3ff0d81fd442af1273ae93f7cf021267fdc3b238710ca36d8779f
MD5 d2d7dc22716485618d9ab892b7065ac4
BLAKE2b-256 7239cb5c9dc0724c285225abc539b02d0af77e6e619eb7aa73d0a4af9eab4216

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp27-none-win32.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp27-none-win32.whl
Algorithm Hash digest
SHA256 d676c9a115b3a0edac4988013d00c2ca1164e7d4ef06c018ce7e56a13611b94b
MD5 636385feb91033158ff359e5b2501ba3
BLAKE2b-256 8325bd97108ea5bcf9eae962f3e5756136c777c38463ac083499ff39baae0133

See more details on using hashes here.

File details

Details for the file somoclu-1.6.1-cp27-none-macosx_10_11_x86_64.whl.

File metadata

File hashes

Hashes for somoclu-1.6.1-cp27-none-macosx_10_11_x86_64.whl
Algorithm Hash digest
SHA256 37ab6790694a761222a26022fd10315fc1b240d7e40bff328260bf08a2d5b387
MD5 50b19cf29b2e2567e21ea8135ac577e1
BLAKE2b-256 6ff703939347c04b265d07142c8566048086b9f56b780db8c04c0fdf9ed07893

See more details on using hashes here.

Supported by

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