{"id":13689149,"url":"https://github.com/JustGlowing/minisom","last_synced_at":"2025-05-01T23:32:41.759Z","repository":{"id":9307838,"uuid":"11147494","full_name":"JustGlowing/minisom","owner":"JustGlowing","description":":red_circle: MiniSom is a minimalistic implementation of the Self Organizing Maps","archived":false,"fork":false,"pushed_at":"2024-10-31T14:10:26.000Z","size":20058,"stargazers_count":1442,"open_issues_count":17,"forks_count":421,"subscribers_count":31,"default_branch":"master","last_synced_at":"2024-10-31T15:21:07.056Z","etag":null,"topics":["clustering","dimensionality-reduction","kohonen","machine-learning","manifold-learning","neural-networks","outlier-detection","self-organizing-map","som","unsupervised-learning","vector-quantization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"massarellimj/UGCCET","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JustGlowing.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-07-03T10:10:06.000Z","updated_at":"2024-10-31T14:10:29.000Z","dependencies_parsed_at":"2024-01-19T10:08:07.613Z","dependency_job_id":"aaf48704-fbdd-4523-a5ad-aa7d0dbdae7a","html_url":"https://github.com/JustGlowing/minisom","commit_stats":{"total_commits":484,"total_committers":28,"mean_commits":"17.285714285714285","dds":"0.30371900826446285","last_synced_commit":"72214292fd267a7b03238c9db8fb9eeffc0e10e8"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustGlowing%2Fminisom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustGlowing%2Fminisom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustGlowing%2Fminisom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JustGlowing%2Fminisom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JustGlowing","download_url":"https://codeload.github.com/JustGlowing/minisom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224282146,"owners_count":17285778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clustering","dimensionality-reduction","kohonen","machine-learning","manifold-learning","neural-networks","outlier-detection","self-organizing-map","som","unsupervised-learning","vector-quantization"],"created_at":"2024-08-02T15:01:35.583Z","updated_at":"2025-05-01T23:32:41.752Z","avatar_url":"https://github.com/JustGlowing.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"[![PyPI version fury.io](https://badge.fury.io/py/minisom.svg)](https://pypi.org/project/MiniSom/)\n[![Downloads](https://static.pepy.tech/personalized-badge/minisom?period=total\u0026units=international_system\u0026left_color=black\u0026right_color=blue\u0026left_text=Downloads)](https://pepy.tech/project/MiniSom)\n[![Python package](https://github.com/JustGlowing/minisom/actions/workflows/python-package.yml/badge.svg?branch=master\u0026event=push)](https://github.com/JustGlowing/minisom/actions/workflows/python-package.yml)\n\n\u003ch1\u003eMiniSom\u003cimg src='https://3.bp.blogspot.com/-_6UDGEHzIrs/WSfiyjmoeRI/AAAAAAAABHw/3UQylcCBEhUfHNhf56WSHBBmQ6g_lXQhwCLcB/s320/minisom_logo.png' align='right'\u003e\u003c/h1\u003e\n\nSelf Organizing Maps\n--------------------\n\nMiniSom 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.\n\nThe 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.\n\nUpdates about MiniSom are posted on \u003ca href=\"https://x.com/JustGlowing\"\u003eX\u003c/a\u003e.\n\nJump into using MiniSom via Google Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://githubtocolab.com/JustGlowing/minisom/blob/master/examples/BasicUsage.ipynb)\n\nInstallation\n---------------------\n\nJust use pip:\n\n    pip install minisom\n\nor download MiniSom to a directory of your choice and use the setup script:\n\n    git clone https://github.com/JustGlowing/minisom.git\n    python setup.py install\n\nNote that the commands above will install the latest version of MiniSom which might contain changes that are not parte of the stable release.\n\nHow to use it\n---------------------\n\nIn 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:\n\n```python\ndata = [[ 0.80,  0.55,  0.22,  0.03],\n        [ 0.82,  0.50,  0.23,  0.03],\n        [ 0.80,  0.54,  0.22,  0.03],\n        [ 0.80,  0.53,  0.26,  0.03],\n        [ 0.79,  0.56,  0.22,  0.03],\n        [ 0.75,  0.60,  0.25,  0.03],\n        [ 0.77,  0.59,  0.22,  0.03]]      \n```\n\n Then you can train MiniSom just as follows:\n\n```python\nfrom minisom import MiniSom    \nsom = MiniSom(6, 6, 4, sigma=0.3, learning_rate=0.5) # initialization of 6x6 SOM\nsom.train(data, 100) # trains the SOM with 100 iterations\n```\n\nYou can obtain the position of the winning neuron on the map for a given sample as follows:\n\n```\nsom.winner(data[0])\n```\n\nFor an overview of all the features implemented in minisom you can browse the following examples: https://github.com/JustGlowing/minisom/tree/master/examples\n\n#### Export a SOM and load it again\n\nA model can be saved using pickle as follows\n\n```python\nimport pickle\nsom = MiniSom(7, 7, 4)\n\n# ...train the som here\n\n# saving the som in the file som.p\nwith open('som.p', 'wb') as outfile:\n    pickle.dump(som, outfile)\n```\n\nand can be loaded as follows\n\n```python\nwith open('som.p', 'rb') as infile:\n    som = pickle.load(infile)\n```\n\nNote that if a lambda function is used to define the decay factor MiniSom will not be pickable anymore.\n\nExamples\n---------------------\n\nHere are some of the charts you'll see how to generate in the [examples](https://github.com/JustGlowing/minisom/tree/master/examples):\n\n| | |\n:-------------------------:|:-------------------------:\nSeeds map ![](https://github.com/JustGlowing/minisom/raw/master/examples/resulting_images/som_seed.png)  | Class assignment ![](https://github.com/JustGlowing/minisom/raw/master/examples/resulting_images/som_seed_pies.png)\nHandwritten digits mapping ![](https://github.com/JustGlowing/minisom/raw/master/examples/resulting_images/som_digts.png)  |  Hexagonal Topology \u003cimg src=\"https://github.com/JustGlowing/minisom/raw/master/examples/resulting_images/som_seed_hex.png\" alt=\"som hexagonal toplogy\" width=450\u003e\nColor quantization ![](https://github.com/JustGlowing/minisom/raw/master/examples/resulting_images/som_color_quantization.png)  |  Outliers detection ![](https://github.com/JustGlowing/minisom/raw/master/examples/resulting_images/som_outliers_detection_circle.png)\n\nOther tutorials\n------------\n- \u003ca href=\"https://glowingpython.blogspot.com/2013/09/self-organizing-maps.html\"\u003eSelf Organizing Maps on the Glowing Python\u003c/a\u003e\n- \u003ca href=\"https://github.com/Optimization-Algorithms-Book/Code-Listings/blob/main/Chapter%2011/Listing%2011.5_TSP_SOM.ipynb\"\u003eHow to solve the Travelling Salesman Problem\u003c/a\u003e from the book \u003ci\u003eOptimization Algorithms:Optimization Algorithms: AI techniques for design, planning, and control problems. Manning Publications, 2023.\u003c/i\u003e\n- \u003ca href=\"http://aa.ssdi.di.fct.unl.pt/files/AA-16_notes.pdf\"\u003eLecture notes from the Machine Learning course at the University of Lisbon\u003c/a\u003e\n- \u003ca href=\"https://heartbeat.fritz.ai/introduction-to-self-organizing-maps-soms-98e88b568f5d\"\u003eIntroduction to Self-Organizing\u003c/a\u003e by Derrick Mwiti\n- \u003ca href=\"http://inphronesys.com/?p=625\"\u003eSelf Organizing Maps on gapminder data\u003c/a\u003e [in German]\n- \u003ca href=\"https://medium.com/neuronio/discovering-som-an-unsupervised-neural-network-12e787f38f9\"\u003eDiscovering SOM, an Unsupervised Neural Network\u003c/a\u003e by Gisely Alves\n- Video tutorials made by the GeoEngineerings School: \u003ca href=\"https://www.youtube.com/watch?v=3osKNPyAxPM\u0026list=PL-i8do33HJovC7xFKaYO21qT37vORJWXC\u0026index=11\"\u003ePart 1\u003c/a\u003e; \u003ca href=\"https://www.youtube.com/watch?v=uUpQ6MITlVs\u0026list=PL-i8do33HJovC7xFKaYO21qT37vORJWXC\u0026index=12\"\u003ePart 2\u003c/a\u003e; \u003ca href=\"https://www.youtube.com/watch?v=mryFU0TEInk\u0026list=PL-i8do33HJovC7xFKaYO21qT37vORJWXC\u0026index=13\"\u003ePart 3\u003c/a\u003e; \u003ca href=\"https://www.youtube.com/watch?v=9MzFOIoxxdk\u0026index=14\u0026list=PL-i8do33HJovC7xFKaYO21qT37vORJWXC\"\u003ePart 4\u003c/a\u003e\n- Video tutorial \u003ca href=\"https://www.youtube.com/watch?v=0qtvb_Nx2tA\"\u003eSelf Organizing Maps: Introduction\u003c/a\u003e by Art of Visualization\n- Video tutorial \u003ca href=\"https://www.youtube.com/watch?v=O6nzwAc_hrQ\"\u003eSelf Organizing Maps Hyperparameter tuning\u003c/a\u003e by \nSuperDataScience Machine Learning\n\nHow to cite MiniSom\n------------\n```\n@misc{vettigliminisom,\n  title={MiniSom: minimalistic and NumPy-based implementation of the Self Organizing Map},\n  author={Giuseppe Vettigli},\n  year={2018},\n  url={https://github.com/JustGlowing/minisom/},\n}\n```\n\nMiniSom has been cited more than 300 times, check out the research where MiniSom was used  \u003ca href=\"https://scholar.google.co.uk/scholar?hl=en\u0026as_sdt=2007\u0026q=%22JustGlowing%2Fminisom%22+OR+%22minisom+library%22+OR+%22minisom+python%22+OR+%22minisom+vettigli%22\u0026btnG=\"\u003ehere\u003c/a\u003e.\n\nGuidelines to contribute\n---------------------\n1. 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.\n2. Give your pull request a helpful title that summarises what your contribution does. \n3. Write unit tests for your code and make sure the existing ones are up to date. `pytest` can be used for this:\n```\npytest minisom.py\n```\n4. Make sure that there are no stylistic issues using `pycodestyle`:\n```\npycodestyle minisom.py\n```\n5. Make sure your code is properly commented and documented. Each public method needs to be documented as the existing ones.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJustGlowing%2Fminisom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJustGlowing%2Fminisom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJustGlowing%2Fminisom/lists"}