Generating phone-quality records to train machine learning models for smartphone-based earthquake early warning

Earthquake early warning (EEW) system detects earthquakes and sends an early warning to areas likely to be affected, which plays a significant role in reducing earthquake risk. In recent years, as with the widespread distribution of smartphones, as well as their powerful computing ability and advanced built-in sensors, a new interdisciplinary research method of smartphone-based earthquake early warning has emerged. Some smartphone-based earthquake early warning systems have applied signal processing techniques and machine learning algorithms to the sensor data recorded by smartphones for better monitoring earthquakes. But it is challenging to collect abundant phone-recorded seismic data for training related machine learning models and selecting appropriate features for these models. One alternative way to solve this problem is to transform the data recorded by seismic networks into phone-quality data. In this paper, we propose such a transformation method by learning the differences between the data recorded by seismic networks and smartphones, in two scenarios: phone fixed and free located on tables, respectively. By doing this, we can easily generate abundant phone-quality earthquake data to train machine learning models used in EEW systems. We evaluate our transformation method by conducting various experiments, and our method performs much better than existing methods. Furthermore, we set up a case study where we use the transformed records to train machine learning models for earthquake intensity prediction. The results show that the model trained by using our transformed data produces superior performance, suggesting that our transformation method is useful for smartphone-based earthquake early warning.

well as their powerful computing ability and advanced built-in sensors, a new interdisciplinary research method of smartphone-based earthquake early warning has emerged. Some smartphone-based earthquake early warning systems have applied signal processing techniques and machine learning algorithms to the sensor data recorded by smartphones for better monitoring earthquakes. But it is challenging to collect abundant phone-recorded seismic data for training related machine learning models and selecting appropriate features for these models. One alternative way to solve this problem is to transform the data recorded by seismic networks into phone-quality data. In this paper, we propose such a transformation method by learning the differences between the data recorded by seismic networks and smartphones, in two scenarios: phone fixed and free located on tables, respectively. By doing this, we can easily generate abundant phonequality earthquake data to train machine learning models used in EEW systems. We evaluate our transformation method by conducting various experiments, and our method performs much better than existing methods. Furthermore, we set up a case study where we use the transformed records to train machine learning models for earthquake intensity prediction. The results show that the model trained by using our transformed data produces superior performance, suggesting that our transformation method is useful for smartphone-based earthquake early warning.

