Self-organizing maps (SOMs) as an AI tool for music analysis and production
2. How does a SOM work?
2.2. Euclidean distances
While visually finding similar colors on the map can be done rather intuitively, it can also be described in a reliable mathematical way. A feature space is shown below. For a simple visualization we can look at two axes: red and blue. Each color has its specific location and we can determine how similar two colors are by calculating their distance from one another.
Feature space.
In mathematics there are many ways to calculate those distances. One common way, which is often a good choice when training self-organizing maps, is the Euclidean norm. Here, the squared differences between each parameter are calculated individually, and then the square root is computed:
\[ \| \vec{d} \| = \sqrt{(r_1-r_2)^2+(g_1-g_2)^2+(b_1-b_2)^2} \]
So, when describing colors, the differences in red, green, and blue are calculated individually. They are then squared and summed up before the square root is calculated. Thus it can be determined how similar different colors are.