A flood disaster early warning method and system based on machine learning
Through local density calculation and feature extraction technology, the problem of noise data and data imbalance in flood disaster early warning is solved, a flood disaster risk assessment model is constructed, and more accurate and flexible flood disaster risk assessment and early warning are achieved.
Patent Information
- Application Number
- CN202411128987.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-08-16
AI Technical Summary
Existing flood disaster early warning methods have problems with noise data and data imbalance, resulting in inaccurate risk assessments. The models are overly biased towards most types of data, and the extraction of flood disaster characteristics is not comprehensive enough to adapt to different flood disaster situations, resulting in inaccurate risk assessments. and the inability to provide timely warning.
Use local density to calculate weighted Euclidean distance to remove noise data, filter boundary data based on mean and standard deviation, extract reference samples through clustering to build a balanced data set, and design gated temporal convolution units, adaptive graph convolution units and The gated fusion unit extracts the time and space characteristics of flood disasters, combines the regulatory factors to obtain the time and space characteristics of flood disasters, and builds a flood disaster risk assessment model.
It improves the accuracy and reliability of the model's flood disaster data, enhances its ability to describe complex flood disaster phenomena, enables efficient flood disaster risk assessment and early warning, reduces the possibility of omissions and false alarms, and protects the people's safety. Safety of life and property.
Smart Images

