## 3 Machine Learning Modeling
### Modeling and Hyperparameter Tuning  
The airflow humidity and temperature data at different positions have close spatiotemporal relationships and have unstable gradient variation. To accommodate this issue and to  
Figure 5: LSTM neural structure.  
Figure 6: Framework of the PCA-LSTM-GA model.  
make full use of the spatiotemporal properties implied by the data, a prediction model for airflow humidity and temperature data was constructed here based on the LSTM model for the time sequence problem. Since the input features of this model were as many as 21, there might be problems of parameter redundancy and lowered training speed occurring. Furthermore, artificial selection of model parameters will typically not make the model have an optimal performance. In this paper, to make the model have the optimal effect, dimension reduction was conducted for the input parameters of the model using the PCA algorithm, and intelligent optimization was carried out for the model after dimension reduction using the GA, to select the optimal parameter values for the model, and thus to construct a prediction model for humidity and temperature at the end of the roadway based on PCA-LSTM-GA.  
Since how the model performs is affected by both the neural network structure and the model parameters, the number of units in the LSTM layer, dropout layer parameter, batch size, and optimizer learning rate were selected as optimization objects for GA (Figure 6). An LSTM network model was established based on the values taken for the initial hyperparameters, and it was trained with the training data. Prediction was carried out with the test data put into the trained model, and optimization was conducted with the error generated by the model in the test dataset as the optimization target until the termination condition was met. Finally, an LSTM network model was constructed with optimum values of the hyperparameters.  
In this study, the PCA-LSTM network model mainly contained four layers, namely the input layer, LSTM layer, dropout layer, and output layer. MSE was used as the loss function, and Adam was selected as the optimization algorithm. The dropout layer parameter, batch size, and optimizer learning rate were set as hyperparameters of the LSTM network model. The value ranges for optimization of hyperparameters were set as follows: [10; 100] for the number of units in the LSTM layer, [0.1, 0.3] for the dropout layer parameter, [5; 25] for the batch size, and [0.0001, 0.01] for the Adam optimizer learning rate.  
Comparatively, the LSTM model comprised the input layer, LSTM layer (with number of units of 60), dropout layer (with parameter of 0.1), and output layer, and the Adam optimizer learning rate was 0.001. The loss function used was also the MSE.  
Both the experimental models were constructed with the Keras. An introduction of the algorithm flow is as follows:  
Step 1 (dataset preprocessing): first, the original dataset is divided into the training set and the testing set. Next, the cumulative contribution rates of the principal components are determined. Subsequently, the original experimental data are dimension reduced (from the initial 21 dimensions to 5 dimensions) through PCA, and the data after dimension reduction are taken as input for the neural network model.  
Step 2 (model construction): first, an LSTM neural network model is constructed. Then, GA is utilized to calculate the batch size, learning rate, and dropout layer parameters of the constructed model with MSE as the objective function.  
Step 3 (model generalization ability verification): the prediction performance of the model on the testing set is validated by taking \(R^{2}\) and MSE as evaluation indices.