Introduction
Large earthquakes cause a lot of casualties and property damage, especially in densely populated cities (Holzer and Savage 2013;Kodera et al. 2016). A routine earthquake monitoring task of Earthquake Early Warning (EEW) system is to detect earthquakes and calculate where and when they occur Hoshiba et al. 2011;Heaton 1985;Allen and Kanamori 2003). Then, the system can send an early warning to areas likely to be affected. This system plays a significant role in reducing earthquake risk. However, only a few countries have built the EEW system (Allen et al. 2009;Clayton et al. 2012). The EEW system requires a sufficiently dense seismic network for its primary function of earthquake detection and location, which needs enormous construction cost.
To avoid this problem, more and more researches use crowdsourcing as another approach to provide such information for earthquake early warning. For example, the "Did You Feel It" (DYFI) project of the US Geological Survey (USGS) (Wald et al. 1999;Wald et al. 2011) accomplished it by asking users to enter information to a post-earthquake web interface. The entered information included the user's perceived intensity and postal codes providing the location information. And enough user reports can reduce the subjective of intensity information and the roughness of location information.One drawback of the project was the timeliness issue. The people in the worst-hit areas didn't enter the information immediately after the earthquake happens. Instead, they usually escaped at the first time, which made the information arrives late. The Quake-Catcher Network (QCN) and Community Seismic Network (CSN) (Cochran et al. 2009;Clayton et al. 2012) were a new form of seismic network, which utilized any internet-connected computer with an internal or external MEMS accelerometer to provide earthquake information. But the size of these networks was limited, since relevant hardware needed to be passed from network operators to the users.
Smartphones have been used widely in the field of EEW, because of phones' widespread distribution, computing power, and sensors allowing the properties measurement of the phone itself and the external environment (Lee et al. 2018). These kinds of systems analyzed earthquakes using signal processing techniques and traditional algorithms with various sensors of smartphone to predict and prevent damage from earthquakes. The UC Berkeley iShake project (Reilly et al. 2013) designed a system architecture that used sensor-equipped smartphones to detect ground shaking. This project conducted shake table experiments to prove that smartphone sensors have the detection ability. The Earthquake Network research project (Finazzi 2016) aimed at implementing a global scale earthquake early warning system using smartphones as accelerometers. In this project, if the number of smartphones reporting shaking during the past 30 s exceeds a threshold based on the expected number of reports in the absence of shaking due to earthquake waves, software at the central server will declare an earthquake. The MyShake project (Kong et al. 2015;Kong 2019) was a new form of global smartphone-based seismic network. This project developed an application for Android and iPhone users to distinguish earthquake from human activities, and then uploaded relevant information including trigger time, peak ground acceleration (PGA), and GPS position, to a centralized processing center (CPC). CPC used this information to detect earthquake, and calculated earthquake magnitude, epicenter and origin time. (Hsu and Nieh 2020) also proposed a smartphone-based EEW system. This system is an on-site one that only used one smartphone for earthquake detection. (Khan et al. 2020) tried to use smartphone to distinguish the earthquake signals from the non-earthquake signals, such as noise or other human activities. To that end, they split the detection task into two categories including static environment and dynamic environment. For each environment, they experimentally selected the most appropriate features and machine learning model for earthquake detection.
The smartphone-based earthquake early warning (SEEW) system has received more and more attention, and become a promising research area. In order to well train SEEW-related models, it is needed to collect representative and sufficient phone-recorded earthquake data. But because of the unpredictable nature of earthquakes, it is difficult to be accomplished. Therefore, some researchers Suryo 2018;Aji Fig. 1 An example of the differences between phone record and accelerograph record 2014) used a shake table (or called earthquake simulator) to simulate earthquakes, and put smartphones on the shake table to collect data. However, since it is costly to run to run a shake table, only a few earthquakes can be simulated. Besides, the number of smartphones used to collect data was limited due to the high cost of smartphones. Therefore, the amount of the data collected through shake table is very limited. ) only collected 241 3-component records from 45 shake table runs. One alternative way to solve this problem is to transform the data recorded by seismic networks to phone quality data. By doing this, we have abundant phone quality earthquake data to train SEEW-related models. Figure 1 shows an example of the differences between phone record and accelerograph record.
To have sufficient phone quality data to train SEEW-related models, we propose a transformation method, which is called Transformation Method from Accelerograph to Phone-quality (TMAP) records. Considering the low accuracy of the phone's sensors, our TMAP uses a system identification (Ljung and Glad 1994;Pintelon and Schoukens 2001) model to explain the difference between the data recorded by smartphones and real ground motion data. There is also another type of difference caused by the slipping of smartphones. For example, in the real world, when the earthquake waves arrive, the smartphones located on tables start to slip, especially in larger earthquake events. This slipping results in huge differences between phone quality data and seismic network data. Therefore, TMAP then built a physical model to explain this sliding. Our TMAP considers both of the two differences, to accurately transform seismic records to phone-quality records. Figure 2 shows TMAP's training and its application in SEEW system. To train it, we use accelerograph and smartphone to record earthquake simultaneously, and thus form a dataset. It is known that seismic network's accelerograph is installed on the ground surface and is more accurate than a smartphone. We take the data it records as real ground motion data. The data recorded by the accelerograph and the smartphone are called accelerograph records and phone records, respectively, as shown in Fig. 2. Accelerograph and phone records are used together to train the TMAP model, and the trained TMAP model can generate phonequality records from accelerograph records. Before using these transformed data to train SEEW-related model, it is needed to test whether the transformation method is effective. Therefore, we set up many evaluation indexes to evaluate the similarity between transformed records and phone records. After verifying the effectiveness of our method, we conduct an experiment to prove that our transformation method is useful in SEEW system. This experiment first uses the phone-quality records and their corresponding earthquake information to train SEEW-related models, and then test whether the trained model can predict the earthquake information well in the earthquake scene. We compare our TMAP method with a similar transformation method proposed by . The key idea of Kong's method is to converts the 24-bit of accelerograph record to 16-bit record, and adds some smartphone noise. The results show that TMAP can make these models predict obviously better than Kong's method.
Our main contributions in this paper are listed below: 1. We propose an effective transformation method (TMAP), which can accurately transform accelerograph records to phone-quality records. It considers both of the two scenarios: phone fixed and free located on tables. Its effectiveness was evaluated by conducting experiments and setting up a case study. TMAP can generate abundant phone-quality records to train machine learning models for smartphone-based EEW systems.
2. Compared with existing methods, our method produces a superior performance. We also set up a case study where the generated records are used to train models for earthquake intensity prediction. The prediction results further prove the effectiveness of our transformation methods.
3. We collect 322 seismic records and 7728 smarphone records on shake tables, which form the dataset used in this study.

