# A Deep Learning Method for the Prediction of Pollutant Emissions from Internal Combustion Engines
## 3 Developing and Optimization of the Artificial Neural Network
### Overview of the Procedures for Establishing the Structural Parameters of the Proposed Model  
A preliminary comparative analysis of the BP neural architectures was conducted, focusing on optimizing their internal structures to achieve high prediction quality and faster convergence times. This optimization involved experimenting with various numbers of hidden layers, neurons, and activation functions. All activities, including architecture development and optimization, were executed within the MATLAB environment, using a single CPU (central processing unit) and 16 GB of RAM (Random Access Memory). To assess the precision and performance of the model's parameters, the root mean square error (RMSE), which represents the average squared differences between predicted values and observed values, has been employed as the primary metric for measuring loss (Equation (1)). In regression problems, it is common practice to also employ additional metrics, such as the mean squared error (MSE) and the mean absolute error (MAE), to further evaluate model performance. \[RMSE\ [\%]=100\times\sqrt{\frac{1}{N}{\sum_{i=1}^{N}}\left({Y_{predicted}^{i}-Y_{ target}^{i}}\right)^{2}} \tag{1}\]  
where  
* \(N=\) cycle duration. Figure 7: Complete BPANN general scheme. * \(i=i\)th temporal instant. * \(\Upsilon^{i}_{predicted}=\)predicted value. * \(\Upsilon^{i}_{target}=\)target value (experimental results). As mentioned in the introduction, an upper threshold of 10% is established for these calculated RMSEs to guarantee precise predictions. For the BPANN architecture, the structural parameters examined to optimize network performance include the number of hidden layers, varying from 2 to 6, and the number of neurons per hidden layer, ranging from 20 to 100. The network has been trained for 10,000 epochs, enabling the calculation of the final loss function value for each prediction model once the maximum learning iteration has been achieved. The most effective configuration of the BPANN consists of an input layer with 4 neurons, corresponding to the number of input variables. This is followed by 4 hidden layers, each containing 100 neurons. These hidden layers are separated by ReLU (Rectified Linear Unit) activation functions, which improve the network's capability to recognize intricate patterns from the input strongly non-linear data. Finally, the network features an output layer with 4 physical neurons, the associated values of which are synchronized with the input physical quantities. It is important to emphasize that the alignment between 4 input and 4 output variables is merely coincidental and should not be misconstrued as a structural limitation of the model. This architecture, fine-tuned through a thorough preliminary analysis, is designed to take advantage of deep learning through multiple hidden layers and ReLU activation to improve pattern recognition and predictive performance. The Adam optimizer is utilized in this study, as it incorporates an adaptive learning rate along with momentum adjustments throughout the training process. This advanced optimization algorithm is specifically designed to enhance the efficiency of the weight matrix and bias adjustments within the BPANN model, ultimately improving its overall performance and convergence speed. To ensure completeness, the validation loss and training loss curves of the most effective BPANN structure are illustrated in Figure 8:  
Figure 8: The trend in loss values for the BPANN architecture indicated optimal performance throughout the training session. As illustrated in Figure 9, where the red curves depict the predictions generated by the network and the black curves represent the experimentally obtained target values, the BPANN architecture demonstrates a remarkable ability to accurately replicate the emission trends for each dynamic cycle and every pollutant analyzed. Upon closer examination, it is evident that for all the cases studied, the RMSE remains significantly below the acceptable threshold of 10%, never exceeding 6%.