Figure CN118643957B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of disaster early warning, and specifically refers to a flood disaster early warning method and system based on machine learning. Background Art
[0002] The flood disaster warning method is to analyze and process flood disaster data through machine learning technology to achieve risk assessment and accurate warning of flood disasters, so as to take effective preventive measures and reduce the losses caused by flood disasters. However, the data collected by the existing flood disaster warning methods contain noise data and data imbalance, which leads to inaccurate flood disaster risk assessment, excessive bias of the model towards majority data, and insufficient recognition of minority data; the existing flood disaster warning methods have problems in extracting flood disaster features that are not comprehensive and accurate and difficult to flexibly adapt to different flood disaster situations, resulting in inaccurate flood disaster risk assessment and failure to provide timely flood disaster warnings. Summary of the invention
[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a flood disaster warning method and system based on machine learning. In view of the problems that the data collected by the existing flood disaster warning methods contain noise data and data imbalance, resulting in inaccurate flood disaster risk assessment, excessive bias of the model towards majority class data and insufficient recognition ability of minority class data, this scheme introduces local density calculation weighted Euclidean distance to obtain the upper and lower bounds of the interquartile range, identify and remove noise data, so that the model can more accurately understand and process valid data information; filter boundary data based on mean and standard deviation, extract reference samples based on clustering, synthesize reference data, and construct a flood disaster balanced data set, so that the model can more comprehensively learn various data features, so that The model can make more reliable predictions and judgments when faced with new flood disaster data; in view of the problems in the existing flood disaster warning methods that the extraction of flood disaster characteristics is not comprehensive and accurate and it is difficult to flexibly adapt to different flood disaster situations, resulting in inaccurate flood disaster risk assessment and failure to timely flood disaster warning, this scheme proposes a gated temporal convolution unit to extract flood disaster temporal characteristics, designs an adaptive graph convolution unit and an adaptive graph attention unit, and a gated fusion unit to extract flood disaster spatial characteristics, obtains flood disaster spatiotemporal characteristics based on control factors, outputs flood disaster risk assessment levels, completes the construction of a flood disaster risk assessment model, improves the ability to characterize complex flood disaster phenomena, and realizes efficient flood disaster risk assessment and warning.
[0004] The technical solution adopted by the present invention is as follows: The present invention provides a flood disaster early warning method based on machine learning, the method comprising the following steps:
[0005] Step S1: data collection;
[0006] Step S2: data preprocessing;
[0007] Step S3: balancing flood hazard data;
[0008] Step S4: constructing a flood disaster risk assessment model;
[0009] Step S5: Real-time warning of flood disasters.
[0010] Furthermore, in step S1, the data collection is to collect historical flood disaster data; the historical flood disaster data includes time points, meteorological data, hydrological data, soil data, geographical data, urban infrastructure data and risk assessment levels; the meteorological data includes precipitation, temperature, air humidity, wind speed, wind direction, air pressure and radar echo data; the hydrological data includes river water level, water flow velocity and water quality data; the soil data includes soil moisture and soil type data; the geographical data includes terrain features and land use type data; the urban infrastructure data includes drainage system status and bearing capacity of roads and bridges; and the risk assessment level is used as a data label.
[0011] Furthermore, in step S2, the data preprocessing is to perform data cleaning, data conversion, data normalization and data set construction on the collected data; data cleaning includes processing missing values, outliers and duplicate values; data conversion is to convert the data into vector form; data normalization is to unify the data range based on the maximum and minimum normalization method; and data set construction is to construct a minority class data set and a majority class data set based on the processed data.
[0012] Furthermore, in step S3, the flood disaster data balancing specifically includes the following steps:
[0013] Step S31: removing noise data, including the following steps:
[0014] Step S311: Calculate the weighted Euclidean distance, calculate the mean of all minority class data in the minority class data set P in each dimension, and obtain the average data , then introduce local density to calculate the weighted Euclidean distance between each minority class data and the average data, and sort the minority class data in ascending order according to the weighted Euclidean distance; the formula used is as follows:
[0015] ;
[0016] ;
[0017] ;
[0018] In the formula, x i and x jare the i-th and j-th minority class data in P, i and j are the minority class data indices, ρ i is the local density of the i-th minority class data in P, D i is the weighted Euclidean distance between the i-th minority class data and the average data in P, N is the number of minority class data in P, σ is the bandwidth parameter of the Gaussian kernel function, is the Euclidean distance, × is the multiplication operator, , and are the means of all minority class data in P in the 1st, qth, and Lth dimensions, respectively, where q is the dimension index, is the value of the jth minority class data in P in the qth dimension, and L is the data dimension;
[0019] Step S312: Calculate the upper and lower bounds, and obtain the interquartile range IQR according to the difference between the first quartile Q1 and the third quartile Q3, and then calculate the upper bound ub and lower bound lb of the interquartile range IQR; the interquartile range IQR can reflect the degree of dispersion of data distribution; the formula used is as follows:
[0020] ;
[0021] ;
[0022] ;
[0023] ;
[0024] ;
[0025] In the formula, x m and x n are the mth and nth minority class data after ascending sorting, m and n are the minority class data indexes, r1 and r2 are constants, and round(·) is the rounding function;
[0026] Step S313: Noise data detection: if the weighted Euclidean distance between the minority class data and the average data is greater than the upper bound ub, the minority class data is defined as noise data and removed from the minority class data set P to obtain the denoised minority class data set. ;
[0027] Step S32: Calculate the boundary data set, first calculate the denoised minority class data set The mean and standard deviation of all minority class data in each dimension are used to filter boundary data and construct boundary data sets based on the mean and standard deviation. The formula used is as follows:
[0028] ;
[0029] ;
[0030] ;
[0031] ;
[0032] In the formula, and σ q They are The mean and standard deviation of all minority class data in the qth dimension, yes The value of the j-th minority class data in the q-th dimension, A is The number of minority class data, is the boundary data set screened on the qth dimension, and Z is the boundary data set screened in total on the Qth dimension. is the union operator, yes The jth minority class data, w is the adjustment factor;
[0033] Step S33: synthesizing new data, including the following steps:
[0034] Step S331: Clustering, using K-means clustering algorithm to cluster the denoised minority class data set Perform clustering processing to obtain F clusters;
[0035] Step S332: Extract reference samples. Before synthesizing each new data, randomly extract the first reference sample to synthesize the new data from the boundary data set Z. , c is the new data index, f is the cluster index, and then randomly select the second reference sample from the fth cluster , and the second reference sample satisfies , is the cluster center of the fth cluster, and They are the first reference sample and the second reference sample belonging to the fth cluster when synthesizing the cth new data;
[0036] Step S333: Synthesis: synthesize C new data based on the first reference sample and the second reference sample; the formula used is as follows:
[0037] ;
[0038] ;
[0039] In the formula, o c and are the cth temporary data and new data respectively, rand(·) is the random number generation function, and C is the difference in the number of data between the majority class dataset and the minority class dataset;
[0040] Step S34: construct a flood disaster balance data set, aggregate the synthesized C new data, the minority class data set and the majority class data set to obtain a flood disaster balance data set; this is beneficial to subsequent data analysis and model training, and improves the accuracy and reliability of the model.
[0041] Furthermore, in step S4, the construction of the flood disaster risk assessment model specifically includes the following steps:
[0042] Step S41: extracting flood disaster time characteristics, including the following steps:
[0043] Step S411: design an input unit to receive data in the flood disaster balance data set, and regard each data in the flood disaster balance data set as a node; the feature corresponding to each node is the flood disaster data of the node; calculate the Euclidean distance between any two data in the flood disaster balance data set, and pre-set the distance threshold. If the Euclidean distance between the two data is less than the distance threshold, add an edge between the two nodes corresponding to the two data, and set the edge weight to 1; otherwise, do not add an edge between the two nodes corresponding to the two data, and set the edge weight to 0; obtain the original adjacency matrix B;
[0044] Step S412: Design a gated temporal convolution unit. The gated temporal convolution unit includes two convolution operations, each of which is processed by a different activation function. The formula used for the gated temporal convolution is as follows:
[0045] ;
[0046] In the formula, and are the flood disaster temporal features output by the l-th layer and l-1-th layer gated temporal convolutional units, respectively. l is the layer index. W1 and W2 are the first time weight matrix and the second time weight matrix, respectively. b1 and b2 are the first time bias term and the second time bias term, respectively. tanh (·) and Sigmoid (·) are the hyperbolic tangent activation function and the S-type activation function, respectively. and They are the convolution operator and the element-wise multiplication operator;
[0047] Step S42: extracting the spatial characteristics of flood disasters, including the following steps:
[0048] Step S421: Design an adaptive graph convolution unit; the formula used for adaptive graph convolution is as follows:
[0049] ;
[0050] ;
[0051] ;
[0052] ;
[0053] In the formula, is the feature output by the adaptive graph convolution unit at layer l, K is the number of diffusion steps, d is the diffusion index; ReLU (·) and SoftMax (·) are the rectified linear unit activation function and the normalized exponential function, respectively, used to eliminate weak connections and normalize; rowsum (·) is the row-by-row summation function; T is the transpose operation; B is the original adjacency matrix; B h1 and B h2 are the forward feature matrix and the reverse feature matrix, respectively, and are the randomly initialized adaptive adjacency matrices; and are the forward and reverse feature matrices for the dth diffusion respectively; e1 and e2 are the source node embedding and target node embedding respectively; B adp is the adaptive adjacency matrix; is the adaptive adjacency matrix during the d-th diffusion; W d1 , W d2 and W d3 They are the weight matrices corresponding to the forward feature matrix, the reverse feature matrix, and the adaptive adjacency matrix;
[0054] Step S422: Design an adaptive graph attention unit to assign different weights to each node according to the features of adjacent nodes, obtain the weight feature representation of each node, and then obtain the features of the adaptive graph convolution output based on the weight feature representation of all nodes ; The formula used for adaptive graph attention is as follows:
[0055] ;
[0056] ;
[0057] ;
[0058] In the formula, is the feature output by the adaptive graph attention unit at layer l, E is the total number of nodes, , , and are the feature representations of the 1st, u1th, u2th and Eth nodes respectively, is the similarity score between the u1th and u2th nodes, yes The normalized value of is the similarity score between the u1th and u3th nodes, u1, u2 and u3 are the node indices, is the inner product operator, || is the concatenation operator, W p1 and W p2 are the query parameter matrix and the key parameter matrix respectively, k is the dimension of query and key, e u1 and e u2 are the u1th and u2th nodes respectively, and are the feature matrices of the u1th and u2th nodes at time t, respectively, where t is the time index, G u1 is the set of adjacent nodes of the u1th node;
[0059] Step S423: Design a gated fusion unit to combine the features output by the adaptive graph convolution unit and the adaptive graph attention unit through a learning gate to obtain the flood disaster spatial features; the formula used is as follows:
[0060] ;
[0061] ;
[0062] In the formula, is the learning gate corresponding to the lth layer, W O1 and W O2 They are and The weight matrix, b O is the bias term of the gated fusion unit, is the spatial feature of flood disaster output by the gated fusion unit at the lth layer;
[0063] Step S43: extracting the spatiotemporal characteristics of flood disasters, weighting and fusing the temporal characteristics and spatial characteristics of flood disasters at each layer to obtain the spatiotemporal characteristics of flood disasters at each layer; comprehensively considering the temporal and spatial characteristics to more comprehensively describe the characteristics of flood disasters; the formula used is as follows:
[0064] ;
[0065] In the formula, is the spatiotemporal characteristics of flood disasters extracted at the lth layer, and β is the regulating factor;
[0066] Step S44: Calculate the model output, use the fully connected layer and obtain the final output through the SoftMax function to obtain the flood disaster risk assessment level, and complete the construction of the flood disaster risk assessment model. The formula used is as follows:
[0067] ;
[0068] Where Y is the model output, is the spatiotemporal characteristics of flood disasters extracted by the Rth layer, R is the last layer, and W out and b out are the weight matrix and bias term of the output unit respectively.
[0069] Furthermore, in step S5, the real-time flood disaster warning is to collect real-time flood disaster data; the real-time flood disaster data includes time point, meteorological data, hydrological data, soil data, geographical data and urban infrastructure data; the meteorological data includes precipitation, temperature, air humidity, wind speed, wind direction, air pressure and radar echo data; the hydrological data includes river water level, water flow velocity and water quality data; the soil data includes soil moisture and soil type data; the geographical data includes terrain characteristics and land use type data; the urban infrastructure data includes drainage system status and carrying capacity of roads and bridges; after preprocessing the real-time flood disaster data, it is input into the flood disaster risk assessment model for analysis, and an assessment threshold is set in advance. When the output risk assessment level is greater than or equal to the assessment threshold, a real-time flood disaster warning is issued.
[0070] The present invention provides a flood disaster early warning system based on machine learning, comprising a data acquisition module, a data preprocessing module, a flood disaster data balance module, a flood disaster risk assessment model building module and a flood disaster real-time early warning module;
[0071] The data acquisition module collects historical flood disaster data and sends the data to the data preprocessing module;
[0072] The data preprocessing module performs data cleaning, data conversion, data normalization and data set construction on the collected data, and sends the data to the flood disaster data balance module;
[0073] The flood disaster data balance module introduces local density to calculate the weighted Euclidean distance, obtains the upper and lower bounds of the interquartile range, identifies and removes noise data, screens boundary data based on mean and standard deviation, extracts reference samples based on clustering, synthesizes reference data, constructs a flood disaster balance data set, and sends the data to the flood disaster risk assessment model construction module;
[0074] The flood disaster risk assessment model construction module proposes a gated time convolution unit to extract the temporal characteristics of flood disasters, designs an adaptive graph convolution unit and an adaptive graph attention unit, and a gated fusion unit to extract the spatial characteristics of flood disasters, obtains the spatiotemporal characteristics of flood disasters based on the control factors, outputs the risk assessment level, completes the construction of the flood disaster risk assessment model, and sends the data to the flood disaster real-time warning module;
[0075] The flood disaster real-time warning module inputs real-time flood disaster data into the flood disaster risk assessment model for analysis, and when the output risk assessment level is greater than or equal to the assessment threshold, a flood disaster real-time warning is issued.
[0076] The beneficial effects achieved by the present invention using the above scheme are as follows:
[0077] (1) In view of the problems that the data collected by the existing flood disaster warning methods contain noise data and data imbalance, which leads to inaccurate flood disaster risk assessment, excessive bias of the model towards majority data and insufficient recognition ability of minority data, this scheme introduces local density calculation weighted Euclidean distance to obtain the upper and lower bounds of the interquartile range, identify and remove noise data, avoid noise data interfering with the model's learning of real data patterns, reduce the risk of model misjudgment due to noise, and enable the model to more accurately understand and process valid data information; based on the mean and standard deviation, boundary data are screened, reference samples are extracted based on clustering, reference data are synthesized, and a flood disaster balanced data set is constructed, which ensures the reasonable distribution of data of different categories, enables the model to learn the characteristics of various types of data more comprehensively, and reduces the model bias caused by data imbalance; enables the model to make more reliable predictions and judgments when facing new flood disaster data, reduces the possibility of underreporting and false alarms, and better protects people's lives and property.
[0078] (2) In view of the problems that the existing flood disaster warning methods are not comprehensive and accurate when extracting flood disaster features and are difficult to flexibly adapt to different flood disaster situations, resulting in inaccurate flood disaster risk assessment and failure to provide timely flood disaster warnings, this scheme proposes a gated temporal convolution unit to extract the temporal features of flood disasters to better capture the dynamic changes of temporal features; designs an adaptive graph convolution unit and an adaptive graph attention unit, as well as a gated fusion unit to extract the spatial features of flood disasters, thereby improving the flexibility, adaptability and accuracy of spatial feature extraction; obtains the spatiotemporal characteristics of flood disasters based on the control factors, and comprehensively and comprehensively describes the characteristics of flood disasters; outputs the flood disaster risk assessment level, completes the construction of the flood disaster risk assessment model, and enhances the adaptability of the model; and improves the ability to characterize complex flood disaster phenomena by finely extracting and fusing temporal features and spatial features, thereby achieving efficient flood disaster risk assessment and warning. BRIEF DESCRIPTION OF THE DRAWINGS
[0079] Figure 1 A schematic diagram of a flood disaster early warning method based on machine learning provided by the present invention;
[0080] Figure 2 A schematic diagram of a flood disaster early warning system based on machine learning provided by the present invention;
[0081] Figure 3 is a schematic flow chart of step S3;
[0082] Figure 4 It is a schematic diagram of the process of step S4.
[0083] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0084] 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 only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0085] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.
[0086] Example 1, see Figure 1 The present invention provides a flood disaster early warning method based on machine learning, which comprises the following steps:
[0087] Step S1: data collection, collecting historical flood disaster data;
[0088] Step S2: Data preprocessing, data cleaning, data conversion, data normalization and data set construction for the collected data;
[0089] Step S3: Flood disaster data balance, introduce local density to calculate weighted Euclidean distance, obtain the upper and lower bounds of the interquartile range, identify and remove noise data, filter boundary data based on mean and standard deviation, extract reference samples based on clustering, synthesize reference data, and construct a flood disaster balance data set;
[0090] Step S4: Construct a flood disaster risk assessment model, propose a gated temporal convolution unit to extract the temporal characteristics of flood disasters, design an adaptive graph convolution unit and an adaptive graph attention unit, and a gated fusion unit to extract the spatial characteristics of flood disasters, obtain the spatiotemporal characteristics of flood disasters based on the control factors, output the flood disaster risk assessment level, and complete the construction of the flood disaster risk assessment model;
[0091] Step S5: Real-time flood disaster warning: input the real-time flood disaster data into the flood disaster risk assessment model for analysis. When the output risk assessment level is greater than or equal to the assessment threshold, a real-time flood disaster warning is issued.
[0092] Example 2, see Figure 1 This embodiment is based on the above embodiment. In step S1, the historical flood disaster data includes time points, meteorological data, hydrological data, soil data, geographical data, urban infrastructure data and risk assessment levels; meteorological data includes precipitation, temperature, air humidity, wind speed, wind direction, air pressure and radar echo data; hydrological data includes river water level, water flow velocity and water quality data; soil data includes soil moisture and soil type data; geographical data includes terrain features and land use type data; urban infrastructure data includes drainage system status and road and bridge carrying capacity; and the risk assessment level is used as a data label.
[0093] Example 3, see Figure 1 This embodiment is based on the above embodiment. In step S2, data cleaning includes processing missing values, outliers and duplicate values; data conversion is to convert data into vector form; data normalization is to unify the data range based on the maximum and minimum normalization method; and data set construction is to construct a minority class data set and a majority class data set based on the processed data.
[0094] Example 4, see Figure 1 and Figure 3 This embodiment is based on the above embodiment. In step S3, flood disaster data balancing specifically includes the following steps:
[0095] Step S31: removing noise data, including the following steps:
[0096] Step S311: Calculate the weighted Euclidean distance, calculate the mean of all minority class data in the minority class data set P in each dimension, and obtain the average data , then introduce local density to calculate the weighted Euclidean distance between each minority class data and the average data, and sort the minority class data in ascending order according to the weighted Euclidean distance; more accurately measure the difference between each minority class data and the average data, and take into account the local density, so that the distance calculation is more reasonable and representative; the formula used is as follows:
[0097] ;
[0098] ;
[0099] ;
[0100] In the formula, x iand x j are the i-th and j-th minority class data in P, i and j are the minority class data indices, ρ i is the local density of the i-th minority class data in P, D i is the weighted Euclidean distance between the i-th minority class data and the average data in P, N is the number of minority class data in P, σ is the bandwidth parameter of the Gaussian kernel function, is the Euclidean distance, × is the multiplication operator, , and are the means of all minority class data in P in the 1st, qth, and Lth dimensions, respectively, where q is the dimension index, is the value of the jth minority class data in P in the qth dimension, and L is the data dimension;
[0101] Step S312: Calculate the upper and lower bounds, and obtain the interquartile range IQR according to the difference between the first quartile Q1 and the third quartile Q3, and then calculate the upper bound ub and lower bound lb of the interquartile range IQR; the interquartile range IQR can reflect the degree of dispersion of data distribution and more accurately determine the range of noise data; the formula used is as follows:
[0102] ;
[0103] ;
[0104] ;
[0105] ;
[0106] ;
[0107] In the formula, x m and x n are the mth and nth minority class data after ascending sorting, m and n are the minority class data indexes, r1 and r2 are constants, and round(·) is the rounding function;
[0108] Step S313: Noise data detection: if the weighted Euclidean distance between the minority class data and the average data is greater than the upper bound ub, the minority class data is defined as noise data and removed from the minority class data set P to obtain the denoised minority class data set. ; Effectively remove noise data that interferes with data analysis and model training, and improve data quality and reliability;
[0109] Step S32: Calculate the boundary data set, first calculate the denoised minority class data set The mean and standard deviation of all minority class data in each dimension are used to filter boundary data and construct boundary data sets; the important data at the boundary of data are accurately found to provide a basis for subsequent data synthesis; the formula used is as follows:
[0110] ;
[0111] ;
[0112] ;
[0113] ;
[0114] In the formula, and σ q They are The mean and standard deviation of all minority class data in the qth dimension, yes The value of the j-th minority class data in the q-th dimension, A is The number of minority class data, is the boundary data set screened on the qth dimension, and Z is the boundary data set screened in total on the Qth dimension. is the union operator, yes The jth minority class data, w is the adjustment factor;
[0115] Step S33: synthesizing new data, including the following steps:
[0116] Step S331: Clustering, using K-means clustering algorithm to cluster the denoised minority class data set Perform clustering processing to obtain F clusters;
[0117] Step S332: Extract reference samples. Before synthesizing each new data, randomly extract the first reference sample to synthesize the new data from the boundary data set Z. , c is the new data index, f is the cluster index, and then randomly select the second reference sample from the fth cluster , and the second reference sample satisfies , is the cluster center of the fth cluster, and They are the first reference sample and the second reference sample belonging to the fth cluster when synthesizing the cth new data. This reference sample extraction method can ensure that the synthesized data is reasonable and representative.
[0118] Step S333: Synthesis: synthesize C new data based on the first reference sample and the second reference sample; effectively increase the number of minority class data and make the data distribution more balanced; the formula used is as follows:
[0119] ;
[0120] ;
[0121] In the formula, o c and are the cth temporary data and new data respectively, rand(·) is the random number generation function, and C is the difference in the number of data between the majority class dataset and the minority class dataset;
[0122] Step S34: construct a flood disaster balance data set, aggregate the synthesized C new data, the minority class data set and the majority class data set to obtain a flood disaster balance data set; this is beneficial to subsequent data analysis and model training, and improves the accuracy and reliability of the model.
[0123] By performing the above operations, in view of the problems that the data collected by the existing flood disaster warning methods contain noise data and data imbalance, resulting in inaccurate flood disaster risk assessment, excessive bias of the model towards majority data and insufficient recognition of minority data, this scheme introduces local density calculation weighted Euclidean distance to obtain the upper and lower bounds of the interquartile range, identify and remove noise data, avoid noise data interfering with the model's learning of real data patterns, reduce the risk of model misjudgment due to noise, and enable the model to more accurately understand and process valid data information; based on the mean and standard deviation, boundary data are screened, reference samples are extracted based on clustering, reference data are synthesized, and a flood disaster balanced data set is constructed, ensuring the reasonable distribution of data of different categories, enabling the model to learn the characteristics of various types of data more comprehensively and reduce the model bias caused by data imbalance; enabling the model to make more reliable predictions and judgments when facing new flood disaster data, reduce the possibility of underreporting and false alarms, and better protect people's lives and property.
[0124] Example 5, see Figure 1 and Figure 4 Based on the above embodiment, in step S4, building a flood disaster risk assessment model specifically includes the following steps:
[0125] Step S41: extracting flood disaster time characteristics, including the following steps:
[0126] Step S411: design an input unit to receive data in the flood disaster balance data set, and regard each data in the flood disaster balance data set as a node; the feature corresponding to each node is the flood disaster data of the node; calculate the Euclidean distance between any two data in the flood disaster balance data set, and pre-set the distance threshold. If the Euclidean distance between the two data is less than the distance threshold, add an edge between the two nodes corresponding to the two data, and set the edge weight to 1; otherwise, do not add an edge between the two nodes corresponding to the two data, and set the edge weight to 0; obtain the original adjacency matrix B;
[0127] Step S412: Design a gated time convolution unit. The gated time convolution unit includes two convolution operations, each of which is processed by a different activation function. It effectively captures the dynamic changes in the temporal characteristics of flood disasters and improves the accuracy of temporal feature extraction. The formula used for the gated time convolution is as follows:
[0128] ;
[0129] In the formula, and are the flood disaster temporal features output by the l-th layer and l-1-th layer gated temporal convolutional units, respectively. l is the layer index. W1 and W2 are the first time weight matrix and the second time weight matrix, respectively. b1 and b2 are the first time bias term and the second time bias term, respectively. tanh (·) and Sigmoid (·) are the hyperbolic tangent activation function and the S-type activation function, respectively. and They are the convolution operator and the element-wise multiplication operator;
[0130] Step S42: extracting the spatial characteristics of flood disasters, including the following steps:
[0131] Step S421: Design an adaptive graph convolution unit; adaptively process spatial features to better adapt to different flood disaster situations and improve the flexibility and adaptability of spatial feature extraction; the formula used for adaptive graph convolution is as follows:
[0132] ;
[0133] ;
[0134] ;
[0135] ;
[0136] In the formula, is the feature output by the adaptive graph convolution unit at layer l, K is the number of diffusion steps, d is the diffusion index; ReLU (·) and SoftMax (·) are the rectified linear unit activation function and the normalized exponential function, respectively, used to eliminate weak connections and normalize; rowsum (·) is the row-by-row summation function; T is the transpose operation; B is the original adjacency matrix; B h1 and B h2 are the forward feature matrix and the reverse feature matrix, respectively, and are the randomly initialized adaptive adjacency matrices; and are the forward and reverse feature matrices for the dth diffusion respectively; e1 and e2 are the source node embedding and target node embedding respectively; B adp is the adaptive adjacency matrix; is the adaptive adjacency matrix during the d-th diffusion; W d1 , W d2 and W d3 They are the weight matrices corresponding to the forward feature matrix, the reverse feature matrix, and the adaptive adjacency matrix;
[0137] Step S422: Design an adaptive graph attention unit to assign different weights to each node according to the features of adjacent nodes, obtain the weight feature representation of each node, and then obtain the features of the adaptive graph convolution output based on the weight feature representation of all nodes ; Capture the relationship between nodes more accurately and improve the accuracy and precision of spatial feature extraction; The formula used for adaptive graph attention is as follows:
[0138] ;
[0139] ;
[0140] ;
[0141] In the formula, is the feature output by the adaptive graph attention unit at layer l, E is the total number of nodes, , , and are the feature representations of the 1st, u1th, u2th and Eth nodes respectively, is the similarity score between the u1th and u2th nodes, yes The normalized value of is the similarity score between the u1th and u3th nodes, u1, u2 and u3 are the node indices, is the inner product operator, || is the concatenation operator, W p1 and W p2are the query parameter matrix and the key parameter matrix respectively, k is the dimension of query and key, e u1 and e u2 are the u1th and u2th nodes respectively, and are the feature matrices of the u1th and u2th nodes at time t, respectively, where t is the time index, G u1 is the set of adjacent nodes of the u1th node;
[0142] Step S423: Design a gated fusion unit to combine the features output by the adaptive graph convolution unit and the adaptive graph attention unit through a learning gate to obtain the spatial features of flood disasters; effectively integrate features from different sources to improve the effect and rationality of feature fusion; the formula used is as follows:
[0143] ;
[0144] ;
[0145] In the formula, is the learning gate corresponding to the lth layer, W O1 and W O2 They are and The weight matrix, b O is the bias term of the gated fusion unit, is the spatial feature of flood disaster output by the gated fusion unit at the lth layer;
[0146] Step S43: extracting the spatiotemporal characteristics of flood disasters, weighting and fusing the temporal characteristics and spatial characteristics of flood disasters at each layer to obtain the spatiotemporal characteristics of flood disasters at each layer; comprehensively considering the temporal and spatial characteristics to more comprehensively describe the characteristics of flood disasters; the formula used is as follows:
[0147] ;
[0148] In the formula, is the spatiotemporal characteristics of flood disasters extracted at the lth layer, and β is the regulating factor;
[0149] Step S44: Calculate the model output, use the fully connected layer and obtain the final output through the SoftMax function to obtain the flood disaster risk assessment level, and complete the construction of the flood disaster risk assessment model. The formula used is as follows:
[0150] ;
[0151] Where Y is the model output, is the spatiotemporal characteristics of flood disasters extracted by the Rth layer, R is the last layer, and W out and b outare the weight matrix and bias term of the output unit respectively.
[0152] By performing the above operations, in order to solve the problems in the existing flood disaster warning methods that the extraction of flood disaster features is not comprehensive and accurate enough and it is difficult to flexibly adapt to different flood disaster situations, resulting in inaccurate flood disaster risk assessment and failure to timely flood disaster warning, this scheme proposes a gated temporal convolution unit to extract the temporal features of flood disasters, so as to better capture the dynamic changes of temporal features; an adaptive graph convolution unit and an adaptive graph attention unit, as well as a gated fusion unit, are designed to extract the spatial features of flood disasters, thereby improving the flexibility, adaptability and accuracy of spatial feature extraction; the spatiotemporal features of flood disasters are obtained based on the regulating factors, and the characteristics of flood disasters are described comprehensively and comprehensively; the flood disaster risk assessment level is output, the construction of the flood disaster risk assessment model is completed, and the adaptability of the model is enhanced; by respectively extracting and fusing the temporal features and the spatial features, the ability to characterize complex flood disaster phenomena is improved, and efficient flood disaster risk assessment and warning are achieved.
[0153] Example 6, see Figure 1 This embodiment is based on the above embodiment. In step S5, the real-time flood disaster warning is to collect real-time flood disaster data; the real-time flood disaster data includes time point, meteorological data, hydrological data, soil data, geographical data and urban infrastructure data; the meteorological data includes precipitation, temperature, air humidity, wind speed, wind direction, air pressure and radar echo data; the hydrological data includes river water level, water flow velocity and water quality data; the soil data includes soil moisture and soil type data; the geographical data includes terrain characteristics and land use type data; the urban infrastructure data includes drainage system status and road and bridge carrying capacity; after the real-time flood disaster data is preprocessed, it is input into the flood disaster risk assessment model for analysis, and an assessment threshold is pre-set. When the output risk assessment level is greater than or equal to the assessment threshold, a real-time flood disaster warning is performed.
[0154] Embodiment 7, see Figure 2 , this embodiment is based on the above embodiment, and a flood disaster early warning system based on machine learning provided by the present invention includes a data acquisition module, a data preprocessing module, a flood disaster data balance module, a flood disaster risk assessment model building module and a flood disaster real-time early warning module;
[0155] The data acquisition module collects historical flood disaster data and sends the data to the data preprocessing module;
[0156] The data preprocessing module performs data cleaning, data conversion, data normalization and data set construction on the collected data, and sends the data to the flood disaster data balance module;
[0157] The flood disaster data balance module introduces local density to calculate the weighted Euclidean distance, obtains the upper and lower bounds of the interquartile range, identifies and removes noise data, screens boundary data based on mean and standard deviation, extracts reference samples based on clustering, synthesizes reference data, constructs a flood disaster balance data set, and sends the data to the flood disaster risk assessment model construction module;
[0158] The flood disaster risk assessment model construction module proposes a gated time convolution unit to extract the temporal characteristics of flood disasters, designs an adaptive graph convolution unit and an adaptive graph attention unit, and a gated fusion unit to extract the spatial characteristics of flood disasters, obtains the spatiotemporal characteristics of flood disasters based on the control factors, outputs the risk assessment level, completes the construction of the flood disaster risk assessment model, and sends the data to the flood disaster real-time warning module;
[0159] The flood disaster real-time warning module inputs real-time flood disaster data into the flood disaster risk assessment model for analysis, and when the output risk assessment level is greater than or equal to the assessment threshold, a flood disaster real-time warning is issued.
[0160] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0161] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.
[0162] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. A flood disaster early warning method based on machine learning, characterized in that: The method comprises the following steps: Step S1: data collection; Step S2: data preprocessing; Step S3: Flood disaster data balance, introduce local density to calculate weighted Euclidean distance, obtain the upper and lower bounds of the interquartile range, identify and remove noise data, filter boundary data based on mean and standard deviation, extract reference samples based on clustering, synthesize reference data, and construct a flood disaster balance data set; Step S4: Construct a flood disaster risk assessment model, propose a gated temporal convolution unit to extract the temporal characteristics of flood disasters, design an adaptive graph convolution unit and an adaptive graph attention unit, and a gated fusion unit to extract the spatial characteristics of flood disasters, obtain the spatiotemporal characteristics of flood disasters based on the control factors, output the flood disaster risk assessment level, and complete the construction of the flood disaster risk assessment model; Step S5: Real-time warning of flood disasters; In step S3, the flood disaster data balancing specifically includes the following steps: Step S31: removing noise data; Step S32: Calculate the boundary data set, first calculate the denoised minority class data set The mean and standard deviation of all minority class data in each dimension are used to filter boundary data and construct boundary data sets based on the mean and standard deviation. The formula used is as follows: ; ; ; ; In the formula, and σ q They are The mean and standard deviation of all minority class data in the qth dimension, yes The value of the j-th minority class data in the q-th dimension, A is The number of minority class data, is the boundary data set screened on the qth dimension, and Z is the boundary data set screened in total on the Qth dimension. is the union operator, yes The jth minority class data, w is the adjustment factor; Step S33: synthesizing new data, including the following steps: Step S331: Clustering, using K-means clustering algorithm to cluster the denoised minority class data set Perform clustering processing to obtain F clusters; Step S332: Extract reference samples. Before synthesizing each new data, randomly extract the first reference sample to synthesize the new data from the boundary data set Z. , c is the new data index, f is the cluster index, and then randomly select the second reference sample from the fth cluster , and the second reference sample satisfies , is the cluster center of the fth cluster, and They are the first reference sample and the second reference sample belonging to the fth cluster when synthesizing the cth new data; Step S333: Synthesis: synthesize C new data based on the first reference sample and the second reference sample; the formula used is as follows: ; ; In the formula, o c and are the cth temporary data and new data respectively, rand(·) is the random number generation function, and C is the difference in the number of data between the majority class dataset and the minority class dataset; Step S34: construct a flood disaster balance data set, aggregate the synthesized C new data, the minority class data set and the majority class data set to obtain a flood disaster balance data set; In step S31, the noise data removal specifically includes the following steps: Step S311: Calculate the weighted Euclidean distance, calculate the mean of all minority class data in the minority class data set P in each dimension, and obtain the average data , then introduce local density to calculate the weighted Euclidean distance between each minority class data and the average data, and sort the minority class data in ascending order according to the weighted Euclidean distance; the formula used is as follows: ; ; ; In the formula, x i and x j are the i-th and j-th minority class data in P, i and j are the minority class data indices, ρ i is the local density of the i-th minority class data in P, D i is the weighted Euclidean distance between the i-th minority class data and the average data in P, N is the number of minority class data in P, σ is the bandwidth parameter of the Gaussian kernel function, is the Euclidean distance, × is the multiplication operator, , and are the means of all minority class data in P in the 1st, qth, and Lth dimensions, respectively. L is the data dimension, and q is the dimension index. is the value of the jth minority class data in P in the qth dimension; Step S312: Calculate the upper and lower bounds, obtain the interquartile range IQR according to the difference between the first quartile Q1 and the third quartile Q3, and then calculate the upper bound ub and lower bound lb of the interquartile range IQR; the formula used is as follows: ; ; ; ; ; In the formula, x m and x n are the mth and nth minority class data after ascending sorting, m and n are the minority class data indexes, r1 and r2 are constants, and round(·) is the rounding function; Step S313: Noise data detection: if the weighted Euclidean distance between the minority class data and the average data is greater than the upper bound ub, the minority class data is defined as noise data and removed from the minority class data set P to obtain the denoised minority class data set. .
2. The flood disaster early warning method based on machine learning according to claim 1, characterized in that: In step S4, the construction of the flood disaster risk assessment model specifically includes the following steps: Step S41: extracting flood disaster time characteristics, including the following steps: Step S411: design an input unit to receive data in the flood disaster balance data set, and regard each data in the flood disaster balance data set as a node; the feature corresponding to each node is the flood disaster data of the node; calculate the Euclidean distance between any two data in the flood disaster balance data set, and pre-set the distance threshold. If the Euclidean distance between the two data is less than the distance threshold, add an edge between the two nodes corresponding to the two data, and set the edge weight to 1; otherwise, do not add an edge between the two nodes corresponding to the two data, and set the edge weight to 0; obtain the original adjacency matrix B; Step S412: Design a gated temporal convolution unit. The gated temporal convolution unit includes two convolution operations, each of which is processed by a different activation function. The formula used for the gated temporal convolution is as follows: ; In the formula, and are the flood disaster temporal features output by the l-th layer and l-1-th layer gated temporal convolutional units, respectively. l is the layer index. W1 and W2 are the first time weight matrix and the second time weight matrix, respectively. b1 and b2 are the first time bias term and the second time bias term, respectively. tanh (·) and Sigmoid (·) are the hyperbolic tangent activation function and the S-type activation function, respectively. and They are the convolution operator and the element-wise multiplication operator; Step S42: extracting spatial characteristics of flood disasters; Step S43: extracting the spatiotemporal characteristics of flood disasters, weightedly fusing the temporal characteristics and spatial characteristics of flood disasters at each layer to obtain the spatiotemporal characteristics of flood disasters at each layer; the formula used is as follows: ; In the formula, is the spatiotemporal characteristics of flood disasters extracted from the lth layer, β is the regulating factor, is the spatial feature of flood disaster output by the gated fusion unit at the lth layer; Step S44: Calculate the model output, use the fully connected layer and obtain the final output through the SoftMax function to obtain the flood disaster risk assessment level, and complete the construction of the flood disaster risk assessment model. The formula used is as follows: ; Where Y is the model output, is the spatiotemporal characteristics of flood disasters extracted by the Rth layer, R is the last layer, and W out and b out are the weight matrix and bias term of the output unit respectively.
3. The flood disaster early warning method based on machine learning according to claim 2 is characterized in that: In step S42, extracting the spatial characteristics of flood disasters specifically includes the following steps: Step S421: Design an adaptive graph convolution unit; the formula used for adaptive graph convolution is as follows: ; ; ; ; In the formula, is the feature output by the adaptive graph convolution unit at layer l, K is the number of diffusion steps, d is the diffusion index; ReLU (·) and SoftMax (·) are the rectified linear unit activation function and the normalized exponential function, respectively; rowsum (·) is the row-by-row summation function; T is the transpose operation; B is the original adjacency matrix; B h1 and B h2 They are the forward feature matrix and the reverse feature matrix respectively; and are the forward and reverse feature matrices for the dth diffusion respectively; e1 and e2 are the source node embedding and target node embedding respectively; B adp is the adaptive adjacency matrix; is the adaptive adjacency matrix during the d-th diffusion; W d1 , W d2 and W d3 They are the weight matrices corresponding to the forward feature matrix, the reverse feature matrix, and the adaptive adjacency matrix; Step S422: Design an adaptive graph attention unit to assign different weights to each node according to the features of adjacent nodes, obtain the weight feature representation of each node, and then obtain the features of the adaptive graph convolution output based on the weight feature representation of all nodes ; The formula used for adaptive graph attention is as follows: ; ; ; In the formula, is the feature output by the adaptive graph attention unit at layer l, E is the total number of nodes, , , and are the feature representations of the 1st, u1th, u2th and Eth nodes respectively, is the similarity score between the u1th and u2th nodes, yes The normalized value of is the similarity score between the u1th and u3th nodes, u1, u2 and u3 are the node indices, is the inner product operator, || is the concatenation operator, W p1 and W p2 are the query parameter matrix and the key parameter matrix respectively, k is the dimension of query and key, e u1 and e u2 are the u1th and u2th nodes respectively, and are the feature matrices of the u1th and u2th nodes at time t, respectively, where t is the time index, G u1 is the set of adjacent nodes of the u1th node; Step S423: Design a gated fusion unit to combine the features output by the adaptive graph convolution unit and the adaptive graph attention unit through a learning gate to obtain the flood disaster spatial features; the formula used is as follows: ; ; In the formula, is the learning gate corresponding to the lth layer, W O1 and W O2 They are and The weight matrix, b O is the bias term of the gated fusion unit, It is the spatial feature of flood disaster output by the gated fusion unit at the lth layer.
4. The flood disaster early warning method based on machine learning according to claim 1, characterized in that: In step S5, the real-time flood disaster warning is to collect real-time flood disaster data; the real-time flood disaster data includes time point, meteorological data, hydrological data, soil data, geographical data and urban infrastructure data; the meteorological data includes precipitation, temperature, air humidity, wind speed, wind direction, air pressure and radar echo data; the hydrological data includes river water level, water flow velocity and water quality data; the soil data includes soil moisture and soil type data; the geographical data includes terrain characteristics and land use type data; the urban infrastructure data includes drainage system status and road and bridge carrying capacity; after the real-time flood disaster data is preprocessed, it is input into the flood disaster risk assessment model for analysis, and an assessment threshold is pre-set. When the output risk assessment level is greater than or equal to the assessment threshold, a real-time flood disaster warning is issued.
5. The flood disaster early warning method based on machine learning according to claim 1, characterized in that: In step S1, the data collection is to collect historical flood disaster data; the historical flood disaster data includes time points, meteorological data, hydrological data, soil data, geographical data, urban infrastructure data and risk assessment levels; the meteorological data includes precipitation, temperature, air humidity, wind speed, wind direction, air pressure and radar echo data; the hydrological data includes river water level, water flow velocity and water quality data; the soil data includes soil moisture and soil type data; the geographical data includes terrain features and land use type data; the urban infrastructure data includes drainage system status and road and bridge bearing capacity; the risk assessment level is used as a data label.
6. The flood disaster early warning method based on machine learning according to claim 1, characterized in that: In step S2, the data preprocessing is to perform data cleaning, data conversion, data normalization and data set construction on the collected data; data cleaning includes processing missing values, outliers and duplicate values; Data conversion is to convert data into vector form; data normalization is to unify the data range based on the maximum and minimum normalization method; and data set construction is to construct minority class data sets and majority class data sets based on the processed data.
7. A flood disaster early warning system based on machine learning, used to implement a flood disaster early warning method based on machine learning as claimed in any one of claims 1 to 6, characterized in that: It includes data acquisition module, data preprocessing module, flood disaster data balance module, flood disaster risk assessment model building module and flood disaster real-time warning module; The data acquisition module collects historical flood disaster data and sends the data to the data preprocessing module; The data preprocessing module performs data cleaning, data conversion, data normalization and data set construction on the collected data, and sends the data to the flood disaster data balance module; The flood disaster data balance module introduces local density to calculate the weighted Euclidean distance, obtains the upper and lower bounds of the interquartile range, identifies and removes noise data, screens boundary data based on mean and standard deviation, extracts reference samples based on clustering, synthesizes reference data, constructs a flood disaster balance data set, and sends the data to the flood disaster risk assessment model construction module; The flood disaster risk assessment model construction module proposes a gated time convolution unit to extract the temporal characteristics of flood disasters, designs an adaptive graph convolution unit and an adaptive graph attention unit, and a gated fusion unit to extract the spatial characteristics of flood disasters, obtains the spatiotemporal characteristics of flood disasters based on the control factors, outputs the risk assessment level, completes the construction of the flood disaster risk assessment model, and sends the data to the flood disaster real-time warning module; The flood disaster real-time warning module inputs the real-time flood disaster data into the flood disaster risk assessment model for analysis, and when the output risk assessment level is greater than or equal to the assessment threshold, a flood disaster real-time warning is issued; Constructing a data set is to construct a minority class data set and a majority class data set based on the processed data; calculating the mean of all minority class data in each dimension in the minority class data set P to obtain the average data , then introduce local density to calculate the weighted Euclidean distance between each minority class data and the average data, and sort the minority class data in ascending order according to the weighted Euclidean distance; According to the difference between the first quartile Q1 and the third quartile Q3, the interquartile range IQR is obtained, and then the upper bound ub and lower bound lb of the interquartile range IQR are calculated; if the weighted Euclidean distance between the minority class data and the average data is greater than the upper bound ub, the minority class data is defined as noise data and removed from the minority class data set P to obtain the denoised minority class data set ; Calculate the boundary data set, first calculate the minority class data set after denoising The mean and standard deviation of all minority class data in each dimension are used to filter the boundary data and construct the boundary data set; the K-means clustering algorithm is used to cluster the denoised minority class data set Perform clustering processing to obtain F clusters; Extract reference samples. Before synthesizing each new data, randomly extract the first reference sample to synthesize the new data from the boundary data set Z. , c is the new data index, f is the cluster index, and then randomly select the second reference sample from the fth cluster , and the second reference sample satisfies , is the cluster center of the fth cluster, and They are the first reference sample and the second reference sample belonging to the fth cluster when synthesizing the cth new data; C new data are synthesized based on the first reference sample and the second reference sample; the synthesized C new data, the minority class data set and the majority class data set are aggregated to obtain a flood disaster balance data set.
