{"id":26048980,"url":"https://github.com/florentf9/desom","last_synced_at":"2025-04-10T16:50:53.126Z","repository":{"id":164375648,"uuid":"165062495","full_name":"FlorentF9/DESOM","owner":"FlorentF9","description":":globe_with_meridians: Deep Embedded Self-Organizing Map: Joint Representation Learning and Self-Organization","archived":false,"fork":false,"pushed_at":"2024-05-16T13:05:52.000Z","size":7050,"stargazers_count":96,"open_issues_count":0,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T14:41:06.024Z","etag":null,"topics":["autoencoder","clustering","deep-learning","keras","kohonen-map","representation-learning","self-organizing-map","som","visualization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FlorentF9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-01-10T13:13:37.000Z","updated_at":"2025-02-16T23:31:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"1b96a5be-fd44-453a-814f-051361d91218","html_url":"https://github.com/FlorentF9/DESOM","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorentF9%2FDESOM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorentF9%2FDESOM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorentF9%2FDESOM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlorentF9%2FDESOM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlorentF9","download_url":"https://codeload.github.com/FlorentF9/DESOM/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248255813,"owners_count":21073389,"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":["autoencoder","clustering","deep-learning","keras","kohonen-map","representation-learning","self-organizing-map","som","visualization"],"created_at":"2025-03-08T00:54:36.551Z","updated_at":"2025-04-10T16:50:53.104Z","avatar_url":"https://github.com/FlorentF9.png","language":"Python","readme":"# DESOM: Deep Embedded Self-Organizing Map \n\nThis is the official Keras implementation of the **Deep Embedded Self-Organizing Map (DESOM)** model.\n\nDESOM is an unsupervised learning model that jointly learns representations and the code vectors of a self-organizing map (SOM) in order to survey, cluster and visualize large, high-dimensional datasets. Our model is composed of an autoencoder and a custom SOM layer that are optimized in a joint training procedure, motivated by the idea that the SOM prior could help learning SOM-friendly representations. Its training is fast, end-to-end and requires no pre-training.\n\n\u003cimg src=\"./fig/desom_map_mnist.png\" width=300 height=300/\u003e\u003cimg src=\"./fig/desom_map_fmnist.png\" width=300 height=300/\u003e\n\nWhen using this code, please cite following works:\n\n\u003e Forest, Florent, Mustapha Lebbah, Hanene Azzag and Jérôme Lacaille (2019). Deep Embedded SOM: Joint Representation Learning and Self-Organization. In European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning (ESANN 2019).\n\n\u003e Forest, Florent, Mustapha Lebbah, Hanene Azzag and Jérôme Lacaille (2019). Deep Architectures for Joint Clustering and Visualization with Self-Organizing Maps. In Workshop on Learning Data Representations for Clustering (LDRC), PAKDD 2019.\n\n\u003e Forest, Florent, Mustapha Lebbah, Hanene Azzag, and Jérôme Lacaille (2021). Deep Embedded Self-Organizing Maps for Joint Representation Learning and Topology-Preserving Clustering. Neural Computing and Applications 33, no. 24 (December 1, 2021): 17439–69. https://doi.org/10.1007/s00521-021-06331-w.\n\n(see also http://florentfo.rest/publications)\n\n## Quick start\n\nThe implementation is divided into several scripts:\n\n* *train.py*: main training script.\n* *DESOM.py*: DESOM model class.\n* *ConvDESOM.py*: Convolutional DESOM model class.\n* *SOM.py*: SOM layer class.\n* *AE.py*: autoencoder models (mlp and conv2d).\n* *Kerasom.py*: a standard SOM in Keras, without the autoencoder part.\n* *datasets.py*: script for loading the datasets benchmarked in the paper (MNIST, Fashion-MNIST, USPS and REUTERS-10k).\n* *evaluation.py*: PerfLogger class evaluating many clustering/SOM quality metrics. **Requires the external dependency [SOMperf](https://github.com/FlorentF9/SOMperf)**.\n* *metrics.py*: functions to compute metrics used in *desom_benchmark.py* (purity, unsupervised clustering accuracy, quantization and topographic errors).\n* *desom_benchmark.py*: script to perform benchmark runs of DESOM on 4 datasets and save results in a CSV file.\n\nThe *data* directory contains USPS and REUTERS-10k datasets.\n\n### Prerequisites\n\nFirst, clone and install the [**SOMperf** module](https://github.com/FlorentF9/SOMperf), required to evaluate the quality metrics during training:\n\n```shell\ngit clone https://github.com/FlorentF9/SOMperf\npython3 install ./SOMperf\n```\n\n### Training instructions\n\nThe main script has several command-line arguments that are explained with:\n\n```shell\npython3 train.py --help\n```\n\nAll arguments have default values, so DESOM training can be simply started doing:\n\n```shell\npython3 train.py\n```\n\nFor example, to train DESOM on Fashion-MNIST with a 20x20 map, the command is:\n\n```shell\npython3 train.py --model desom --dataset fmnist --map_size 20 20\n```\n\nTraining generates several outputs:\n\n* an image of the DESOM map to visualize the prototypes\n* a graph of the model architecture\n* a folder containing a log of training metrics and the model weights (by default, `results/tmp`)\n\nBehavior is similar for the ConvDESOM and Kerasom models.\n\nFor information, one training run on MNIST with 10000 iterations and batch size 256 on a laptop GPU takes around 2 minutes.\n\nA full benchmark of DESOM on the 4 datasets can be started by calling the script `desom_benchmark.py`. Parameters, number of runs and save directories are specified inside the script. Paper results were obtained using this script and number of runs equal to 10. Similar scripts were used for other compared models (convdesom, minisom, kerasom and with pre-trained autoencoder weights).\n\nThe main dependencies are keras, scikit-learn, numpy, pandas, matplotlib and somperf.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorentf9%2Fdesom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorentf9%2Fdesom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorentf9%2Fdesom/lists"}