# Investigation of Structural Seismic Vulnerability Using Machine Learning on Rapid Visual Screening
## 2 Materials and Methods
### Proposed Methodology for the Recalibration of RVS Using Machine Learning  
As we will examine in the next paragraphs, a hybrid approach that employs the algorithm presented in Section 2.2, in conjunction with the Gradient Boosting classifier presented in Section 2.4, can significantly improve the performance of the currently established RVS procedures for the examined Seismic Codes. In this Section, we examine the potential extension of the above methodology towards a closer alignment with the spirit of the aforementioned Codes. Our motivation stems from the fact that, as is well known, most of the Seismic Codes examined herein and presented in Table 2 are additive. Specifically, each of the features they utilize is assigned a weight, \(\Delta V_{m}\), which can be either negative or positive, and the final vulnerability index is obtained as  
\[V_{I}=V_{I}^{b}+\sum\Delta V_{m}, \tag{2}\]  
wherein \(V_{I}^{b}\) is a basic vulnerability index which varies in different Seismic Codes. The structures in the population can then be ranked in ascending order of the above computed index. One notable exception is the Canadian Code. In this RVS approach, the employed features are first grouped into intermediate variables pertaining to seismicity, soil conditions structural type, and any potential irregularities. These intermediate variables are obtained in an additive way, while the final index is the product of the intermediate variables. Furthermore, the final ranking is obtained in descending order of the index, unlike most other Codes.  
The above observations, especially in the form of (2), provide the motivation for a potential recalibration of RVS using the examined novel pairwise formulation. Indeed, for each Seismic Code, we can define a weight vector \(\mathbf{w}=\{w_{1},w_{2},...,w_{n}\}\), where \(n\) is the number of features of each Seismic Code. Thus, these weights are completely analogous to \(\Delta V_{m}\). Furthermore, these weights allow us to modify Algorithm 1 presented in Section 2.2 as shown in Algorithm 3.  
This procedure is fundamentally different from the way RVS rankings are obtained in the established literature. However, it is not independent from the Machine Learning methodology examined in Section 2.2, since, as we will analyze, these weights are obtained from the fully trained ML models using the so-called SHapley Additive exPlanations (SHAP) values. It should be reiterated that the aim of this study is not to provide the values of the weights themselves, but rather to demonstrate a procedure for their estimation. Given the promising results presented in the present study, it is hoped that the proposed methodology will be applied to larger datasets, specifically tailored to each country's seismic demands, which will yield a more accurate calibration of the models for each individual Seismic Code.  
```
for\(i=1,2,...,m\)do: Initialize \(\text{wins}(s_{i})=0,\theta(s_{i})=0\) for\(j=1,2,...,m,j\
eq i\)do: Compute \(\mathbf{x}_{\text{new}}\) and compute \(\theta=\mathbf{w}\cdot(\mathbf{x}_{j}-\mathbf{x}_{i})\) if\(\theta>0\): \(\text{wins}(s_{j})=0+=1,\theta(s_{j})\)\(+=\theta\) else: \(\text{wins}(s_{i})=0\)\(+=1,\theta(s_{i})\)\(+=\theta\) endfor endfor Rank the given population of structures based on the total number of \"wins\", using the running sum \(\theta\) as a secondary metric.
```  
**Algorithm 3** Algorithmic seismic vulnerability ranking process using the proposed recalibration procedure.