Algorithm 1.
Growing When Required
1: | Start with a set A consisting of two map nodes, n1 and n2, at random positions. |
2: | Initialize an empty set of connections C = ∅. |
3: | At each iteration, generate an input sample ξ according to the input distribution P(ξ). |
4: | For each node i calculate the distance from the input ||ξ − wi||. |
5: | Select the best matching node and the second-best matching node such that: s = arg minn ∈ A||ξ − wn||, t = arg minn ∈ A/{s} ||ξ − wn||. |
6: | Create a connection C = C ∪ {(s, t)} if it does not exist and set its age to 0. |
7: | Calculate the activity of the best matching unit: a = exp(−||ξ − ws||). |
8: | If a < activity threshold aT and firing counter < firing threshold fT then: Add a new node between s and t: A = A ∪ {(r)} Create the weight vector: wr = 0.5 · (ws + ξ) Create edges and remove old edge: C = C ∪ {(r, s), (r, t)} and C = C/{(s, t)}. |
9: | Else, i.e., no new node is added, adapt the positions of the winning node and its neighbours i: Δws = ϵb · hs · (ξ − ws) Δwi = ϵn · hi · (ξ − wi) where 0 < ϵn < ϵb < 1 and hs is the value of the firing counter for node s. |
10: | Increment the age of all edges connected to s: age(s,i) = age(s,i) + 1. |
11: | Reduce the firing counters according to Equation (2): . |
12: | Remove all edges with ages larger than amax and remove nodes without edges. |
13: | If the stop criterion is not met, go to step 3. |