Problem definition
Here, we formally define the problem we want to solve. When an earthquake comes, we assume that seismic network's accelerographs are installed parallelly on the ground surface, and the phones are also parallelly on a flat plane (or ground). This is in accordance with the state of our phone in daily life. At time t, the vertical acceleration of the accelerograph and phone are a a v (t) and a p v (t), the horizontal acceleration and velocity of the accelerograph are a a h (t) and v a h (t), and those of phone are a p h (t) and v p h (t).

. , a p h (T ))
. (1) We call (A a v , A a h ) as accelerograph record, and (A p v , A p h ) as phone record. Since seismic network's accelerograph is installed on the ground surface and is more accurate than a smartphone, we take accelerograph records as real ground motion data. Given the accelerograph records and phone records, our goal is to find the difference between these two types of data. By learning the difference, we then build a transformation method, denoted as T MAP (·) in Eq.
(2), for converting between them. We call the trans- as TMAP records, which should be as similar to its corresponding phone records as possible.
To build a good transformation method, it is needed to know why accelerograph records and phone records are different. In TMAP, we consider two phone factors for this difference: the low accuracy of the phone's sensors, and the factor that the phone is not fixed to the ground. In the following subsection, the TMAP method is described in detail.

Method description
The phone factor that sensor precision of the smartphone is lower than that of accelerograph leads to the difference between phone records and accelerograph records. Assuming the smartphone is always rested relative to the ground, we use finite impulse response (FIR) model (Ljung and Glad 1994;Pintelon and Schoukens 2001) to obtain that difference. This model is a mathematical model of dynamic systems using measurements of the system's input and output signal. Each phone's accelerometer its acceleration on three axes, and each axis of each phone can be viewed as a dynamic system. During an earthquake, the real ground motion data recorded precisely by accelerograph can be seen as the input to this dynamic system, and data recorded by the phone can be seen as the output of this system.
We will train three FIR models for three axes of phone's sensor according to accelerograph records and its corresponding phone records. F I R(·) in Eq. (3) contains these three trained FIR models, and each model only processes the data of its corresponding axis. Notice that, in Eq. (3), A a v and A F I R p v mean data of only one axis, A a h and A F I R p h means data of two horizontal axes. This F I R(·) has the transformation ability, which means it can process of accelerograph records of each axis respectively and generates phonequality data (A F I R p v , A F I R p h ) of the corresponding axis. And we call this phone-quality data as FIR records. When an earthquake comes, this F I R(·) works well if the smartphone is rest relative to the ground. But it doesn't work if the smartphone slide relative to the ground. Therefore, in this situation, we just take it as a preprocessing of T MAP (·). Next, we will use a physical model to solve this problem.
The phone factor that the phone is not fixed to the ground also leads to the difference. When the earthquake comes, the ground begins to shake with it. Because of the friction between the phone and the ground, the phone also starts to vibrate accordingly. But when the earthquake is severe, the phone start to slide relative to the ground, which causes huge difference. We build a physical model to explain this sliding.
We assume that the static and dynamic friction coefficient between the ground and the phone as μ s and μ d respectively, the gravitational acceleration is g, the mass of the phone is m, and the sample time of phone's acceleration sensor is Δt. The movement of the phone in the vertical direction is not affected by the sliding state of the phone. Therefore, phone's vertical acceleration is always equal to the minimum between g and that of the ground, as defined in Eq. (4). The phone begins in a rest state relative to the ground. In this case, the phone records and accelerograph records are almost the same as defined in Eq. (5), except for subtle differences due to the lower precision of the phone's sensors. And phone's static friction force is less than its maximum static friction force, as defined in Eq. (6). (t)), which means Eq. (6) is no longer true, the phone starts in sliding state relative to the ground. At this point, in the horizontal direction, the phone is only affected by the dynamic friction force between the phone and the ground. Therefore, the direction of a p h (t) vector should always be the same as that of dynamic friction force, and the second normal form of a p h (t) should always be equal to the absolute value of dynamic friction force: Therefore, We denote the velocity and acceleration of the ground relative to the phone at time t as: According to the relation between acceleration and velocity, we can get the following equation approximately: Since the direction of the phone's dynamic friction force is the same as the direction of Δv(t), the direction of the a p h (t) should also be consistent with Δv(t). Therefore, the acceleration of the phone at time t + Δt is: Therefore, We set the initial values of Δv (0) and Δa(0) both be 0. We also have known the value of a a h (t) and a a v (t) at any time t. Then, according to Eqs. (9), (10), (11), (12) and (13), we can further get Δv(t + Δt) and Δa(t + Δt) from Δv(t) and Δa(t). Therefore, Δv(t) and Δa(t) can be obtained at any time t. Then, we can get the acceleration of the phone by the following equation: From the above derivation, we know how to obtain phone's acceleration when it is in a state of relative rest or relative sliding. And we also know phone's transition conditions from a rest state to sliding state. It is also crucial to know the reverse transition conditions. To achieve the transition, the ground should not vibrate too violently, and the phone's velocity relative to the ground should be slow enough so that the friction between these two objects can reduce the relative velocity to 0. Therefore, we have this reverse transition conditions: > a a h (t) and Δa(t) · Δt > Δv , and it is updated in line 10 of Algorithm 1. The phone is on the state of rest relative to the ground at the beginning. When the condition in line 5 of Algorithm 1 is satisfied, the phone begins on the state of relative sliding. When the condition in line 12 is satisfied, phone's state goes back to relative rest. It is only when the phone is in a relative sliding state that the already initialized A T MAP p h is changed. So far, according to the above equation, we can obtain the phone-quality records according to the accelerograph records. In addition, according to Equation (12), we can get an interesting phenomenon: that is, phone records may change suddenly. When the phone is in a relative sliding state, a p h (t)'s absolute value remains big, and its direction remains the same as that of Δv(t). The direction of Δv(t) may change suddenly to its opposite direction when Δv(t) is small, which will cause a p h (t)'s direction also change suddenly to its opposite direction, while its absolute value remains big. We will confirm this phenomenon in the later experiment.

