minisom

:red_circle: MiniSom is a minimalistic implementation of the Self Organizing Maps

https://github.com/justglowing/minisom

Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: scholar.google
  • Committers with academic emails
    4 of 28 committers (14.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.7%) to scientific vocabulary

Keywords

clustering dimensionality-reduction kohonen machine-learning manifold-learning neural-networks outlier-detection self-organizing-map som unsupervised-learning vector-quantization
Last synced: 6 months ago · JSON representation

Repository

:red_circle: MiniSom is a minimalistic implementation of the Self Organizing Maps

Basic Info
  • Host: GitHub
  • Owner: JustGlowing
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 19.1 MB
Statistics
  • Stars: 1,524
  • Watchers: 30
  • Forks: 439
  • Open Issues: 18
  • Releases: 7
Topics
clustering dimensionality-reduction kohonen machine-learning manifold-learning neural-networks outlier-detection self-organizing-map som unsupervised-learning vector-quantization
Created over 12 years ago · Last pushed 11 months ago
Metadata Files
Readme License

Readme.md

PyPI version fury.io Downloads Python package

MiniSom

Self Organizing Maps

MiniSom is a minimalistic and Numpy based implementation of the Self Organizing Maps (SOM). SOM is a type of Artificial Neural Network able to convert complex, nonlinear statistical relationships between high-dimensional data items into simple geometric relationships on a low-dimensional display. Minisom is designed to allow researchers to easily build on top of it and to give students the ability to quickly grasp its details.

The project initially aimed for a minimalistic implementation of the Self-Organizing Map (SOM) algorithm, focusing on simplicity in features, dependencies, and code style. Although it has expanded in terms of features, it remains minimalistic by relying only on the numpy library and emphasizing vectorization in coding style.

Updates about MiniSom are posted on X.

Jump into using MiniSom via Google Colab: Open In Colab

Installation

Just use pip:

pip install minisom

or download MiniSom to a directory of your choice and use the setup script:

git clone https://github.com/JustGlowing/minisom.git
python setup.py install

Note that the commands above will install the latest version of MiniSom which might contain changes that are not parte of the stable release.

How to use it

In order to use MiniSom you need your data organized as a Numpy matrix where each row corresponds to an observation or as list of lists like the following:

python data = [[ 0.80, 0.55, 0.22, 0.03], [ 0.82, 0.50, 0.23, 0.03], [ 0.80, 0.54, 0.22, 0.03], [ 0.80, 0.53, 0.26, 0.03], [ 0.79, 0.56, 0.22, 0.03], [ 0.75, 0.60, 0.25, 0.03], [ 0.77, 0.59, 0.22, 0.03]]

Then you can train MiniSom just as follows:

python from minisom import MiniSom som = MiniSom(6, 6, 4, sigma=0.3, learning_rate=0.5) # initialization of 6x6 SOM som.train(data, 100) # trains the SOM with 100 iterations

You can obtain the position of the winning neuron on the map for a given sample as follows:

som.winner(data[0])

For an overview of all the features implemented in minisom you can browse the following examples: https://github.com/JustGlowing/minisom/tree/master/examples

Export a SOM and load it again

A model can be saved using pickle as follows

```python import pickle som = MiniSom(7, 7, 4)

...train the som here

saving the som in the file som.p

with open('som.p', 'wb') as outfile: pickle.dump(som, outfile) ```

and can be loaded as follows

python with open('som.p', 'rb') as infile: som = pickle.load(infile)

Note that if a lambda function is used to define the decay factor MiniSom will not be pickable anymore.

Examples

Here are some of the charts you'll see how to generate in the examples:

| | | :-------------------------:|:-------------------------: Seeds map | Class assignment Handwritten digits mapping | Hexagonal Topology som hexagonal toplogy Color quantization | Outliers detection

Other tutorials

How to cite MiniSom

