## 2 Materials and Methods
### Autoencoder Anomaly Detection  
Anomaly detection via autoencoder is performed providing the network a training dataset composed of normal data, that can be represented as \(\{x(1),\,x(2),\,...,\,x(m)\}\). Autoencoders can be divided into two parts: an encoder and a decoder.  
The encoder's goal is to reduce the dimension of the data, mapping data into lower dimensional spaces, reducing the number of neurons in each successive layer, until the bottleneck is reached. The number of layers and neurons in the network is determined by a tradeoff between the compression of the input information and the ability to reconstruct the input sufficiently well. Neurons are activated by an activation function such as the one presented by the following equation [21]:  
\[a_{i}^{(l)}=f\!\left(\sum_{j=1}^{n}W_{ij}^{(l-1)}a_{j}^{(l-1)}+b_{i}^{(1)}\right) \tag{1}\]  
where \(W\) and \(b\) are the weight and bias of the model, and the indexes \(i\) and \(j\) denote the unit and the layer, respectively. Non-linear activation functions are typically utilized to allow the network to represent non-linear characteristics of the data. In this research, the rectified linear unit (ReLU) function has been used, and is defined as follows:  
\[f(x)=\max(0,\,x) \tag{2}\]  
The decoder's function is to reconstruct the encoded data at the best of its possibilities. The entire structure, encoder and decoder, is in fact optimized, minimizing the following cost function, presented in Reference [21]:  
\[J(W,b)=\frac{1}{m}\sum_{i=1}^{m}\left(\frac{1}{2}\big{\|}x(i)-\hat{x}(i)\big{\|} ^{2}\right)+\frac{\lambda}{2}\sum_{l=1}^{n_{l}-1}\sum_{i=1}^{s_{l}}\sum_{j=1 }^{s_{l}+1}\!\left(W_{ji}^{(l)}\right)^{2} \tag{3}\]  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Start time** & **End time** & **Turbine** & **Alarm Description** \\ \hline
2017-05-24 10:39:29 & 2017-05-24 10:40:27 & WT05 & Gen brushWear Warn \\
2018-07-05 11:47:29 & 2018-07-05 11:59:57 & WT03 & GenRot RpmMonitor Stop \\
2018-04-13 08:00:58 & 2018-04-13 12:37:04 & WT02 & Gear OilFilt Warn (75\% clogged) \\ \hline \hline \end{tabular}
\end{table}
Table 2: Alarm dataset sample.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Start Time** & **End Time** & **Turbine** & **Component** & **Work Description** \\ \hline
2017-02-18 07:52:00 & 2017-02-19 13:30:00 & WT06 & Generator bearing & Generator bearings replacement \\
2017-06-30 10:46:00 & 2019-06-30 14:03:00 & WT08 & Blade & Scheduled inspection \\
2017-08-27 08:50:00 & 2018-09-03 15:28:00 & WT07 & Gearbox & Gearbox replacement due to fractured gear tooth \\ \hline \hline \end{tabular}
\end{table}
Table 3: Work order sample.  
in which \(n_{l}\) is the number of layers, \(s_{l}\) is the number of units in layer \(L_{l}\) and \(\lambda\) is the regularization parameters that keep a balance between the memorization and generalization capabilities of the network. As the equation shows, a larger and more complex network would be penalized by the factor \(\lambda\). The first part of the equation defines the difference between the input and output vectors, and thus a priority of the network will be to minimize this difference.  
As explained in Reference [22], anomaly detection using autoencoders can be seen as a semi-supervised learning problem. The autoencoder is trained with normal data and learns its representation in a reduced dimensional space. The reconstruction error is utilized as a metric to determine abnormal data. Data that does not fit the representation learned in the training phase results in higher reconstruction error and can be marked as anomalous.