Dataset
In this study, it is needed to collect accelerograph's real accelerograph records and smartphone's phone records simultaneously when an earthquake occurs. But because of the unpredictable nature of earthquakes, it is difficult to collect such data in large quantities. So we use the shake table (A large instrument. According to its input, it can make a 3.5 m * 3.5 m table vibrate like an earthquake happens) to simulate an earthquake.
To simulate earthquakes, the shake table needs original seismic data as its input. Therefore, we collect seismic data from Japan's KiK-Net and K-Net (NIED 2019) and that of China from 2008s to 2018s (including the WenChuan Earthquake in 2008). From these original seismic data, 46 data from unique event (and 3 manually generated data) are selected as the input data for the shake table simulations. To represent as many earthquakes as possible, the magnitude and epicenter distance distribution of these 46 selected seismic data are as dispersed as possible. Figure 3 shows their distribution.
We fix two accelerographs on the shake table. Since these accelerographs are fixed, and its precision is high, we take the vibration data recorded by these accelerographs to represent the real vibration of the shake table. In addition, we develop a software for smartphones (including Android and iPhone) that allows the phone to collect its own triaxial acceleration data at 100 HZ. We then place these 48 smartphones (have installed the software) on the shake table to obtain its own vibration data. There are many brands of smartphones on the market. Therefore, we carefully selected a variety of different but commonly used phone brands in this experiment. The smartphone number for each phone brand used in shake table experiment is shown in Table 1. Some factors such as the material of mobile phone cases and the material of sites would affect the sliding of the mobile phone. If considering all factors, the model would be complex and fragile. In this study, we ignored these factors to obtain a unified and effective model. Table 2 lists the experimental setting. As shown in the right part of this table, we conduct this experiment in two scenarios, including fixed and free scenario. Free scenario means that our selected 48 phones sit freely on the shake table when the shake table is running, while fixed scenario means that these selected phones are fixed to it. The shake table completely simulates earthquake according to its 49 input data twice in free scenario and once in fixed scenario.

