# Heat Load Forecasting of Marine Diesel Engine Based on Long Short-Term Memory Network
## 3 Case Study
### Analysis of Modeling and Prediction Results  
On the basis of Spearman correlation analysis, the top nine positively correlated parameters are selected as model inputs in predicting the target output exhaust temperature \(T\). The inputs are divided into training and test sets in a ratio of 7:3 given the impact of data volume on learning ability in the data drive. A combination of grid search and tenfold cross-validation methods is applied to improve the prediction performance of the model. The number of times to calculate the set of hyperparameters \(X=\{X_{1},X_{2},\ldots,X_{n}\}\) is \(\Pi_{i}=i^{i=n}\ |\ h_{i}|\), where (\(i=1,2,\ldots\) ) and \(h_{i}\) is the number of hyperparameter values. Five parameters are selected in this study to set the hidden layers, hidden units, training rounds, learning rate, and batch size of the LSTM prediction network. The change trend of the loss function is affected by five super parameters, which are divided into two groups. See the change in loss function under the change in hyperparameters.  
The influence of the number of units and learning rounds of the five-layer neural network on RMSE is shown in Figure 5. With the increase in the number of learning rounds, the RMSE decreases first and then increases, and the RMSE of 100 units is generally lower than that of other units. From Figure 6, we can see that the loss function is affected by different hidden layers. Usually, higher values are caused by the low learning rate of 0.001. Among the 0.01 learning rate and 0.005 learning rate, the number of hidden layers of five layers is better than other layers.  
Figure 5: Influence of Unit Number and Learning Round Number on RMSE.  
In the process of hyperparameters optimization, the combination with low RMSE value is selected as the best hyperparameters combination. Some adjustment results of cross-validation grid search optimization are shown in Table 3 below.  
After optimization, the best hyperparameter combination of RMSE is obtained. The hyperparameter candidate values and optimal values of the prediction model LSTM are shown in Table 4 below.  
After the optimal parameter combination is selected, the training set is input into the LSTM model for training. At the same time, discard technology is introduced to prevent the model from over fitting. The training curve and training relative error scatter diagram are shown in Figures 7 and 8 below. From the figure, we can see that the predicted value basically coincides with the actual value in the training, and the error in the training finally approaches the zero line.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Hyperparameter Name** & **Hyperparameter Values** &
\begin{tabular}{c} **Example of Optimal** \\ **Hyperparameter Values** \\ \end{tabular} \\ \hline Learning rate & \{0.01, 0.005, 0.001\} & 0.01 \\ Hidden layers & \{3, 4, 5\} & 5 \\ Hidden units & \{100, 150, 200\} & 100 \\ Training rounds & \{100, 200, 300\} & 300 \\ Batch size & \{64, 128, 256\} & 128 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Candidate and optimal sets of hyperparameters for the LSTM model.  
Figure 6: Influence of hidden layer on RMSE.  
The test set is fed into the trained model for exhaust temperature prediction. The prediction results are illustrated in Figure 9. The strong generalization ability of the prediction model is reflected by the consistency between the predicted and measured temperature values. The results of the selected forecasting model are subsequently analyzed by comparison with those of traditional forecasting methods, as described in detail below.  
Figure 8: Relative error of model training.  
Figure 7: Model training result curve.  
Figure 9: Model prediction outcomes.