# Time-Series Forecasting of Seasonal Data Using Machine Learning Methods
## 2 Methodology
### The Technical Roadmap and Data Collection  
In this research, we used the actual data obtained from the monitoring system of the wastewater treatment plant. The monitoring system sensors collect basic parameters, such as input and output flow value, oxygen concentration, ammonia content, etc. Data from sensors come to the OPC server, and the OPC monitor records data with a frequency of once per second in synchronous and asynchronous modes. After the preprocessing, the monitoring system saves data in the database. The monitoring system operates 24/7, allowing obtaining data for any period of interest in the form of a comma-separated values format.  
The model development process can generally be presented as a technical roadmap, shown in Figure 1.  
There are two layers: the data layer and the model layer. Each layer is conventionally divided into three steps.  
As described above, the data layer (steps 1-3) implements preprocessing and data preparation.  
The model layer involves selecting model parameters (step 4), which can be implemented in two ways: automatically and manually. The selection method depends on the library's capabilities to build the model. The next step (step 5) is model building, which involves setting the parameters defined in the previous step and training the model. At this step, all actions with the model can be called <<model building>>. The last step (step 6) is the validation of the model. By <<model validation>>, we mean obtaining a prediction and comparing the parameter estimates with their actual values. To assess the quality of the model, we will use a set of metrics described below. If the model metrics meet the specified ones, the model is saved and can be used to generate a forecast. If the metrics are unsatisfactory, you should return to step 4 and perform all subsequent steps at the data layer.  
The estimation of the model's accuracy was calculated with five statistical metrics: correlation coefficient (\(R^{2}\)), mean squared error (\(MSE\)), root mean squared error (\(RMSE\)),  
Figure 1: The technical roadmap of data analysis.  
mean absolute error (_MAE_), and mean absolute percentage error (_MAPE_) [12; 37]. The correlation coefficient (\(R^{2}\)) is used to determine the degree of fit of the forecasted values to the actual values. _MSE_ is the average change in actual and forecast values, _RMSE_ is the square root of _MSE_, and _MAE_ is proposed as the average change between actual and predicted values. Compared with _MAE_, _RMSE_ emphasizes the variance between data outliers. These metrics are calculated with equations:  
\[R^{2}=1-\frac{\sum\limits_{i=1}^{m}{\left\|{{{\hat{y}}_{i}}-{{y}_{i}}}\right\|^ {2}}}{\sum\limits_{i=1}^{m}{\left\|{{{\hat{x}}_{i}}-{{y}_{i}}}\right\|^{2}}} \tag{1}\] \[MSE=\frac{1}{m}\sum\limits_{i=1}^{m}{\left\|{{{\hat{y}}_{i}}-{{y} _{i}}}\right\|^{2}}\] \[RMSE=\sqrt{\frac{1}{m}\sum\limits_{i=1}^{m}{\left\|{{{\hat{y}}_{i }}-{{y}_{i}}}\right\|^{2}}}\] \[MAE=\frac{1}{m}\sum\limits_{i=1}^{m}{\left|{{{\hat{y}}_{i}}-{{y} _{i}}}\right|}\] \[MAPE=100\%\frac{1}{m}\sum\limits_{i=1}^{m}{\frac{{\left|{{{\hat{y}} _{i}}-{{y}_{i}}}\right|}}{{\left|{{{\hat{y}}_{i}}}\right|}}}\]  
where \({{{y}_{i}}}\) and \({{{\hat{y}}_{i}}}\) are the actual and predicted values, and \(m\) represents the number of samples.