Experiment
In this section, we introduce the experiments we have done to investigate the transformation method. Since our TMAP method considers two phone factors that cause the difference between phone and accelerograph records, TMAP method consists of two models to simulate these two phone factors, respectively. In this section, we use the data collected in the two experimental scenarios to test the effectiveness of these two models. Firstly, performance metrics used to evaluate the transformation method are introduced. Then, we apply transformation method to the dataset collected in fixed scenario and evaluate the effectiveness of the method from multiple perspectives. Finally, the same evaluations are applied to the dataset collected in free scenario.

Performance metrics
Here, we introduce performance metrics used in the following subsection, including parameter goodness, Pearson correlation coefficient ρ and RMS ratio. These parameters are defined below: , where X = (X 1 , X 2 , · · · , X N ) and Y = (Y 1 , Y 2 , · · · , Y N ) represent two time domain data, and X n and Y n represent member in X and Y . As shown in Eq. (16), the maximum value of goodness is 1. The closer the goodness approaches to 1, the higher the similarity between X and Y . Following the works of ), Pearson correlation coefficient ρ and RMS ratio of two records filtered by the 1-HZ frequency band are used to measure the phase and amplitude match between these two filtered records in this frequency band. The maximum value of ρ and RMS ratio are all 1, as defined in Eqs. (17) and (18). The closer the ρ and RMS ratio approach to 1, the better the phase and amplitude match between X and Y .

Evaluating transformation method in fixed scenario
The F I R(·) model of our TMAP method, defined in Eq. (3), is used to explain the difference between accelerograph and phone records due to the low accuracy of phone's sensor. To determine whether it is effective, we test its performance in the data collected under fixed scenarios. The data collected by the accelerograph and smartphone are called accelerograph records and phone records respectively, as described in Section 2.1. And each phone record has a corresponding accelerograph record, which means they are collected simultaneously in a same earthquake simulation. We simulate 46 different earthquakes in fixed scenario. Therefore, for each smartphone, there are 46 pairs of phone record and its corresponding accelerograph record at most. 4-fold cross-validation is used for F I R(·)'s training and testing. We divide these 46 pairs of data into 4 parts, use the data of these 3 parts to train this F I R(·) model, and use the remaining data to test the model. With 4 times of training and testing, we are able to test all of these 46 pairs of data. We also compare F I R(·) model with the transformation method proposed by ), which we call Transformation Method of Kong (TMK). The key idea of TMK is to converts the 24-bit of accelerograph record to 16-bit record, and adds some smartphone noise. The trained F I R(·) and TMK are used to process the accelerograph records in the test data, respectively. And these two kinds of processed data are called FIR records and TMK records. By evaluating the similarity between processed data and phone records, we evaluate the performance of the transformation method. Next, we use two ways to evaluate and compare our F I R(·) method with TMK method.
Visualizing the transformed results directly As shown in Fig. 4, we visualize FIR record, TMK record, and phone record on X-axis directly. It can be seen that the vibration amplitude of TMK record is larger than that of phone record. This is because TMK record retains the accelerograph's keen sense of vibration, while the phone doesn't have such keen senses like accelerograph. Figure 4b shows that FIR record and phone record are highly consistent, which indicates that our method can transform data well. Figure 4 only shows that our method works well in that single earthquake simulation. We need to know whether our method still works well in other earthquake simulations. Here we use the parameter goodness (Ljung and Glad 1994;Pintelon and Schoukens 2001) to measures the similarity between transformed data and its corresponding phone record. Since the data we are dealing with are all triaxial data, we use mean goodness to calculate the similarity between transformed data and phone records. As shown in Fig. 5, the X-axis means the goodness between TMK records and phone records, and the Y-axis means the goodness between FIR records and phone records. The points in Fig. 5 are all above the diagonal line, which means the similarity between FIR and phone records are all higher than that between TMK and phone records.

