Self-Organizing Maps

Self-Organizing Maps are a type of artificial neural networks that use unsupervised learning to create a "map", a discrete 2D representation of the input space of the training samples.

I've used SOMs in my research to generate color palettes based on universal color categories. You can read more details in my PhD thesis,

"Region-based Image Abstraction for Retrieval and Synthesis", Tokyo Institute of Technology, January 2008, (.pdf 55MB), (small handout 19MB), Projects: Sketch2Collage

I've created here a small demo in Javascript to iteratively compute those color palettes. You can find all the code Github.

I'm using Javascript workers to update the images on each iteration, so you should see them getting updated at the top of this page. The worker code is really simple,

  self.importScripts('nn.js');
  onmessage = function(e) {
    for (var s=0; s < e.data.numIterations; s++) {
      for (i=0; i < soms.length; i++) {
        soms[i].solve(s);
        var itResult = {
          index: i,
          solution: soms[i].weights
        };
        postMessage(itResult);
      }
    }
  };