## 4 Anomaly Detection Model Training
### Multi-Layer Perceptron (MLP)  
MLP is the neural network in the form of sequentially attaching several layers that are composed of perceptrons. Figure 4 shows the structure of the perceptron [47]. As shown in Figure 4, a single perceptron adds up all the weighted inputs and biases and then calculates an output \(h\) by inputting the summed value to an activation function, shown in Figure 5.  
We trained the engine clutch engagement/disengagement anomaly detection model using MLP by configuring the input/output structure as shown in Figure 6. Because MLP can receive one-dimensional input data only, the target signals for each pattern were configured and inputted in one dimension, as shown in Figure 6. Although MLP receives one-dimensional data, we expected MLP to learn data patterns because units of hidden layers are all connected to input nodes. There are also studies where MLP learned time \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Normal Patterns** & **Anomaly Patterns** \\ \hline Number of data & 1878 & 25 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The number of engine clutch engagement/disengagement patterns for model training and test (before the copy of anomaly patterns). Figure 4: Structure of a perceptron. Figure 5: Activation functions for MLP: (**a**) hyperbolic tangent function; (**b**) sigmoid Function; (**c**) ReLU function. \begin{table}
\begin{tabular}{c c} \hline \hline  & **Normal Patterns** & **Anomaly Patterns** \\ \hline Number of data & 1878 & 25 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: The number of engine clutch engagement/disengagement patterns for model training and test (after the copy of anomaly patterns). series data [48; 49]. Before inputting data to MLP, because the length of the target signal in a pattern may be different for each pattern, it is necessary to match the length of the signal and then input it into the network. Accordingly, the data were constructed in one dimension after filling the insufficient data points with zeroes in line with the pattern that had the longest data length. Equation (1) below is the example of a pattern with a length of 5, filling the data with a length of 10. In the equation, \(x_{Data}\) is the preprocessed target signal vector, and \(x_{Data,Input}\) is the target signal vector that is inputted into the network; \(x_{Data,Input}\) configured in this way is reorganized into one dimension in the way shown in Figure 6 and input into the network. We composed the output as normal/anomaly per pattern to determine normal/anomaly considering data trends over time. The two output units shown in Figure 6 are \(\left[ \begin{array}{cc}1&0\end{array} \right]^{T}\) in the case of normal and \(\left[ \begin{array}{cc}0&1\end{array} \right]^{T}\) in the case of anomaly. This output unit configuration follows the setting of the Matlab MLP training app we used. This app determines the number of output neurons as much as the number of output classes. \[x_{Data}=\left[ \begin{array}{cccc}x_{1}(t_{1})&x_{2}(t_{1})&\cdots\\ x_{1}(t_{2})&x_{2}(t_{2})&\cdots\\ x_{1}(t_{3})&x_{2}(t_{3})&\cdots\\ x_{1}(t_{4})&x_{2}(t_{4})&\cdots\\ x_{1}(t_{5})&x_{2}(t_{5})&\cdots\end{array} \right]\ \longrightarrow\ x_{Data,Input}=\left[ \begin{array}{cccc}x_{1}(t_{1})&x_{2}(t_{1})&\cdots\\ x_{1}(t_{2})&x_{2}(t_{2})&\cdots\\ x_{1}(t_{3})&x_{2}(t_{3})&\cdots\\ x_{1}(t_{4})&x_{2}(t_{4})&\cdots\\ x_{1}(t_{5})&x_{2}(t_{5})&\cdots\\ \end{array} \right] \tag{1}\]  
The number of hidden layers and hidden units for the MLP-based models were composed as shown in Table 4. We set these values to an appropriate value through trial and error. This configuration is for comparing training results according to the number of hidden units per hidden layer and training results according to the number of hidden layers. For a clear comparison, we composed values with large differences. A hyperbolic tangent function was used as an activation function.