Evaluating transformation method in free scenario
To determine whether our whole TMAP is effective, we evaluate it from multiple perspectives in the data collected under free scenarios. The data collected by accelerograph and smartphone in this scenario are also called accelerograph records and phone records. We then use TMAP and TMK methods to process accelerograph records, and call these two kinds of processed data as TMAP records and TMK records, respectively.
Visualizing the transformed results directly As shown in Fig. 6a and 6b, we compare TMAP records and TMK records with the phone records in the same earthquake simulation. It can be seen that on the Z-axis they are almost identical. On the X-axis and Y-axis of the horizontal direction, TMAP records and phone records are also highly consistent, while there is a big difference between TMK records and phone records, especially when the earthquake is relatively severe.
To quantitatively measure the difference, a sweep signal (gradually increasing amplitude from 0m/s 2 to 10m/s 2 and frequency from 0.5 to 5 HZ is simulated on the shake table. Figure 6c and 6d show the difference between TMAP records, TMK records, and phone records in this simulation. It can be seen that when the vibration acceleration of the shake table exceeds 2 ∼ 3m/s 2 , the smartphone starts to slip. This phenomenon causes a mismatch between TMK records and phone records in amplitude. In addition, the phase of phone records obviously mismatches that of TMK records. However, both phase and amplitude between TMAP records and phone records match well, as shown in Fig. 6d. These facts indicate that our There is another point worth noting: the acceleration value of phone records in Fig. 6d changes suddenly. In this experiment, the sampling interval of our smartphone is 0.01 s. For this shake table simulation, the acceleration value of the smartphone can jump from a positive value to a negative value within only 0.01 s. We have explained the reason for this phenomenon at the end of Section 2.2. In Fig. 6d, TMAP records perfectly simulates this phenomenon, which also verifies the effectiveness of our TMAP method. This phenomenon can be seen as a distinctive characteristic of phone-recorded seismic data, and maybe can be used to identify earthquake events in subsequent studies. Drawing frequency domain analysis diagram This diagram uses a frequency band of 1 HZ to filter two records, respectively, and calculates Pearson correlation coefficient ρ and RMS ratio , defined in Eqs. (17)-(18), of these two filtered records. We then move this 1-HZ frequency band with 0.1-HZ step. For each movement, we get a new set of ρ and RMS ratio. The x-axis of this analysis diagram is the center frequency of the 1-HZ frequency band.
As shown in Fig. 7, we have drawn frequency analysis diagrams for TMK record, phone record and TMAP record of Fig. 6c and 6d. It can be seen that when the center frequency is between 2 and 5 HZ, the ρ and RMS ratio between TMK record and phone record decrease obviously, while that between TMAP record and phone record are still close to 1. This result indicates that the phase and amplitude between this TMAP record and phone record are all better matched.

Evaluation for all shake table simulation
It is needed to test the performance of TMAP method in as many earthquake situations as possible to verify its generalization ability. We collect all records of a randomly selected phone and an accelerograph from the shake table experiment. These accelerograph records are converted into TMAP records and TMK records. We then use the parameter goodness, as defined in Eq. (16), to measures the consistency between each phone record and its corresponding transformed record, which include TMAP records and TMK records.
As shown in Fig. 8, the blue dot represents the goodness between TMK records and phone records, while the red dot represents that between TMAP records and phone records. The x-axis represents the PGA value of the corresponding accelerograph records, while the y-axis represents the mean goodness in two horizontal directions. Here PGA means the maximum absolute amplitude from the three-component acceleration.
It can be seen that the goodness of blue dots decreases rapidly with the increase of the PGA of accelerograph records, which is caused by phone's sliding. Our TMAP method can keep the goodness of the red dots always close to 1, even if the vibration simulated by the shake table is very severe. This fact proves that our TMAP method can perfectly generate  Fig. 6c and 6d, where ρ means pearson correlation coefficient, Ratio means RMS ratio. Red line represents the diagram between TMK record and phone record, while blue line represents the diagram between TMAP record and phone record Fig. 8 goodness between TMK records, TMAP records and phone records good phone-quality records under the earthquake of different severity.

Case study: using transformed data to train models for intensity prediction
The previous experiments have shown that our TMAP method is effective in generating phone-quality data. In this section, we further demonstrate that our TMAP method is useful in SEEW system, such as its generated phone-quality data can be used to train models that predicts maximum earthquake intensity during the event from the initial 10 s waveform. Traditional EEW systems calculate earthquake intensity based on accelerograph records, while the SEEW system deals with phone records. Because of the differences between the two types of records, we cannot apply the traditional method of calculating the earthquake intensity directly to the phone records. Therefore, it is needed to train a new intensity model based on phone records.
Considering the scarcity of phone records, we use generated phone-quality data to train the intensity model. As described in the "Dataset" section, we have collected many original seismic data from Japan and China, and 46 of these data are used in the shake table experiment. Now we use TMAP and TMK ) methods to process the remaining seismic data, and generate phone-quality data, including TMAP records and TMK records. These phone-quality data are then used for intensity model's training. We test the intensity model on exactly phone-recorded data (also called phone record) to make the test result more reliable.
Each phone-recorded data or phone-quality data have a corresponding accelerograph record. Here we use the instrument seismic intensity of China (Jin and Ma 2015), which is account to one decimal place, to calculate the intensity of accelerograph record. And this intensity is the ground truth intensity of this phone-recorded and phone-quality data. We then try to extract many features from these data. Eventually, we find that T d and P GA  that are two commonly used seismic parameters in seismology are the best features for this prediction task. Finally, four machine learning regression models (Hastie et al. 2010;Murphy 2012) (Support Vactor Regression (SVR), Bayesian Ridge Regression, Linear Regression, and Random Forest Regression) are used for predicting earthquake intensity. Due to the real-time requirement of SEEW, for each record, we only use a 10-s window of data immediately following the trigger of STA/LTA algorithm (Allen 1978) to calculate these features. Figure 9 shows the probability distribution of prediction errors between real intensity and the intensity estimated by Bayesian Ridge regression model. In both subgraphs of Fig. 9, the model uses the phone records as the test set. But Fig. 9a uses TMK records as the training set, while Fig. 9b uses TMAP records as the training set.
It can be seen obviously that the prediction errors in Fig. 9a are generally larger than 0, which means Fig. 9 The probability distribution of prediction errors. Prediction errors mean the difference between real intensity and the intensity estimated by Bayesian Ridge regression model. In each subgraph of this figure, the vertical red line represents the mean of prediction errors, and the red curve is the fitting curve of the probability distribution. There are two different data used for regression model's training. (a) uses TMK records as training data, while (b) uses TMAP records as training data estimated intensity are generally lower than the real intensity. In Fig. 9b, the prediction errors are evenly distributed around 0, which means the estimated intensities are evenly distributed around the real intensity.
In order to verify whether the phenomenon in Fig. 9 is universal, which means that the phenomenon does not just occur in Bayesian Ridge regression model, we conduct similar experiments on the three other regression models. Here, we use Root Mean Square Error (RMSE) and Absolute Mean Error (AME) as performance metrics of these four models. These two measures are defined in Eqs. (19)-(20), where N denotes the sample number of test set, X n and Y n respectively represent the real and predicted value of n − th sample of test set.

