# An Unsupervised Anomaly Detection Based on Self-Organizing Map for the Oil and Gas Sector
## 3 The Research Approach
### The Self-Organizing Map  
The Self-Organizing Map (SOM) was first theorized by [PERSON] [40]. Based on the similarity of the input information, the algorithm reorders the data in the map by \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**ID** & **Description** & **UM** & **Type** & **Tag** \\ \hline S1 & Inlet water pressure & [bar] & OUTPUT & Endress+Hauser Cerabar M PMP51 \\ S2 & Inlet water flow rate & [m\({}^{3}\)/h] & OUTPUT & Endress+Hauser Promag W \\ S3 & Ejector pressure & [bar] & OUTPUT & Setra 280E \\ S4 & Diffuser mixture pressure & [bar] & OUTPUT & Foxboro 841 GM C1 \\ S5 & Tank pressure & [bar] & OUTPUT & Foxboro 841 GM-C1 \\ S6 & Inlet air flow rate & [m\({}^{3}\)/h] & OUTPUT & Foxboro Vortex DN 50 \\ S7 & Tank water level & [mm] & OUTPUT & Foxboro IDP-10 \\ S8 & Outlet air flow rate & [m\({}^{3}\)/h] & OUTPUT & Endress+Hauser Prowir 200 \\ V1 & Valve 1 closure & [\%] & INPUT & Spirax Sarco 9126E Pneumatic Valve \\ V2 & Valve 2 closure & [\%] & INPUT & ECKARDT MB6713 Pneumatic Valve \\ V3 & Valve 3 closure & [\%] & INPUT & ECKARDT MB6713 Pneumatic Valve \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Plant equipment characteristics. Figure 4: Some views of the experimental plant. Figure 3: The experimental plant 3D model. performing a sort of classification. The structure of this artificial neural network consists only of the input and output layers. The input dataset consists of a samples number equal to D described by n features, \(\mathrm{x_{i}}=(\mathrm{x_{1}},\mathrm{x_{2}},\dots,\mathrm{x_{n}})\) with \(\mathrm{i}=1,2\ \dots\ \mathrm{D}\). Each features sample (\(\mathrm{x_{ij}}\) with \(\mathrm{j}=1\), \(2\ \dots\ \mathrm{n}\)) is associated with a weight vector in the output map \(\mathrm{w_{j}^{i}}=\left(\mathrm{w_{j1}^{i}},\mathrm{w_{j2}^{i}},\dots, \mathrm{w_{j,m}^{i}}\right)\) where m is the number of output nodes. The initial weights, randomly initialized, must be close to zero, avoiding the presence of similar weights. This way, no order is imposed on the network during the initialization phase. The output layer is a low-dimensional representation of the input data. Typically, its nodes are arranged in a two-dimensional architecture organized as a grid with a rectangular or hexagonal topology. Mainly, the number of output nodes denotes the maximum number of clusters and influences the accuracy of the SOM. The scientific study of [PERSON] and [PERSON] (2011) can be exploited to calculate the number of nodes in the output grid. Considering D samples in the input database, Equation (1) describes the number of output nodes m.  
\[\mathrm{m}=5\sqrt{\mathrm{D}} \tag{1}\]  
Once the number of output nodes is identified, choosing the proper grid topology is necessary. Indeed, each grid has specific properties: in the rectangular topology, each node has four neighbours, while in the hexagonal one, each node has six neighbours. In general, the hexagonal topology is the most used because of its more significant number of neighbours. In unsupervised network learning, output nodes compete to be activated. Only the node with the weight closest to the input vector will be activated and declared the Best Matching Unit (BMU). Specifically, for the BMU identification, the distance between an input sample \(\mathrm{x_{i}}\) and all weight vectors \(\mathrm{w_{j}}\) is calculated using measurement methods such as Manhattan, Chebyshev, or Euclidean distance. However, according to [PERSON] (2011), the Euclidean distance (see Equation (2)) is the most suitable for a visual representation because a more isotropic visualization of the dataset is achieved. \[\mathrm{d_{p}^{i}}(\mathrm{k})=\sqrt{\sum_{i=1}^{n}\left(\mathrm{x_{ij}}( \mathrm{k})-\mathrm{w_{j,p}^{i}}(\mathrm{k})\right)^{2}} \tag{2}\]  
With i = 1, 2 \(\dots\ \mathrm{D}\), p = 1, 2 \(\dots\ \mathrm{m}\), and k = 1, 2 \(\dots\ \mathrm{T}\), where T is the maximum iterations number.