# Prediction of Structural Type for City-Scale Seismic Damage Simulation Based on Machine Learning
## 4 Semi-Supervised ML Solution
### Semi-Supervised ML Solution
#### 2.2.1 Second self-training  
Second self-training was implemented using components in Azure, as shown in Figure 15. However, the training data used were different from those of the first self-training. The original training data (the CSV file in Component 3 in Figure 12) and the identified building data with high accuracy (the CSV file in Component 8 in Figure 12) were integrated as the training data for the second self-training. It is noted that the assessment data (i.e., 2/3 of the sample data) were the same for all self-trainings. Figure 12: Process of first self-training. Figure 13: Part of the scored building data. Similar to the first self-training, the model was trained and evaluated. As shown in Figure 16, the overall accuracy rate is above 95.1%, which is similar to that of the first self-training (95.5%). In particular, the prediction accuracy of the frame structure increased from 81.7% to 86.9%, which is an improvement. Similarly, the building data with high accuracies were converted to CSV format for the next self-training. Figure 14: Prediction accuracies and confusion matrix for the first self-training scenario. Figure 15: Process of second self-training. 3. Third self-training  
After the third self-training, the prediction results are as shown in Figure 17. The overall prediction accuracy of the model is 95.2%. In detail, the prediction accuracies of the masonry, frame, and shear wall structures are 96.1%, 87.0%, and 100.0%, respectively. The accuracies of the overall prediction and each type of structure will not increase significantly compared with those of the last self-training. In addition, the corresponding precision and recall are also very high, as shown in Figure 17. Therefore, additional self-trainings are not required. The predicted structural type of all the buildings by the third self-training was compared with the real data in Tangshan, and the error is shown in Table 2. The results indicate that the designed semi-supervised ML solution can achieve a high prediction accuracy even when using 1% of all the building data. Both the other attribute data of buildings and the structural types of the sampling buildings are accurate, which guarantees the prediction accuracy using the designed ML solution. Furthermore, the self-learning process can improve the prediction accuracy. Therefore, the prediction results in Table 2 is exact compared with the real structural types of buildings in Tangshan. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Structure Type** & **Real Data** & **Prediction Results** & **Error** \\ \hline Masonry & 87.07\% & 83.68\% & 3.40\% \\ Frame & 10.78\% & 14.18\% & \(-\)3.40\% \\ Shear wall & 2.14\% & 2.14\% & 0.00\% \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison between the real data and prediction result in Tangshan. Figure 16: Prediction accuracies and confusion matrix for the second self-training scenario. No structural type exists in the GIS data of Daxing downtown; therefore, the designed semi-supervised ML solution in this study was used to predict the structural type of buildings. Figure 19: Building distribution with different construction years. Figure 18: The locations of Daxing and Tongzhou districts in Beijing. (1) Building sampling investigation  
In this case study, 3% of the total buildings in Daxing downtown was investigated to obtain the complete attribution data of the buildings. According to the recommended sampling fraction in this study, 1% of the total buildings was used for the training model, while the remaining 2% for assessing the model. As mentioned previously, 69,180 buildings exist in Daxing downtown; therefore, 2075 buildings (i.e., 3% of total buildings) were randomly investigated. The distribution of structural type in the investigated buildings is shown in Table 3.  
(2) Training model  
The sample data of 2075 buildings were uploaded to the Azure platform.