RMSE
The predicting results are shown in Table 3. When TMAP records are used as the training set, the AME of these four regression models are always closer to These models are trained by TMAP records and TMK records, respectively. Performance metrics include Root Mean Square Error (RMSE) and Absolute Mean Error (AME). The bold emphasis in Table 3 is to emphasize that these methods perform better on TMAP records than on TMK records. 0, and AME of Random Forest regression reaches 0.06. When TMK records is used as the training set, the AME of these four regression models are around 0.4, which means that the predicted value is 0.4 less than the real value on average. Therefore, the phenomenon in Fig. 9 is not unique. The main reason for this phenomenon is that our TMAP method can generate phone-quality data very accurately than TMK. So the model trained by TMAP record can predict from phone record better. In addition, whichever regression model is selected, the RMSE of the model trained by TMAP records is also lower than that of the model trained by TMK records. Therefore, TMAP can generate better phone-quality data for SEEW-related model's training.

Conclusion
Because of the factor that the phone is not fixed to the table, and the low accuracy of the phone's sensors, there is a difference between phone records and the real ground motion data. Kong et al. proposed a transformation method, which we call TMK, to generate phone-quality records from accelerograph records. However, there is still a big difference between the TMK records and the phone records. In the time domain, the more severe the earthquake, the higher the difference. In the frequency domain, these two records are inconsistent not only in amplitude but also in phase. Therefore, we propose a new TMAP method to solve these problems. This method contains our understanding of the difference between real ground motion records and phone records. The experimental results show that the differences between the TMAP records and phone records in the time domain and frequency domain are significantly reduced, which illustrates the effectiveness of our method.
Finally, we use the transformed records to train a SEEW-related model. The results show that our TMAP method enables us to train a high-performance model without the training data collected in the real earthquake scene by smartphones, which fully demonstrate the application value of our method in SEEW.