# An Unsupervised Anomaly Detection Based on Self-Organizing Map for the Oil and Gas Sector
## 3 The Research Approach
### The Self-Organizing Map
At iteration k, the winning node \(\mathrm{p_{i}^{*}}(\mathrm{k})\) of all those considered will be the one that minimizes Equation (2), as shown in Equation (3). \[\mathrm{P_{1}^{*}}(\mathrm{k})=\mathrm{argmin}\Big{\{}\mathrm{d_{p}^{i}}( \mathrm{k})\Big{\}} \tag{3}\]  
Likewise, human neurons process similar information using neighbouring neurons. The SOM's topological organization requires that adjacent neurons represent inputs with similar properties in the output space. Therefore, the BMU determines the spatial position of cooperating nodes' neighbourhoods. These nodes, sharing common characteristics, activate each other to learn something from the same input. This way, the BMU node and the neighbouring nodes weights must be adapted to become more representative and faithful to the input space. Two parameters must be set to achieve this step: the learning rate, \(\alpha(\mathrm{k})\), and the neighbourhood size. In particular, the learning rate controls the change rate of the weights and the neighbourhood size at each iteration. Learning rate and neighbourhood size guarantee the algorithm convergence even after a reasonable number of iterations(at least 1000). Thus, the learning rate gradually decreases during network training. As described by [PERSON] et al. [41], Equations (4)-(6) offer different learning rate formulas. \[\alpha(k)=\alpha(0)\cdot\frac{1}{k} \tag{4}\]  
\[\alpha(k,T)=\alpha(0)\cdot(1-\frac{k}{T}) \tag{5}\]  
\[\alpha(k,T)=\alpha(0)\cdot e^{k} \tag{6}\]  
In particular, \(\alpha(0)\) is the value of the learning rate at the first iteration, and \(k\) is the current iteration. At this point, using a discrete-time formalism, let \(w_{j;p^{*}}^{i}(k)\) be the weight vector of the winning node at iteration \(k\). Then, at iteration \(k+1\), it is defined as described in Equation (7). \[w_{j;p^{*}}^{i}(k+1)=w_{j;p^{*}}^{i}(k)+\alpha(k)\cdot\left[x_{ij}(k)-w_{j;p^{* }}^{i}(k)\right] \tag{7}\]  
The topological properties of the initial space are preserved in the final one thanks to the neighbourhood size. The vectors of the nodes close to the BMU (\(p_{1}^{*}(k)\)), indicated with \(N_{N}^{*}\), have a crucial role in the learning process. The rate of weights adaptation decreases moving away from the winning node, according to a decay function called the neighbourhood function, \(h_{p^{*};p}(k)\), where \(p^{*}\) indicates the winning node and \(p=1,2,\dots\) m. At this point, the weights of all other nodes can be updated according to Equation (8). Figure 4:0  
[PERSON] [40] claims that different types of neighbourhoods can be distinguished (Figure 5). A discrete neighbourhood function is defined as a function that defines a set \(N_{c}\) of elements at the winning node, such as \(h_{p^{*};p}(k)=\gamma(t)\) if \(i\in N_{N}^{*}\) and \(h_{p^{*};p}(k)=0\) if \(i\
otin N_{N}^{*}\). The \(\gamma(t)\) value indicates the degree of participation in weight update [42]. It is also possible to define the neighbourhood using a continuous function. The continuous neighbourhood function is often preferred over the discrete one because it decreases in time and space as the number of iterations increases. Thus, a more homogeneous output that preserves as much as possible the initial topological composition returns. There are several neighbourhood functions in the literature, such as the Bubble Equation (9), Gaussian Equation (10), Cutgass Equation (11), and Epanechnikov Equation (12) [43]. Figure 4:1  
Figure 4:2  
Figure 4:3  
Figure 4:4  
\(d_{p;i}^{i}\) indicates the distance between the BMU and the excited neuron i, 1(k) is the step function: 1(k) = 0 if \(k<0\) and 1(k) = 1 if \(k\geq 0\) and \(\sigma(k)\) stands for the neighbourhood radius at iteration k. The maximum point of the symmetric Gaussian function is that defined by \(d_{p;i}^{i}=0\). Since it is a monotone decreasing function, [PERSON] [40] suggests starting with a large \(\sigma(0)\) value since it has been seen experimentally that starting the training with too small a value does not bring the network to convergence.