A method and system for predicting the occurrence time of emergencies based on LSTM-SA
Through the LSTM-SA-based emergency event occurrence time prediction method, considering the spatiotemporal propagation characteristics and long sequence dependency characteristics of emergencies, the problem of inaccurate emergency prediction time in the prior art is solved, and high-accurate emergency prediction is achieved.
Patent Information
- Application Number
- CN202310978218.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2023-04-18
- Filing Date
- 2023-08-04
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2043-08-04
AI Technical Summary
The prior art is difficult to accurately predict the occurrence time of emergencies, especially when considering long-sequence-dependent features, there is a lack of effective methods.
The LSTM-SA-based burst event time prediction method is used to characterize the spatiotemporal propagation characteristics of burst events through long-sequence-dependent variable-length sequence generation and sequence completion methods, and the LSTM-SA model is used to learn these features to predict the occurrence time of burst events.
It improves the accuracy of predicting the time of emergencies, can accurately predict the specific time of multiple emergencies in the future, and improves the prediction time accuracy to the "daily" level.
Smart Images

Figure CN118607679B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing and analysis, and in particular to a method and system for predicting the occurrence time of an emergency event based on LSTM-SA. Background Art
[0002] Ordinary citizens' attention to future unexpected emergencies is mainly focused on the "next emergency". Time is one of the most critical risk characteristics of disaster emergencies that have not yet occurred. Knowing the time of the next emergency will be extremely helpful in checking hidden dangers in advance and analyzing why the abnormality will occur at that time. Therefore, the prediction of time has always received great attention in the field of public safety. In the prediction of disaster emergencies, it is also crucial to predict the time of the emergency.
[0003] The spatiotemporal propagation characteristics of emergencies have an important impact on the prediction of the time of occurrence of emergencies. Under the influence of spatiotemporal propagation, previous emergencies stimulate subsequent ones, making the occurrence of emergencies not independent. Although some studies on emergencies have predicted the risk level of emergencies, they mainly predict the risk characteristics of provinces, months, and target types where emergencies have not yet been discovered. There are relatively few studies on time prediction accurate to "days". In addition, existing studies lack the consideration of the long-sequence dependency characteristics of emergencies, and mainly use single emergency information for prediction. Therefore, there is an urgent need for a method for predicting the time of occurrence of emergencies that considers the long-sequence dependency characteristics. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for predicting the occurrence time of an emergency event based on LSTM-SA, so as to solve the technical problem of how to improve the accuracy of predicting the occurrence time of an emergency event.
[0005] The present invention is implemented by adopting the following technical scheme: a method for predicting the occurrence time of an emergency event based on LSTM-SA, comprising the following steps:
[0006] The method of variable-length sequence generation and sequence completion based on long sequence dependence is used to characterize the spatiotemporal propagation characteristics of emergencies.
[0007] Select the indicators for forecast input and obtain the forecast data of the time of occurrence of emergencies;
[0008] The LSTM-SA emergency event occurrence time prediction model is used to learn the spatiotemporal propagation characteristics of long sequence dependencies and predict the occurrence time of emergencies.
[0009] Furthermore, the method of variable-length sequence generation and sequence completion using long sequence dependency includes the following steps:
[0010] The input-output mapping relationship of the emergency event occurrence time under single-step prediction is expressed in a supervised learning manner. The expression is: Output Set Among them, n represents the total number of emergencies, m represents the input indicator dimension, and outdim represents the predicted output dimension;
[0011] For each input vector x i All emergency event data within the preset time are accumulated as the base point, and the original two-dimensional input data is converted into a variable-length sequence. The expression is: v i Represents each input vector x i The number of emergencies in the previous preset time;
[0012] To complete the variable length sequence, Convert to Get the input set and the output collection in, Indicates the maximum length of a variable-length sequence.
[0013] Furthermore, the selection of indicators for prediction input includes: selecting multiple indicators to represent the long-term root causes and short-term triggering factors that affect the emergency, the long-term root causes include loss of life, GDP growth rate, population growth rate and unemployment rate; the short-term triggering factors include the year, month and day information of the incident.
[0014] Furthermore, the acquisition of emergency event occurrence time prediction data includes: obtaining emergency event historical data from a database, eliminating outliers and arranging events in chronological order, splitting the screened data into long-term root factors and short-term triggering factors, and using the HaRLTC method to fill in missing values to obtain emergency event occurrence time prediction data.
[0015] Furthermore, the acquisition of emergency event occurrence time prediction data also includes: a normalization processing step, linearly scaling the data including the input and output, and the normalization formula is: Among them, max is the corresponding index in the input The maximum value of the data in, min is the minimum value of the current input of this indicator, The input vector x i The result after normalization.
[0016] Furthermore, the LSTM-SA emergency event occurrence time prediction model includes a first LSTM layer, a SA layer, and a second LSTM layer, and the first LSTM layer, the SA layer, and the second LSTM layer are connected in sequence.
[0017] Furthermore, the first LSTM layer is used as an input layer and connected to the SA layer. When the output result of the first LSTM layer is input into the SA layer, the output of the first LSTM layer is added to the output of the SA layer by using a residual connection, and then output to the second LSTM layer. After the second LSTM layer, a fully connected layer is used as the output layer, and a Dropout mechanism is added to the output layer.
[0018] A system for predicting the occurrence time of emergencies based on LSTM-SA comprises a feature acquisition module and a prediction module. The feature acquisition module is used to characterize the spatiotemporal propagation characteristics of emergencies by adopting a variable-length sequence generation and sequence completion method with long sequence dependency; the prediction module is used to adopt an LSTM-SA emergency occurrence time prediction model to learn the spatiotemporal propagation characteristics of long sequence dependency and predict the risk of emergencies.
[0019] A computer program product comprises a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0020] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0021] The beneficial effect of the present invention is that the present invention can more accurately predict the specific time of occurrence of multiple emergencies in the future, which helps relevant personnel to further understand and judge emergency strategies. At the same time, the present invention combines the spatiotemporal propagation characteristics of emergencies with key risk influencing factors, and improves the prediction time accuracy to the "day" level. The present invention proves the applicability of neural networks based on LSTM modules to the problem of emergency risk prediction, and provides key methodological support for subsequent research on spatiotemporal risk prediction of emergencies. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0023] Figure 1 It is a flow chart of a long sequence dependency expression method based on variable length sequence generation and completion;
[0024] Figure 2 This is the principle diagram of the LSTM-SA emergency event occurrence time prediction model;
[0025] Figure 3 This is the LSTM principle diagram;
[0026] Figure 4 It is the SA schematic diagram;
[0027] Figure 5 Experimental flow chart for predicting the occurrence time of sudden events with long sequence dependencies;
[0028] Figure 6 This is a comparison chart of LSTM-SA and LSTM-LQSA predictions for the next emergency year;
[0029] Figure 7 This is a comparison chart of LSTM-SA and LSTM-LQSA predictions for the next emergency month;
[0030] Figure 8 This is a comparison chart of LSTM-SA and LSTM-LQSA predictions on the day when the next emergency will occur. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0032] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0033] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0034] Example 1
[0035] A method for predicting the occurrence time of an emergency event based on LSTM-SA includes the following steps:
[0036] The method of variable-length sequence generation and sequence completion based on long sequence dependence is used to characterize the spatiotemporal propagation characteristics of emergencies.
[0037] Select the indicators for forecast input and obtain the forecast data of the time of occurrence of emergencies;
[0038] The LSTM-SA emergency event occurrence time prediction model is used to learn the spatiotemporal propagation characteristics of long sequence dependencies and predict the occurrence time of emergencies.
[0039] See also Figure 1, the method of variable length sequence generation and sequence completion based on long sequence dependency is as follows: For ease of understanding, Figure 1 The upper left part of the figure first shows an example of the original data in two-dimensional form. Specifically, the left half of the dashed box is the input data of each previous emergency event, and each record contains a specific emergency event E. n The multi-dimensional indicator data of n is the total number of emergencies, and also represents the sequence length of the entire emergency record. The value under the "Predicted Emergency" column represents the future emergency E that needs to be predicted. n+1 To E n+1+d This means that we need to predict multiple future dates at the same time. + It means predicting at least one unexpected event that has not yet occurred in the future. Based on the above raw data, the input set and output set The mapping relationship is as follows Figure 1 As shown in the upper right part of i All need to predict the output vector y of length outdim i , i = 1, 2...n. Among them, m represents the input indicator dimension, outdim represents the prediction output dimension, and for each emergency event that has not yet occurred, its specific time features of year, month and day need to be predicted. Therefore, outdim = 3×d, and the prediction of the time of emergency occurrence forms a typical multi-output prediction task.
[0040] Secondly, after expressing the input-output mapping relationship of the emergency event occurrence time under single-step prediction in a supervised learning manner, the present invention converts each input vector Transformed into a form that considers long sequence dependencies of spatiotemporal propagation, with x i The data of all emergencies in the past month are accumulated as the base point. Figure 1 The link in the middle right circle number 1 is shown. i , calculate x i-1 、x i-2 The time difference between the previous emergency event and the previous emergency event is calculated, and the input vectors within one month are superimposed on x i Then each input becomes Among them, x i-1 、x i-2 The history vectors are shown in gray, x i In black, v i For each x i The number of sudden events in the previous month, and also represents the length of each newly generated input sequence. If no other sudden events occurred in the past month, then v i is 1, indicating that the current input vector only has the original xi , which is the information of the current emergency. After this step, the input set becomes n vectors of unequal lengths, and the original two-dimensional table input is converted into a variable-length sequence. The supervised learning mapping relationship under variable-length sequence input is as follows: Figure 1 shown in the middle left part of the diagram.
[0041] In order to ensure the structural integrity of the data, the variable-length sequence needs to be padded. Convert to in is the maximum length of a variable length sequence. Specifically, for the number of emergencies that occurred in the past month, that is, the sequence length is less than The input vector x i Use a one-dimensional blank vector of length m to stack and fill until x i The sequence length reaches The above process is as follows Figure 1 The bottom layer in represents the blank vector in white. After the above processing steps, the final input set Output Set The long-sequence dependency characteristics are fully considered to express the spatiotemporal propagation of emergencies.
[0042] After the problem of predicting the occurrence time of emergencies taking into account long sequence dependencies is formed by generating and completing variable-length sequences, the present invention then selects indicators for prediction input.
[0043] The present invention selects 9 indicators in Table 1 for prediction:
[0044] Table 1 Indicators used to predict the time of occurrence of emergencies
[0045]
[0046] The nine selected indicators represent the long-term root causes and short-term triggers that affect the risk of emergencies. Indicators 1 to 3 represent the specific dates of the occurrence of emergencies, including year, month and day, which are used to characterize the most critical time characteristics of emergencies. Inputting these indicators into the prediction model is conducive to learning important information such as the preparation time between emergencies and the time period of emergency aggregation. Therefore, the three indicators of year, month and day represent both the emergency information input for prediction and the emergency information that has occurred, and the specific year, month and day of the emergency scenario characteristics of the emergency that needs to be predicted and has not yet occurred.
[0047] Furthermore, the present invention uses prediction input indicators including both the emergency triggering factors and the long-term root causes, which requires multi-step data acquisition work. The specific process is as follows:
[0048] First, it is necessary to obtain the original data from the database. At the same time, due to the limitation of the long-term root cause factor data, it is necessary to eliminate some emergency records that cannot obtain the required long-term root cause factor data. Secondly, since some data records in the database have dates that are not strictly sorted in order, it is necessary to re-sort the emergencies from small to large in time. Thirdly, many variables in the database that exceed the needs of the present invention are deleted. After the above steps, the most streamlined emergency index emergency data is obtained. Thereafter, for each emergency record, it is necessary to extract the corresponding key factors and corresponding quantitative indicator data from the database according to the region and year in which it is located until the database is traversed. The present invention separately fills the indicator data of short-term trigger factors and long-term root causes. Finally, the two parts of the filled data are spliced and merged, and then some variables are recoded to obtain the data used in this embodiment.
[0049] Since each record in the input data obtained considering the long sequence dependency feature is a two-dimensional vector, and the entire input set is in a three-dimensional format, in order to avoid the impact of the dimensional difference between different features, the present invention processes each input separately. In order to maximize the retention of data characteristics, the data including input and output are linearly scaled, and the specific formula is as follows:
[0050]
[0051] Among them, max is the corresponding index in the input The maximum value of the data in, min is the minimum value of the indicator in the current input, For input x i The result after normalization. After this process, the values of all indicators in each input vector are distributed in the interval [0, 1], which plays a normalization role.
[0052] Due to the spatiotemporal propagation characteristics of emergencies, the occurrence of new emergencies is not independent and is affected by the sequence of emergencies that have occurred previously. Therefore, it is necessary to combine the spatiotemporal propagation characteristics of emergencies to construct an emergency occurrence time prediction model that considers long sequence dependencies. The LSTM-SA emergency occurrence time prediction model constructed by the present invention and its expansion form are as follows: Figure 2 shown.
[0053] Among them, x i Represents each input emergency event sequence data, is the sequence length and also represents the step size of LSTM. m represents the number of input indicators, and in this study m = 11. t Represents the hidden state output result of each step LSTM, t = 1, 2, .. H represents the length The matrix after all hidden state outputs are combined. i Represents input x i The corresponding output result. The model structure is an LSTM layer as the input layer, followed by a SA layer. While the output of the LSTM layer is input into the SA layer, the output of the LSTM layer is added to the output of the SA layer using a residual connection. This is because residual connections can be easier to optimize and train when the neural network model is deepened, and improve accuracy. Afterwards, the added output is sent to a layer of LSTM to further characterize the sequence dependency features, and finally a fully connected layer is used as the output layer. At the same time, a Dropout mechanism is added to the output layer to avoid overfitting. The idea of this multi-layer stacking is mainly to consider that if only LSTM is used as the only prediction layer, and the last step length is As output, it is possible to lose some of the states of the intermediate step outputs, for example and Therefore, the LSTM-SA model established by the present invention can retain the implicit state output of all steps of the top LSTM layer, and use the SA layer to extract as much effective information as possible to achieve better modeling and prediction capabilities. Next, the specific neural network structure and learning mechanism of each layer are introduced.
[0054] See also Figure 3 Compared with ordinary RNN, LSTM has more complex input gate, forget gate and output gate structures, which is why it can better capture sequence dependencies and form long-term memory. t represents the input of the current step length of the LSTM neural network, where t represents the corresponding sequence index position, and for the first layer LSTM network in the LSTM-SA model constructed by the present invention, Represents each sequence of input x i The tth emergency event record in . represents the hidden state and output of the LSTM neural network at the tth step, and c is the number of neurons (cells) and output dimension in the LSTM neural network. t represents the cell state of the t-th step of LSTM, and σ and tanh are two activation functions.
[0055] The calculation of LSTM is divided into multiple steps: First, the forget gate decides with a certain probability whether to forget the hidden cell state H of the previous step. t-1 , then, enter the goalkeeper H t-1 With X tIntegrate and calculate through activation function and multiplication unit, and update the cell state C together with the calculation output of forget gate t , and finally calculate the new hidden state H through the output gate t , and H t It also serves as output at the same time. The structure of LSTM can ensure that the neural network composed of it can make full use of the information of different step lengths in a long sequence. Taking emergencies as an example, although each step length t only inputs the information of an emergency once, in the long-term memory of the neural network, the information of previous emergencies has been fully retained in the cell state and hidden state, that is, the prediction of a new emergency not only utilizes the input information of the previous emergency, but also takes into account the effects of multiple emergencies over a long period of time, and depicts the characteristics of long-sequence dependence of emergency sequences. Based on the visualization work in related research, the present invention draws the LSTM principle as follows: Figure 3 , the specific calculation process is as follows, where W f , W i , W C With W o etc. are trainable weights, b f 、b i 、b C With b o etc. are trainable biases.
[0056]
[0057] See also Figure 4, although LSTM has been widely proven to be extremely suitable for the prediction of sequence dependency, it may still have poor performance and decreased performance when the sequence is very long. In the present invention, it is reflected in the fact that some key features may be forgotten when the subsequent emergency is too far away from the record of the previous emergency. The calculation of the attention mechanism makes the vector of each step in the input sequence pay attention to other step calculations, thereby expressing the distance-insensitive characteristics. Even if the vectors of two step lengths are extremely far apart in the sequence, the correlation can still be captured. The self-attention (SA) mechanism, which can also be called the scaled dot-product attention layer in detail, is now widely used as a representative attention mechanism. The SA structure has greatly overcome the above-mentioned problems of difficult parallelization, limited processing ability for overly long sequences, and insufficient processing of long sequence dependencies by convolutional neural networks represented by LSTM, but the disadvantage is that the single SA lacks positional encoding information, and the sequential dependency constraints in the sequence are difficult to characterize. In Transformer, positional encoding is introduced to solve this problem, but due to the relatively complex structure of the entire Transformer, it is not applicable to the relatively small data set of the present invention. Therefore, the present invention adopts the method of adding a layer of SA after LSTM, which can maximize the use of LSTM hidden layer information on the one hand, and better combine LSTM's own characterization of sequence dependence and SA's parallel training advantages on the other hand. The SA calculation process is as follows:
[0058]
[0059] Where X is the input sequence of the SA layer. For the LSTM-SA model proposed in this study, Represents the LSTM layer before SA for each input sequence x i Output. Still represents the sequence step, c still represents the number of LSTM cells and the output H of each step t At the same time, Q = XW Q , K = XW K , V = XW V , where W Q , W K , Represents the self-attention weight matrix that is randomly initialized and needs to be trained in the subsequent learning process. QK T The similarity between vectors is calculated mainly by matrix multiplication, i.e. inner product. The more similar the vectors are, the larger the result value is. The distribution and variance of the similarity calculation results between the above vectors are scaled, i.e., the Scale step, to keep the gradient stable. The similarity results obtained by the inner product operation of each vector with other vectors are normalized using the softmax function. Figure 4 The Mask link represents an option to mask the completed part of the sequence. In this model, considering that the blank vector filled in the variable-length sequence generation process does not express much information about historical emergencies before the latest emergencies, it may still have an effect, so it is not processed. The similarity between the normalized vectors represented by , i.e., the attention weight, is matrix multiplied with V to obtain the result of the weighted sum of each vector after the attention mechanism. Finally, the output of the SA module is
[0060] Experimental analysis
[0061] The present invention uses a certain emergency data from 1984 to 2016 in a certain area in the database for experimental analysis. Through the expression of the long sequence dependency characteristics of the spatiotemporal propagation of the emergency by the previous variable-length sequence generation, the prediction of the time of the emergency is prominently manifested as a multi-output regression prediction problem under long sequence dependency. The prediction target is the specific date of the future d emergency events that have not yet occurred for the model, including three items: year, month and day, corresponding to the indicators iyear, imonth and iday in Table 1. In the experimental process, the idea of supervised learning is first adopted to divide the data into a training set, a validation set and a test set, with a ratio of 75%: 10%: 15%. The training set is the data known to the model, and the algorithm of error back propagation is used to train and optimize each model. The validation set is the data unknown to the model during the training process, which is used to monitor whether unexpected situations such as overfitting occur. The test set is the data unknown to the model. After the model training is completed, the test set is predicted, and the real date of the sample in the test set is compared with the predicted result, and the reliability of the model is tested under different evaluation methods.
[0062] In order to test the generalization ability of the model, this application divides the data into two sub-datasets DSI and DS2 in Table 2, and each data set will be trained and predicted separately. DS1 includes 11,080 emergency event data from 1984 to October 13, 2013, and DS2 includes 11,080 emergency event data from October 13, 2013 to December 31, 2016. The two data sets represent different periods. Therefore, although the two sub-databases have different time lengths, the total number of emergencies is the same, indicating that the risks of emergencies are different, and the effectiveness of the model can be fully measured. The descriptive statistical results of the two sub-databases are shown in Table 2, where Indicates the highest frequency of sudden events in the past month in the generated variable-length sequence, and also indicates that each input xi The length of the sequence.
[0063] Table 2 Emergency event time prediction dataset
[0064]
[0065] The present invention considers three different prediction step sizes for experiments, namely d=10, d=20, and d=30, which respectively represent the predicted occurrence time of 10 emergencies in the future, the corresponding output dimension outdim=30, and the predicted occurrence time of 20 emergencies and 30 emergencies in the future. This multi-step prediction method adopts the idea of sequence to sequence. Combined with the setting of different step sizes, the model performance and sensitivity can be better evaluated, and the practical significance of the prediction is also more sufficient. In order to horizontally test the performance of the LSTM-SA model proposed in this application, this application adopts a random forest model (RF), an LSTM model containing two hidden layers, and a model structure that is exactly the same as LSTM-SA, but replaces SA with an LSTM-LQSA model with a last query self attention mechanism (LQSA). The difference between the LQSA mechanism and SA is that during the calculation process, the query only retains the value of the last step of the sequence, and the calculation method of the key and value remains unchanged. Jeon uses the LSTM and Transformer model to combine and perform better in the problem of predicting the answer of a long text sequence. Therefore, it is compared with SA in the problem of predicting the time of occurrence of emergencies in this application. The specific experimental process is as follows: Figure 5 shown.
[0066] The parameters of each model are set as follows. RF is the default parameter. The first layer input of the LSTM model is an LSTM layer with 128 neurons, the second layer is an LSTM layer with 32 neurons, and the final output is a fully connected layer. The LSTM-SA model is similar to it, with the first layer LSTM having 128 neurons and the second layer LSTM having 32 neurons. The LSTM-LQSA model has the same structure as the LSTM-SA model except that the SA layer is transformed. The batch size of each neural network is 64, the number of training iterations is 50, and a Dropout layer with a ratio of 0.1 is added before the output layer to prevent overfitting. The learning optimizer is RMSprop, the learning rate is set to 0.01, the decay rate is 0.01, and the Rho value is 0.9. The model is also implemented using the Scikit-learn library and the keras library. The experiment uses the mean absolute error (MAE) as the loss function to train the neural network model. In addition to MAE, the model evaluation stage also uses mean squared error (MSE) and median absolute error (MedAE) as indicators to measure the prediction accuracy of the model. The smaller the error value, the higher the prediction accuracy of the model. Among them, MSE is usually used to evaluate the degree of change of the data. MAE is more intuitive and can simply evaluate the overall error, but it is not sensitive enough to outliers, while MedAE is extremely sensitive to outliers. The comparison of the three error indicators can more comprehensively reflect the prediction performance of the model. The specific error calculation method is as follows. Where n is the total number of samples, y is the number of samples, and m is the number of samples. i is the actual value, is the predicted value.
[0067]
[0068]
[0069]
[0070] Comparison of experimental results
[0071] According to the combination of two sub-datasets and three different prediction step sizes, the present invention conducts a total of six groups of control experiments, each of which includes the training of four models and the calculation of prediction errors. Since the output data is also normalized, in order to ensure the intuitiveness of the prediction error comparison, the experimental results reversely transform the prediction results and the true values to the original dimensions for error evaluation. At the same time, since the prediction output is the year, month, and day information of multiple emergencies, the error is displayed as the mean of all output dimension errors. The complete prediction result error comparison is shown in Table 3. Table 3 boldly marks the minimum error term in each group of comparison results. It can be seen from the table that when d=10 is used to predict the occurrence time of ten future emergencies on the DS1 data set, the three error test values of the LSTM-SA model are 1.17, 5.537 and 1, respectively, which are the best in the horizontal comparison with other algorithms. At the same time, the performance of the LSTM-LQSA and LSTM-SA models in the MedAE error is consistent, both of which are 1. In multiple rounds of error comparison, except for one time when the performance was the same as that of the LSTM-LQSA model, the LSTM-SA model performed the best, which shows that its performance is reliable. It also shows that when the data complexity increases greatly, the classic machine learning model such as RF has better predictive ability and good problem applicability.
[0072] Table 3 Comparison of prediction errors of emergency events in different models under different prediction steps
[0073]
[0074] In order to further analyze the differences in the prediction effects of each model, and limited by the large number of comparative experimental combinations, this application will representatively visualize the performance of different models on the sub-dataset DS1 when d=10. When d=10, the sub-dataset DS1 test set has more than 1,600 records, and each prediction will output the values of the three features of year, month, and day for the next 10 events. The amount of data is extremely large and difficult to present in full. Therefore, the prediction results of the LSTM-SA model and the LSTM-LQSA model with relatively small errors for the time of occurrence of a future emergency are divided into three items: year, month, and day, and the specific results are shown below. Figures 6 to 8 shown.
[0075] First from Figure 6 It can be seen that both models perform poorly in predicting the year of the next emergency. In sub-dataset DS1, the actual year of the event is concentrated in 2013, while the main prediction results of the two models are concentrated in 2012, and both have certain fluctuations. Figure 7In the LSTM-SA model, the prediction results of the first 500 samples in the training set are basically consistent with the actual monthly trend, while the prediction performance of the later samples in the training set begins to deteriorate, but is roughly consistent with the trend of the true value change. In contrast, the LSTM-LQSA model performs worse, and the samples after 500 are far from the true trend. Compared with the prediction of years and months, the two models are better at predicting specific "days", and the LSTM-SA model is more accurate. For example, in Figure 8 In the test set samples after serial number 1500, the prediction results of the LSTM-SA model are basically consistent with the actual situation, while the LSTM-LQSA model shows a certain lag. The most direct reason why the model performs worse on years and months is that during the training process, the MAE error function has the same weight for all output features. The fluctuations of years and months in real data are smaller than those of specific days, so the model pays more attention to the accuracy of the day, and finally presents such a result. In general, Figures 6 to 8 As shown in the comparison with other models and the visual analysis, the LSTM-SA model is relatively better, but there is still room for further improvement.
[0076] After proving the applicability of the LSTM-SA model in predicting the time of occurrence of emergencies, we will analyze the advantages and importance of considering long sequence dependencies. In the previous experimental phase, the input data was generated and completed based on the variable-length sequence of the risk dependency period of the past month. In this process, variable-length sequences were generated based on the events of the previous two months, so the input middle It will be greatly increased to about twice the original length. Table 4 records the prediction effect of the LSTM-SA model under the new long sequence dependency situation, and also predicts 10, 20 and 30 emergencies in the future. Under the measurement of two sub-datasets and three evaluation methods, compared with the previous benchmark results using the previous month as the sequence dependency period, after lengthening the sequence length, 13 of the 18 comparisons with longer sequence inputs were better than the original or remained unchanged. Therefore, it can be considered that based on the spatiotemporal propagation characteristics of emergencies, the prediction idea of considering long sequence dependency is indeed of positive significance for grasping the risks at the emergency level. However, the results in Table 4 that some accuracy has not improved or even decreased also show that when the emergency risk dependency period is too long and the emergency sequence is too long, the LSTM-SA model still has room for improvement and further optimization.
[0077] Table 4 The impact of input sequence dependency length on prediction results
[0078]
[0079] The present invention provides support for characterizing the spatiotemporal propagation characteristics of emergencies. Secondly, the three occurrence time information of year, month and day are considered, forming a total of 9-dimensional input indicators and 3D prediction output time characteristics. On this basis, an LSTM-SA prediction model combining LSTM module and self-attention SA module is constructed, which can be applied to other more general sequence dependency prediction problems.
[0080] The present invention can accurately predict the specific time of multiple future emergencies, which helps relevant personnel to further understand and judge emergency strategies. At the same time, the present invention combines the spatiotemporal propagation characteristics of emergencies with key risk influencing factors, and improves the prediction time accuracy to the "day" level. The present invention proves the applicability of neural networks based on LSTM modules to the problem of emergency risk prediction, and provides key methodological support for subsequent research on spatiotemporal risk prediction of emergencies.
[0081] It should be noted that, for the above embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification belong to preferred embodiments, and the actions involved are not necessarily required by the present application.
[0082] The above embodiments describe the basic principles and main features of the present invention and the advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the changes and modifications made by those skilled in the art shall be within the scope of protection of the appended claims of the present invention without departing from the spirit and scope of the present invention.
Claims
1. A method for predicting the occurrence time of an emergency event based on LSTM-SA, characterized in that: The steps include: The method of variable-length sequence generation and sequence completion based on long sequence dependence is used to characterize the spatiotemporal propagation characteristics of emergencies. Select the indicators for forecast input and obtain the forecast data of the time of occurrence of emergencies; The LSTM-SA emergency event occurrence time prediction model is used to learn the spatiotemporal propagation characteristics of long sequence dependencies and predict the occurrence time of emergencies.
2. The method for predicting the occurrence time of an emergency event based on LSTM-SA as claimed in claim 1, characterized in that: The method of variable length sequence generation and sequence completion using long sequence dependency includes the following steps: using supervised learning to express the input v output mapping relationship of the emergency event occurrence time under single-step prediction, the expression is: input set Output Set Among them, n represents the total number of emergencies, m represents the input indicator dimension, and outdim represents the predicted output dimension; For each input vector x i The data of all emergencies within the preset time are accumulated as the base point, and the original two-dimensional input data is converted into a variable-length sequence. The expression is: v i Represents each input vector x i The number of emergencies in the previous preset time; To complete the variable length sequence, Convert to Get the input set and the output collection in, Indicates the maximum length of a variable-length sequence.
3. The method for predicting the occurrence time of an emergency event based on LSTM-SA as claimed in claim 2, characterized in that: The selection of indicators for prediction input includes: selecting multiple indicators to represent the long-term root causes and short-term triggering factors that affect the emergency, the long-term root causes include loss of life, GDP growth rate, population growth rate and unemployment rate; the short-term triggering factors include the year, month and day information of the incident.
4. The method for predicting the occurrence time of an emergency event based on LSTM-SA as claimed in claim 3, characterized in that: The method of obtaining emergency event occurrence time prediction data includes: obtaining emergency event historical data from a database, removing abnormal values and arranging events in date order, splitting the screened data into long-term root causes and short-term triggering factors, and using the HaRLTC method to fill in missing values to obtain emergency event occurrence time prediction data.
5. The method for predicting the occurrence time of an emergency event based on LSTM-SA as claimed in claim 4, characterized in that: The method of obtaining the prediction data of the occurrence time of an emergency event also includes: a normalization processing step, in which both the input and output data are linearly scaled, and the normalization formula is: Among them, max is the corresponding index in the input The maximum value of the data in, min is the minimum value of the current input of this indicator, is the result after the input vector xi is normalized.
6. The method for predicting the occurrence time of an emergency event based on LSTM-SA as claimed in claim 1, characterized in that: The LSTM-SA emergency event occurrence time prediction model includes a first LSTM layer, an SA layer and a second LSTM layer, and the first LSTM layer, the SA layer and the second LSTM layer are connected in sequence.
7. The method for predicting the occurrence time of an emergency event based on LSTM-SA as claimed in claim 6, characterized in that: The first LSTM layer is used as an input layer and connected to the SA layer. When the output result of the first LSTM layer is input into the SA layer, the output of the first LSTM layer is added to the output of the SA layer by using a residual connection, and then output to the second LSTM layer. After the second LSTM layer, a fully connected layer is used as the output layer, and a Dropout mechanism is added to the output layer.
8. A system for predicting the occurrence time of an emergency event based on LSTM-SA, used to implement the method for predicting the occurrence time of an emergency event based on LSTM-SA according to any one of claims 1 to 7, characterized in that: It includes a feature acquisition module and a prediction module. The feature acquisition module is used to adopt a variable-length sequence generation and sequence completion method with long sequence dependence to characterize the spatiotemporal propagation characteristics of emergencies; the prediction module is used to adopt an LSTM-SA emergency occurrence time prediction model to learn the spatiotemporal propagation characteristics of long sequence dependence and predict the risk of emergencies.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.