{"id":16518366,"url":"https://github.com/cgorman/tensorflow-som","last_synced_at":"2025-03-21T08:31:56.651Z","repository":{"id":54802742,"uuid":"121075872","full_name":"cgorman/tensorflow-som","owner":"cgorman","description":"A multi-gpu implementation of the self-organizing map in TensorFlow","archived":false,"fork":false,"pushed_at":"2022-08-01T20:44:34.000Z","size":102,"stargazers_count":78,"open_issues_count":0,"forks_count":35,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-17T23:14:19.353Z","etag":null,"topics":["neural-networks","self-organizing-map","tensorflow","unsupervised-learning"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cgorman.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}},"created_at":"2018-02-11T02:32:58.000Z","updated_at":"2025-01-27T15:27:22.000Z","dependencies_parsed_at":"2022-08-14T03:20:31.734Z","dependency_job_id":null,"html_url":"https://github.com/cgorman/tensorflow-som","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgorman%2Ftensorflow-som","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgorman%2Ftensorflow-som/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgorman%2Ftensorflow-som/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgorman%2Ftensorflow-som/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cgorman","download_url":"https://codeload.github.com/cgorman/tensorflow-som/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244765521,"owners_count":20506827,"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":["neural-networks","self-organizing-map","tensorflow","unsupervised-learning"],"created_at":"2024-10-11T16:35:42.998Z","updated_at":"2025-03-21T08:31:55.714Z","avatar_url":"https://github.com/cgorman.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"**NOTE:** *This package is no longer maintained and trained SOMs may have issues with stability. I will refrain from archiving this repository for the time being because I may end up releasing an updated version for PyTorch which I will link to before archiving. Like everything else, use this code at your own risk and please do some sanity checks. Thanks!*\r\n# TensorFlow Self-Organizing Map\r\nAn implementation of the Kohonen self-organizing map\u003csup\u003e1\u003c/sup\u003e for TensorFlow 1.5 and Python 3.6.\r\n**A Tensorflow V2 version has been contributed by [Dragan Avramovski](https://github.com/dragan-avramovski) and is in the tfv2 branch. (Thanks Dragan!)**\r\nThis was initially based\r\noff of [Sachin Joglekar's](https://codesachin.wordpress.com/2015/11/28/self-organizing-maps-with-googles-tensorflow/)\r\ncode but has a few key modifications:\r\n * Uses TensorFlow broadcasting semantics instead of `tf.pack` and `for` loops.\r\n * Input data is expected from a `Tensor` rather than a `tf.placeholder`, allowing for use with faster and more complex input data pipelines.\r\n * Training uses the batch algorithm rather than the online one, providing a major speed boost if you have the GPU RAM.\r\n Also, as a result of that, I added...\r\n * Multi-GPU support (for single machines with multiple GPUs, it doesn't have multi-node training).\r\n * Some summary operations for Tensorboard visualization\r\n\r\n `example.py` contains a simple example of its usage by training a SOM on a 3 cluster toy dataset. The resulting\r\n u-matrix should look something like this:\r\n\r\n ![Example U-Matrix](https://github.com/cgorman/tensorflow-som/blob/master/example_umatrix.png)\r\n \r\nNote that the example requires scikit-learn to be installed.\r\n\r\n I was going to write a blog post about this but I ended up just repeating everything I wrote in the comments,\r\n so please read them if you'd like to understand the code. For reference, the batch formula for SOMs is\r\n \r\n ![SOM batch formula](https://github.com/cgorman/tensorflow-som/blob/master/batch_formula.gif)\r\n \r\n where theta is the neighborhood function and x is the input vector.\r\n \r\n The activity function turns the distance between each of the weights and an input vector into a value between 0 and 1, i.e. similar weights elicit a higher activity.\r\n The activity function is parameterized with the `output_sensitivity` variable.\r\n When this value is close to zero the range of distances that elicit high activity is wider, and vice versa.\r\n Here is an example of a few different values of the output sensitivity (`-c` here):\r\n \r\n ![Effect of Output Sensitivity Parameter](https://github.com/cgorman/tensorflow-som/blob/master/output_sens.png)\r\n \r\n## Note about the learning rate\r\nThere was a really dumb bug in commits before 2a0ee25 where the learning rate (alpha) was set extremely incorrectly.\r\nInstead of shrinking from n to 0, it grew from n to 1.\r\nIf you had bad luck with this module previously, this may fix it.\r\nSorry for the goof!\r\n\r\n \u003csup\u003e1\u003c/sup\u003ehttp://ieeexplore.ieee.org/document/58325/\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgorman%2Ftensorflow-som","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcgorman%2Ftensorflow-som","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgorman%2Ftensorflow-som/lists"}