# Online Forecasting and Anomaly Detection Based on the ARIMA Model
## 2 Materials and Methods
### Anomaly Detection Algorithms
#### 2.4.2 One Point Prediction
Table 3 shows the scoreboard with the current state of the anomaly detection algorithm's performance for the Numenta Anomaly benchmark, taken from the official page of the NAB on GitHub, and the results obtained using Algorithms 4 and 5. It can be seen from the table that the anomaly detection algorithm based on the ARIMA model shows strong results, and the algorithm based on Online Gradient descent and the complex metric took third place in accordance with this scoreboard. This algorithm was also tested for its ability to detect hidden defects on real technical systems. Figure 3 shows the discrete differences in the weight coefficients of a turbogenerator-bearing vibration. From this figure, it can be seen that the received values increase in absolute value in a time moment in which, according to the commission, a defect arises, leading to the failure of the turbogenerator. Most of the other splashes are related to changes in the operation mode. For the case of the turbogenerator, one out of five hidden defects was detected. \begin{table}
\begin{tabular}{c c c c} \hline
**Detector** & **Standard Profile** & **Reward Low FP** & **Reward Low FN** \\ \hline Perfect & 100.0 & 100.0 & 100.0 \\ Numenta HTM & 70.5–69.7 & 62.6–61.7 & 75.2–74.2 \\ CAD OSE & 69.9 & 67.0 & 73.2 \\ ARIMA AD algorithm with complex metric * & 65.03 & 48.11 & 71.23 \\ earfibeco Skyline & 58.2 & 46.2 & 63.9 \\ KNN CAD & 58.0 & 43.4 & 64.8 \\ One point prediction * & 56.76 & 25.61 & 67.44 \\ Relative Entropy & 54.6 & 47.6 & 58.8 \\ ARIMA AD algorithm with mean of max/std metric * & 53.66 & 34.20 & 60.48 \\ ARIMA AD algorithm with max of absolute value metric * & 51.11 & 29.05 & 59.07 \\ Random Cut Forest & 51.7 & 38.4 & 59.7 \\ Twitter ADVec v1.0.0 & 47.1 & 33.6 & 53.5 \\ Windowed Gaussian & 39.6 & 20.9 & 47.4 \\ Etsy Skyline & 35.7 & 27.1 & 44.5 \\ ARIMA AD algorithm with Euclidean norm metric * & 18.57 & 13.75 & 21.00 \\ Bayesian Changepoint & 17.7 & 3.2 & 32.2 \\ EXPoSE & 16.4 & 3.2 & 26.9 \\ Random & 11.0 & 1.2 & 19.5 \\ Null & 0.0 & 0.0 & 0.0 \\ \hline \end{tabular}
\end{table} 
Table 3: Score NAB from the scoreboard, where symbol * marks the result obtained by Algorithms 4 and 5. Figure 2: Absolute forecasting error averaged over all refitting. Forecasting horizon is 180 points. ## 4 Discussion

The results obtained during the forecasting experiment with various online algorithms were rather interesting and sometimes unexpected. The main results are shown in Table 2 and Figure 2. In actual fact, we expected to obtain results showing that non-refitted ARIMA had the worst result in terms of the MAPE, but this does not always happen when using real-world data. One of the possible reasons for this is that, halfway through a month, the technical system's state does not change so much that the trained model becomes incorrect. On the other hand, the models have to be retrained sooner or later due to the turbogenerator's continuous state changes and data drift. In this case, questions regarding the model retraining frequency and window selection for retraining are raised. The OGD algorithm allows us to dispel these questions since the model is updated constantly in real time. Additionally, the results clearly show that all algorithms are suitable for short-term forecasting. However, for long-term forecasting (180 points ahead), as expected [16], the OGD algorithm is less suitable, as the MAPE value is quite small (less than 1 percent) and still comparable with other algorithms' results. The comparison of computational complexity also favors the OGD-based algorithm among the retrainable model-based algorithms (Table 2). We also obtained interesting results for the anomaly detection problems at the turbogenerator. We detected one out of five hidden defects. At first glance, it seems that we obtained a weak result when applying this algorithm since just one hidden defect out of five was correctly detected.