a cluster-oriented 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 on a GPU cluster. A sparse kernel is also included, which is useful for training maps on vector spaces generated in text mining processes. The topology of the grid is rectangular.
Currently a subset of the C++ version is supported with this package.
Homepage: https://github.com/peterwittek/somoclu
Example, in which the data file rgbs.txt can be found at https://github.com/peterwittek/somoclu/tree/master/data
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import somoclu
import numpy as np
data = np.loadtxt('rgbs.txt')
print(data)
data = np.float32(data)
nSomX = 50
nSomY = 50
nVectors = data.shape[0]
nDimensions = data.shape[1]
data1D = np.ndarray.flatten(data)
nEpoch = 10
radius0 = 0
radiusN = 0
radiusCooling = "linear"
scale0 = 0
scaleN = 0.01
scaleCooling = "linear"
kernelType = 0
mapType = "planar"
snapshots = 0
initialCodebookFilename = ''
codebook_size = nSomY * nSomX * nDimensions
codebook = np.zeros(codebook_size, dtype=np.float32)
globalBmus_size = int(nVectors * int(np.ceil(nVectors/nVectors))*2)
globalBmus = np.zeros(globalBmus_size, dtype=np.intc)
uMatrix_size = nSomX * nSomY
uMatrix = np.zeros(uMatrix_size, dtype=np.float32)
somoclu.trainWrapper(data1D, nEpoch, nSomX, nSomY,
nDimensions, nVectors,
radius0, radiusN,
radiusCooling, scale0, scaleN,
scaleCooling, snapshots,
kernelType, mapType,
initialCodebookFilename,
codebook, globalBmus, uMatrix)
print codebook
print globalBmus
print uMatrix
Get it now
$ sudo pip install somoclu
Build on Mac OS X:
Before installing using pip, gcc should be installed first. As of 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 gcc48
and set environment using:
export CC=/usr/local/bin/gcc export CXX=/usr/local/bin/g++ export CPP=/usr/local/bin/cpp export LD=/usr/local/bin/gcc alias c++=/usr/local/bin/c++ alias g++=/usr/local/bin/g++ alias gcc=/usr/local/bin/gcc alias cpp=/usr/local/bin/cpp alias ld=/usr/local/bin/gcc alias cc=/usr/local/bin/gcc
Then you can
$ sudo pip install somoclu
Build with CUDA support on Linux:
You need to clone this repo or download the latest release tarball, and
$ cd src/Python $ bash makepy.sh
Then if your CUDA installation is located at /opt/cuda and 64bit, you can do the following to install:
$ sudo python2 setup_with_CUDA.py install
Otherwise, you should modify the setup_with_CUDA.py , change the path to CUDA installation accordingly:
call(["./configure", "--without-mpi","--with-cuda=/opt/cuda/"])
and
library_dirs=['/opt/cuda/lib64']
Then run the install command
$ sudo python2 setup_with_CUDA.py install
Then you can use the python interface like before, with CUDA support.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file somoclu-1.4.zip.
File metadata
- Download URL: somoclu-1.4.zip
- Upload date:
- Size: 76.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51ca25375523e1a2cb69745bb9b510046a104490e6602453221454cdc3142ba9
|
|
| MD5 |
52543e61cf97f3b99b6c042356c8adbb
|
|
| BLAKE2b-256 |
07c99f37012cbfe44e847dc787ce21b368724dd968c3f27e2e35b46f61483fc4
|
File details
Details for the file somoclu-1.4.tar.gz.
File metadata
- Download URL: somoclu-1.4.tar.gz
- Upload date:
- Size: 55.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58302535372896ccf6b66489a4235c60001ef02b2b7b4b63f6ee50379f6def2b
|
|
| MD5 |
51ea3257a5ff922aa53555f2c3805edf
|
|
| BLAKE2b-256 |
20c7c578c284644a814b42e8f121d7bc5b89433ee5b13090a47b48e41942c8a6
|
File details
Details for the file somoclu-1.4.win-amd64.zip.
File metadata
- Download URL: somoclu-1.4.win-amd64.zip
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c27482a515ee8db725872d2b9f3e2945e3ed230650abad7e9f6dece6be7a129
|
|
| MD5 |
cc42dc189d320da2e36bfcc73cfd3494
|
|
| BLAKE2b-256 |
f16cf65948d143c933b5f3029bf8a9da2e161d1edf3ee14c1cca57ece56170ea
|
File details
Details for the file somoclu-1.4-py2.7-win-amd64.egg.
File metadata
- Download URL: somoclu-1.4-py2.7-win-amd64.egg
- Upload date:
- Size: 33.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4daa97d96ae1d080d46080dadcbb30e794cca9ed16854c324155ca7011f5c15a
|
|
| MD5 |
88c5b6aaa0ef4d7625c325355d9a72e2
|
|
| BLAKE2b-256 |
7266f7a8a25b774eea75c046b4c8f901f6c17aa3a951efe03736af47e933c2fa
|