Skip to main content

NeuralMap

NeuralMap is new Python implementation of the well-known self organized artificial neural network, Self-Organizing Map (SOM), with the Relative Position (RP) Visualization method. The RP is a node-adaptive attribute that moves in a two dimensional space mimicking, at training stage, the movements of the SOM's codebook vectors in the input space.

In this way NeuralMap results in a powerfull data analysis tool that generates both a low-dimensional representation of the input data as tSNE or UMAP tools and placing codebook vectors in the input space providing a smoother version of the input space. In addition, it maps data similarity into both codebook vectors and RP neighborness, thus allowing clear identification of similarity in the two dimensional space, with the added advantage of precessing new inputs without retraining needs.

This tool supports a wide range of configurations:

  • Custom distance metric
  • Hexagonal or square arrangement
  • Toroidal or flat topology
  • Custom radius or learning rate decay functions
  • Custom neighbourhood functions

After training a NeuralMap instance, you will be able to get useful information about your data, by mapping observations to the SOM, watching the features distribution over the map, analysing a dataset to get the quantization error, activation frequency and mean distance for each node, and evaluating the SOM.

Since the use of SOM for clustering is very spread, NeuralMap also includes several highly customizable visualization methods, some of them based on the Relative Positions technique to improve the interpretability of results and clusters recognition.

For instance, we have implemented some common clustering algorithms to search clusters into the SOM configuration, speeding up the search of clusters in the smoothed space representation achieved by the SOM codebook vectors or RP rather than in the, possible, high dimensional imput space:

Installation

NeuralMap has the following requirements:

  • python >= 3.6
  • numpy 1.18.3
  • numba 0.50.1
  • scikit_learn_extra 0.1.0b2
  • matplotlib 3.2.1
  • scipy 1.4.1
  • hdbscan 0.8.26
  • scikit_learn 0.23.2

To install NeuralMap use:

pip install neural-map

Getting started

After installing NeuralMap, obtain and prepare your dataset. For this example we will create a dataset with 10 blobs in a five dimensional space and scale it to fit the observations to the range [0, 1]:

from sklearn import datasets, preprocessing

blobs = datasets.make_blobs(n_samples=1000, n_features=5, centers=10, random_state=1)
scaler = preprocessing.MinMaxScaler()
data = scaler.fit_transform(blobs[0])

Then, we have to create a NeuralMap instance and train it with the data:

from neural_map import NeuralMap

nm = NeuralMap(5, 'euclidean', columns=10, rows=10)
nm.train(data, n_epochs=20)

Now we can obtain a discrete representation using the HB-SCAN over the codebook vectors and represented in the two dimensional space mapped trhough the Relative Positions:

nm.plot_analysis(data)
RP-HDBSCAN

NeuralMap was able to successfully discover and cluster all the original blobs.

It's also possible to get the U-matrix:

nm.plot_unified_distance_matrix()
U-matrix

Here is also possible to recognize the 10 original blobs.

Documentation

For more details, see the NeuralMap documentation.

If you have a question, please open an issue.

Authors

  • Elmer Andrés Fernández - Original Idea - Profile - [CIDIE]- CONICET - UCC
  • Franco Bobadilla - Developer - Universidad Católica de Córdoba
  • Pablo Pastore - Advice - Universidad Católica de Córdoba

Contributing

To contribute, do the following:

  • Open an issue to discuss possible changes or ask questions
  • Create a fork of the project
  • Create a new branch and push your changes
  • Create a pull request

License

NeuralMap is licensed under MIT license.

License: MIT

Release files for neural-map 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for neural-map 1.0.0
File Size Uploaded
neural_map-1.0.0.tar.gz 28.8 kB Details

Release files / neural_map-1.0.0.tar.gz

Download URL neural_map-1.0.0.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7b077b86a3345d27cc6dce3ae9ad79f09d609ad68b195fff5f9d6a9f219a6f18
BLAKE2b-256 checksum
How to use checksums
582aeab55a11e13295f97b071c576c357a6085576f119223affe6e7e6b510a18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page