@misc{vettigliminisom, title={MiniSom: minimalistic and NumPy-based implementation of the Self Organizing Map}, author={Giuseppe Vettigli}, year={2018}, url={https://github.com/JustGlowing/minisom/}, }

MiniSom has been cited more than 400 times, check out the research where MiniSom was used here.

Guidelines to contribute

  1. In the description of your Pull Request explain clearly what it implements or fixes. In cases that the PR is about a code speedup, report a reproducible example and quantify the speedup.
  2. Give your pull request a helpful title that summarises what your contribution does.
  3. Write unit tests for your code and make sure the existing ones are up to date. pytest can be used for this: pytest minisom.py
  4. Make sure that there are no stylistic issues using pycodestyle: pycodestyle minisom.py
  5. Make sure your code is properly commented and documented. Each public method needs to be documented as the existing ones.

Owner

  • Name: Giuseppe Vettigli
  • Login: JustGlowing
  • Kind: user
  • Location: Cambridge, UK

Sr Data Scientist, teaching fellow, Python enthusiast, fearless visionarist, lateral thinker.

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 16
  • Watch event: 93
  • Issue comment event: 30
  • Push event: 7
  • Pull request event: 2
  • Fork event: 18
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 16
  • Watch event: 93
  • Issue comment event: 30
  • Push event: 7
  • Pull request event: 2
  • Fork event: 18

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 484
  • Total Committers: 28
  • Avg Commits per committer: 17.286
  • Development Distribution Score (DDS): 0.304
Past Year
  • Commits: 45
  • Committers: 3
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.067
Top Committers
Name Email Commits
Giuseppe Vettigli g****i@h****m 337
justglowing v****i@g****m 68
jriege j****e@w****m 14
Birgit Jaekel b****e 8
Evangelos Athanasakis v****3@g****m 6
lbugnon l****n@s****r 6
Tharinda Dilshan Piyadasa t****7@g****m 5
Wei Zhang z****e@m****m 5
avisionh a****n@h****k 4
Flavio Giobergia f****a@g****m 3
Peppe a****i@a****) 3
Phan Hai Phong h****2@g****m 3
giu g****u@g****) 3
ben b****n@h****m 2
christos.sourmpis c****s@a****m 2
Adit Chawdhary k****c 2
Fei Yao 4****h 2
lazysperm b****r@g****m 1
Tómas Árni Jónasson m****l@t****e 1
Robert Jeffrey 6****y 1
Shaurya Chanana 1****a 1
Velibor Zeli v****r@m****e 1
Sumera Priyadarsini s****n@g****m 1
Matt Poegel m****l@c****t 1
Mateusz Choinski m****i@o****m 1
Joris Gillis j****s@t****e 1
Dan Alberto Rosa De Jesús d****s@p****v 1
Austin T a****p@g****m 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 105
  • Total pull requests: 33
  • Average time to close issues: 27 days
  • Average time to close pull requests: 15 days
  • Total issue authors: 92
  • Total pull request authors: 29
  • Average comments per issue: 3.28
  • Average comments per pull request: 3.12
  • Merged pull requests: 16
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 10
  • Pull requests: 3
  • Average time to close issues: 6 days
  • Average time to close pull requests: 1 day
  • Issue authors: 10
  • Pull request authors: 2
  • Average comments per issue: 2.5
  • Average comments per pull request: 1.33
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mr-d3falt (4)
  • mariajmolina (3)
  • LorisAlif (3)
  • aktaseren (2)
  • Kheireddine-otm (2)
  • SandroMartens (2)
  • tomaszek0 (2)
  • jiwon-j (2)
  • bharathwajan (2)
  • marifegitim (1)
  • chanana (1)
  • gabriel-OFV (1)
  • VishnuRamD (1)
  • aryamaan3 (1)
  • michel039 (1)
Pull Request Authors
  • JustGlowing (4)
  • sachin-vs (2)
  • rctorres (2)
  • XiaoXiaoLeisure (2)
  • mariajmolina (2)
  • koloiyolo (1)
  • jorisgillis (1)
  • raresraf (1)
  • bijae (1)
  • BrandonGarciaWx (1)
  • ricardomourarpm (1)
  • avisionh (1)
  • emeeubc (1)
  • robertmkjeffrey (1)
  • microprediction (1)
Top Labels
Issue Labels
question (44) enhancement (5) bug (3)
Pull Request Labels
stale (4) to-be-merged (2) enhancement (2) duplicate (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 28,106 last-month
  • Total dependent packages: 13
    (may contain duplicates)
  • Total dependent repositories: 19
    (may contain duplicates)
  • Total versions: 9
  • Total maintainers: 2
pypi.org: minisom

Minimalistic implementation of the Self Organizing Maps (SOM)

  • Versions: 8
  • Dependent Packages: 12
  • Dependent Repositories: 19
  • Downloads: 28,106 Last month
Rankings
Dependent packages count: 1.0%
Stargazers count: 1.8%
Downloads: 1.9%
Average: 2.1%
Forks count: 2.6%
Dependent repos count: 3.3%
Maintainers (1)
Last synced: 6 months ago
spack.io: py-minisom

MiniSom is a minimalistic and Numpy based implementation of the Self Organizing Maps (SOM). SOM is a type of Artificial Neural Network able to convert complex, nonlinear statistical relationships between high- dimensional data items into simple geometric relationships on a low- dimensional display. Minisom is designed to allow researchers to easily build on top of it and to give students the ability to quickly grasp its details. The project initially aimed for a minimalistic implementation of the Self-Organizing Map (SOM) algorithm, focusing on simplicity in features, dependencies, and code style. Although it has expanded in terms of features, it remains minimalistic by relying only on the numpy library and emphasizing vectorization in coding style.

  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 28.6%
Dependent packages count: 57.1%
Maintainers (1)
Last synced: 7 months ago

Dependencies

.github/workflows/python-package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
setup.py pypi
.github/workflows/run_examples.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite