Urban inland inundation prediction method based on machine learning technology, electronic equipment and storage medium
The data on flooding caused by rainstorms were processed through edge stripping clustering and YJ-MICPCA algorithm, and a CNN model was constructed to solve the problem of insufficient accuracy and timeliness in urban flooding prediction, and to achieve efficient flooding prediction and early warning.
Patent Information
- Application Number
- CN202411099486.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-12-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing machine learning methods are insufficient in the accuracy and timeliness of urban flooding predictions, making it difficult to meet the needs of rapid forecasting.
The edge stripping clustering algorithm and YJ-MICPCA algorithm are used to preprocess and feature extraction of flooding data caused by heavy rain, build a CNN urban flooding prediction model, and use a convolutional neural network for training to achieve fast prediction.
It improves the accuracy and timeliness of urban flooding prediction, can quickly and effectively predict the depth of flooding, and provides scientific reference for urban flooding warning and disaster prevention and mitigation.
Smart Images

Figure CN119106760A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of urban waterlogging prediction, and in particular relates to an urban waterlogging prediction method, electronic equipment and storage medium based on machine learning technology. Background Art
[0002] Urban waterlogging has become a global concern, especially in the context of global climate change and rapid urbanization. Frequent extreme rainfall events have made urban waterlogging a particularly prominent problem. In response to this challenge, scholars have conducted a lot of research, mainly focusing on hydrodynamic models and machine learning methods.
[0003] In terms of hydrodynamic models, commonly used urban flood prediction models include the Stormwater Flood Management Model (SWMM), the Integrated Urban Watershed Drainage Model (infoWorks ICM), MIKE URBAN, etc. These models calculate the flow state by solving hydrodynamic equations, and have the advantages of clear physical mechanisms and high precision of numerical simulation results. However, under large-scale and complex underground conditions, the model solution is complex and time-consuming, and it is difficult to meet the timeliness requirements of heavy rain forecasts.
[0004] In recent years, in order to make up for the shortcomings of hydrodynamic models, scholars have begun to apply machine learning methods to the prediction of rainstorm flood disasters. These methods include artificial neural networks (ANN), support vector machines (SVM), XGBoost, etc. These studies have shown that machine learning technology has broad application prospects in urban flood prediction and can improve the accuracy and timeliness of predictions.
[0005] However, existing machine learning methods still have some problems when dealing with urban waterlogging prediction, such as low prediction accuracy and slow calculation speed. Therefore, it is of great significance to develop an efficient and accurate urban waterlogging prediction method. Summary of the invention
[0006] Aiming at the problem of insufficient accuracy and timeliness in urban waterlogging prediction, the present invention proposes an urban waterlogging prediction method, electronic device and storage medium based on machine learning technology.
[0007] To achieve the above object, the present invention is implemented through the following technical solutions:
[0008] A method for predicting urban waterlogging based on machine learning technology comprises the following steps:
[0009] S1. For urban flood events, extract rainstorm waterlogging data from environmental monitoring data, build a mathematical model, and pre-process the collected rainstorm waterlogging data;
[0010] S2. for the pre-processed rainstorm waterlogging data obtained in step S1, an edge-peeling clustering algorithm is used to repeatedly peel off the outer layer of data points to find the core of potential clusters, analyze the hierarchical structure of potential clusters, iteratively estimate boundary points, and associate them with inner points to remove interference points in the rainstorm waterlogging data, thereby obtaining the rainstorm waterlogging data after removing interference points;
[0011] S3. Design a YJ-MICPCA algorithm to process the rainstorm waterlogging data obtained in step S2 after removing interference points, including YJ transformation, MIC transformation and PCA dimension reduction, extract the main features of the rainstorm waterlogging data, and obtain the rainstorm waterlogging data after the main features are extracted;
[0012] S4. Construct a CNN urban waterlogging prediction model, and then use the rainstorm waterlogging data after the main feature extraction obtained in step S3 to train the CNN urban waterlogging prediction model to obtain a trained CNN urban waterlogging prediction model for predicting urban waterlogging.
[0013] Furthermore, the specific implementation method of step S1 includes the following steps:
[0014] S1.1. Extract rainstorm waterlogging data from environmental monitoring data and construct a mathematical model, which is expressed as follows:
[0015] Q=P·A·φ
[0016] Where Q is the runoff volume, P is the rainfall intensity, A is the area of the affected area, and φ is the flow coefficient determined by topography and soil conditions;
[0017] Define a feature extraction function F(x) to convert the original data x into a set of feature vectors.
[0018] F(x)=(f1(x),f2(x),...,f m (x)
[0019] Among them, f i (x) is the i-th feature extracted from the original data x;
[0020] S1.2. All eigenvalues obtained in step S1 are normalized. The normalized expression is:
[0021]
[0022] Where μ is the mean of the data, σ is the standard deviation, and x normalized It is the normalized data.
[0023] Furthermore, the specific implementation method of step S2 includes the following steps:
[0024] S2.1. Based on the normalized feature data of step S1, based on the identification of edge points, a data set X with n data nodes is set to be {x1, x2, ...x n}, set the input to be the dissimilarity function δ:R, δ is the Euclidean distance δ used to represent the dissimilarity, X t is the set of data nodes that have not yet been stripped at the tth iteration;
[0025] For each node x i ∈X (t) , use N k (t) (x i ) represents the tth iteration x i node and the set of k-th nearest neighbor nodes, then x i The inverse k nearest neighbors of a node are expressed as:
[0026] RN k (t) (x i )←{x j |x i ∈N k (t) (x j )}
[0027] In order to calculate the distance between the i-th node and the j-th node in the region, the dissimilarity function δ:R is used and solved by the locally scaled Gaussian kernel, which is expressed as:
[0028]
[0029] Among them, f(x i ,x j ) is the Gaussian kernel function of the i-th node and the j-th node, σ j =||x j -N k (t) (x j )[k]||2;
[0030] Then calculate the expected association b between nodes i (t) , expressed by the following formula:
[0031]
[0032] For each node x in the dataset i ∈X (t) , the boundary classification value of the node is represented by B(t), x i The value of the node is 1 when it is a boundary node, and 0 otherwise;
[0033] Then each time the boundary classification value B is calculated i (t) When the iteration is terminated with a specific value, the expression is:
[0034]
[0035] Among them, π (t) is the fixed value of the attribute of the rainstorm-induced waterlogging data at the t-th iteration, otherwise is other;
[0036] Then calculate the boundary node set X at iteration t B (t) , the expression is:
[0037] X B (t) ={x i ∈X (t) :B i (t) =1};
[0038] Then the data set that has not been stripped at the t+1th iteration is expressed as:
[0039] X (t+1) =X (t) / X B (t) ;
[0040] S2.2. Associate the boundary points identified in step S2.1. At the tth iteration of the dataset, associate these boundary nodes with their non-neighbor nodes to represent the identified nodes ρ i ∈X (t+1) , the calculation formula is as follows:
[0041]
[0042] Among them, x j is the set of non-boundary nodes closest to x after t iterations i The non-boundary nodes, l i Indicates the spatial variation threshold, 0 means x i is an out-of-cluster node;
[0043] Other distant neighbors are associated to avoid isolated border nodes, but this results in distant clusters being mistakenly merged and marked as out-cluster nodes, i.e., nodes that are not members of any cluster;
[0044] Each boundary node x in the region i When dividing into boundary nodes, first calculate the threshold l i , τ represents the maximum threshold parameter. In each iteration, the value of τ is used as the base point to determine whether the node is a boundary node;
[0045] From the formula Get the k nearest neighbor data node set to x i , the set is defined as NN B,k t (x i ), calculate the threshold l i , the expression is:
[0046]
[0047] Among them, c represents the strictness of the threshold;
[0048] S2.3 performs self-directed upward clustering on the boundary points associated in step S2.2, starting with each data point as a single cluster, and then gradually merging into larger clusters until an overall cluster is formed. The merging process is as follows:
[0049] Define a cluster head node coordinate Head(x i ,x j )∈X (t+1) , the coordinates of other cluster head nodes are expressed as and Therefore, for (x r ,x r+1 ) in which each two neighbor nodes have the following index: Established.
[0050] Furthermore, the specific implementation method of step S3 includes the following steps:
[0051] S3.1. Perform YJ transformation on the rainstorm waterlogging data after removing interference points and reducing noise in step S2. The expression is:
[0052]
[0053] Among them, δ(μ,x) is a function of the data that obeys the Gaussian distribution obtained by YJ transformation of the known data point x, and μ is the unknown parameter to be estimated;
[0054] S3.2. Perform MIC transformation on the data that obeys Gaussian distribution obtained by YJ transformation in step S3.1 to solve mic(x i ,x j ), by simplifying the maximum information coefficient between any two variables, the expression of the maximum information coefficient matrix Q is obtained as follows:
[0055]
[0056] Where M is the square of the maximum mutual information coefficient matrix, M = Q 2, Q is a symmetric matrix, so Q = Q T , for any vector y, there exists y T My=y T QQ T y=||y T Q|| 2 ≥0, perform eigenvalue decomposition to ensure that the eigenvalues of M are all non-negative;
[0057] S3.3. Perform PCA dimensionality reduction on the data that satisfy the linear relationship after MIC transformation in step S3.2, extract the eigenvalues, and use X∈R as the sample data. PxN In the formula, P represents the dimension, N represents the amount of sample data, and the expression in the data center is:
[0058]
[0059] Then the calculated new coordinates are {w1,w2,…,w p}, where the standard orthogonal basis is w i It is expressed as, and satisfies the following formula:
[0060]
[0061] In the process of dimensionality reduction, some dimensions are discarded, and the matrix is shown in the following formula, which represents the standard orthogonal basis:
[0062] w k ={w1,w2,…,w k},k <p and w m {m=1,2,…k};
[0063] The realization is reduced from p dimension to k dimension, and the original sample x is obtained (i) The expression for projection in the k-dimensional feature space is:
[0064] z (i) =(z1 (i) ,z2 (i) ,…,z n (i) ) T
[0065] Among them, x (i) In the k-dimensional coordinate system, the m-dimensional coordinate is expressed as z m (i) =w m T x (i) , extract the important features of the data by projecting the data into a new feature space to reduce the dimension, according to z (i) Feature space reconstruction x (i) , the expression is:
[0066]
[0067] After simplification, the expression is:
[0068]
[0069] Among them, W k * is the reconstructed sample point x (i)' and the original sample x (i) The distance between
[0070] In PCA, the sample point x is reconstructed by Euclidean distance (i)' and the original sample x (i) The distance between them is calculated by projecting the data into a low-dimensional subspace to reduce the dimensionality of the data and minimizing the reconstruction error between the reduced-dimensional data and the original data. The expression is:
[0071]
[0072] Let X = (x1, x2, ..., x P ), the corresponding eigenvector is (u 1i ,u 2i ,…,u pi , i=1,2,…,p) means, find the formula XX T Eigenvalue, eigenvalue decomposition, find the eigenvalue using (μ1,μ2,…,μ p ) represents, then the principal component Z is obtained i for:
[0073] Z i =(u 1i X1+u 2i X2+…+u pi X p ,i=1,2,…,p).
[0074] Furthermore, the specific implementation method of step S4 includes the following steps:
[0075] S4.1. Design a CNN model for the rainstorm waterlogging data after extracting the main features in step S3. The CNN model contains multiple convolutional layers, each of which is used to extract the spatial features of the input data. The calculation formula of the convolutional layer is as follows:
[0076] a l+1 =σ(W l *a l +b l )
[0077] Among them, a l is the activation output of layer l, Wl and b l are the weight and bias of the convolutional layer, σ is the nonlinear activation function, and the ReLU function is usually used to enhance the nonlinear expression ability of the model;
[0078] S4.2. Design a pooling layer based on the data calculated by the convolution layer in step S4.1. Each convolution layer is usually followed by a maximum pooling layer to reduce the feature dimension and reduce the amount of calculation. The expression is:
[0079]
[0080] in, is the eigenvalue output by the pooling layer, is the local area in the input feature map;
[0081] S4.3 fully connects the feature data extracted by the maximum pooling layer in step S4.2. The final stage of the network includes at least one fully connected layer, which is responsible for mapping the learned features to the predicted output. The expression is:
[0082] a L =W L-1 a L-1 +b L-1
[0083] Among them, a L is the output of the fully connected layer, L is the index of the layer, and W L-1 and b L-1 are the weights and biases of the fully connected layer;
[0084] S4.4 The CNN model designed in step S4.3 is used to train and test the rainstorm waterlogging data with the main features extracted in step S3 to predict the water depth data at a future time; based on a ten-fold cross-validation strategy, the data set is divided into 9:1, 90% for training and 10% for testing;
[0085] S4.5 Select mean square error MSE, mean absolute error MAE and goodness of fit R 2 As a performance measure, it is used to quantify the difference between the model predictions and the actual observed values;
[0086] The expression of mean square error is:
[0087]
[0088] Among them, y i is the true value of the i-th sample, is the predicted value of the i-th sample;
[0089] The expression of mean absolute error is:
[0090]
[0091] The expression of goodness of fit is:
[0092]
[0093] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a method for predicting urban waterlogging based on machine learning technology are implemented.
[0094] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements a method for predicting urban waterlogging based on machine learning technology.
[0095] Beneficial effects of the present invention:
[0096] The urban waterlogging prediction method based on machine learning technology described in the present invention proposes a rapid urban waterlogging prediction model based on convolutional neural network, which aims to use high-precision data obtained from numerical simulation for learning and training, realize rapid prediction of waterlogging depth, solve the problems of insufficient accuracy and timeliness in urban waterlogging prediction, and provide scientific reference for urban waterlogging early warning and forecasting and disaster prevention and mitigation work. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] Figure 1 A flowchart of a method for predicting urban waterlogging based on machine learning technology according to the present invention;
[0098] Figure 2 This is a schematic diagram of identifying boundary nodes according to the present invention;
[0099] Figure 3 Schematic diagram of the CNN model architecture of the present invention. DETAILED DESCRIPTION
[0100] In order to make the purpose, technical solution and advantages of the present invention more clear, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention, that is, the specific embodiments described are only part of the embodiments of the present invention, rather than all of the specific embodiments. The components of the specific embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations, and the present invention can also have other embodiments.
[0101] Therefore, the following detailed description of the specific embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents the selected specific embodiments of the present invention. Based on the specific embodiments of the present invention, all other specific embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0102] In order to further understand the content, features and effects of the present invention, the following specific implementation methods are given as examples, and the attached Figure 1 -Attached Figure 3 The detailed instructions are as follows:
[0103] Embodiment 1:
[0104] A method for predicting urban waterlogging based on machine learning technology comprises the following steps:
[0105] S1. For urban flood events, extract rainstorm waterlogging data from environmental monitoring data, build a mathematical model, and pre-process the collected rainstorm waterlogging data;
[0106] Furthermore, the specific implementation method of step S1 includes the following steps:
[0107] S1.1. Extract rainstorm waterlogging data from environmental monitoring data and construct a mathematical model, which is expressed as follows:
[0108] Q=P·A·φ
[0109] Where Q is the runoff volume, P is the rainfall intensity, A is the area of the affected area, and φ is the flow coefficient determined by topography and soil conditions;
[0110] Define a feature extraction function F(x) to convert the original data x into a set of feature vectors.
[0111] F(x)=(f1(x),f2(x),...,f m (x)
[0112] Among them, f i (x) is the i-th feature extracted from the original data x;
[0113] S1.2. All eigenvalues obtained in step S1 are normalized. The normalized expression is:
[0114]
[0115] Where μ is the mean of the data, σ is the standard deviation, and x normalized It is the data after normalization;
[0116] S2. Adopting the edge-peeling clustering algorithm for step S1, repeatedly peeling off the outer layer of data points to find the core of potential clusters, analyzing the hierarchical structure of potential clusters, iteratively estimating boundary points, and associating them with inner points, removing interference points in the rainstorm-induced waterlogging data, and obtaining the rainstorm-induced waterlogging data after removing interference points;
[0117] Furthermore, the specific implementation method of step S2 includes the following steps:
[0118] S2.1. Based on the normalized feature data of step S1, based on the identification of edge points, a data set X with n data nodes is set to be {x1, x2, ...x n}, set the input to be the dissimilarity function δ:R, δ is the Euclidean distance δ used to represent the dissimilarity, X t is the set of data nodes that have not yet been stripped at the tth iteration;
[0119] For each node x i ∈X (t) , use N k (t) (x i ) represents the tth iteration x i node and the set of k-th nearest neighbor nodes, then x i The inverse k nearest neighbors of a node are expressed as:
[0120] RN k (t) (x i )←{x j |x i ∈N k (t) (x j )}
[0121] In order to calculate the distance between the i-th node and the j-th node in the region, the dissimilarity function δ:R is used and solved by the locally scaled Gaussian kernel, which is expressed as:
[0122]
[0123] Among them, f(x i ,x j ) is the Gaussian kernel function of the i-th node and the j-th node, σ j =||x j -N k (t) (x j )[k]||2;
[0124] The Gaussian kernel function is used to calculate the similarity between nodes, where the normalization factor of the Gaussian kernel is the distance of the kth neighbor node set in the data set. This distance can be regarded as a reference value for adjusting the parameters of the Gaussian kernel function so that the similarity between nodes can be better measured. In practical applications, the advantage of this method is that it can effectively handle the differences in the correlation between nodes, thereby more accurately calculating the similarity between nodes;
[0125] Then calculate the expected association b between nodes i (t) , expressed by the following formula:
[0126]
[0127] For each node x in the dataset i ∈X (t) , the boundary classification value of the node is represented by B(t), x i The value of the node is 1 when it is a boundary node, and 0 otherwise;
[0128] The method of realizing the association between each node and the density influence value can be to use a density correlation function, such as a Gaussian kernel function, to convert the distance between each node and other nodes into an association value. The purpose of calculating the density influence value is to measure the influence of a node on the local density of its neighboring nodes. The density influence value is usually represented by a Gaussian kernel function. The basic idea is to use the density influence value of a node as a similarity measure between the node and its neighboring node set. Expected association b i The value of has little impact on the member nodes at the edge of the cluster, but has a greater impact on the member nodes close to the cluster head node.
[0129] Then each time the boundary classification value B is calculated i (t) When the iteration is terminated with a specific value, the expression is:
[0130]
[0131] Among them, π (t) is the fixed value of the attribute of the rainstorm-induced waterlogging data at the t-th iteration, otherwise is other;
[0132] Then calculate the boundary node set X at iteration t B (t) , the expression is:
[0133] X B (t) ={x i ∈X (t) :B i (t) =1};
[0134] Then the data set that has not been stripped at the t+1th iteration is expressed as:
[0135] X (t+1) =X (t) / X B (t) ;
[0136] S2.2. Associate the boundary points identified in step S2.1. At the tth iteration of the dataset, associate these boundary nodes with their non-neighbor nodes and represent them as identified nodes ρ i ∈X (t+1) , the calculation formula is as follows:
[0137]
[0138] Among them, x j is the set of non-boundary nodes closest to x after t iterations i The non-boundary nodes, l i Indicates the spatial variation threshold, 0 means x i is an out-of-cluster node;
[0139] Other distant neighbors are associated to avoid isolated border nodes, but this results in distant clusters being mistakenly merged and marked as out-cluster nodes, i.e., nodes that are not members of any cluster;
[0140] Each boundary node x in the region i When dividing into boundary nodes, first calculate the threshold l i , τ represents the maximum threshold parameter. In each iteration, the value of τ is used as the base point to determine whether the node is a boundary node;
[0141] From the formula Get the k nearest neighbor data node set to x i , the set is defined as NN B,k t (x i ), calculate the threshold l i , the expression is:
[0142]
[0143] Among them, c represents the strictness of the threshold;
[0144] c is a constant, and in this embodiment, c=3. Using an adaptive density threshold can better handle situations where the density in the data set varies greatly, because different data points can have different local densities. Using a constant threshold may result in insufficient or excessive clustering of data points in certain areas, while using an adaptive density threshold can adjust the threshold according to the actual situation of the data set, thereby performing better clustering.
[0145] S2.3 performs self-directed upward clustering on the boundary points associated in step S2.2, starting with each data point as a single cluster, and then gradually merging into larger clusters until an overall cluster is formed. The merging process is as follows:
[0146] Define a cluster head node coordinate Head(x i ,x j )∈X (t+1) , the coordinates of other cluster head nodes are expressed as and Therefore, for (x r ,x r+1 ) in which each two neighbor nodes have the following index: Established.
[0147] S3. Design a YJ-MICPCA algorithm to process the rainstorm waterlogging data obtained in step S2 after removing interference points, including YJ transformation, MIC transformation and PCA dimension reduction, extract the main features of the rainstorm waterlogging data, and obtain the rainstorm waterlogging data after the main features are extracted;
[0148] Furthermore, the specific implementation method of step S3 includes the following steps:
[0149] S3.1. Perform YJ transformation on the rainstorm waterlogging data after removing interference points and reducing noise in step S2. The expression is:
[0150]
[0151] Among them, δ(μ,x) is a function of the data that obeys the Gaussian distribution obtained by YJ transformation of the known data point x, and μ is the unknown parameter to be estimated;
[0152] Converting non-Gaussian distributed data into data that obeys Gaussian distribution to satisfy the Gaussian distribution assumption in PCA can improve the effectiveness and performance of the PCA model.
[0153] S3.2. Perform MIC transformation on the data that obeys Gaussian distribution obtained by YJ transformation in step S3.1 to solve mic(x i ,x j), by simplifying the maximum information coefficient between any two variables, the expression of the maximum information coefficient matrix Q is obtained as follows:
[0154]
[0155] Where M is the square of the maximum mutual information coefficient matrix, M = Q 2 , Q is a symmetric matrix, so Q = Q T , for any vector y, there exists y T My=y T QQ T y=||y T Q|| 2 ≥0, perform eigenvalue decomposition to ensure that the eigenvalues of M are all non-negative;
[0156] The data that obeys Gaussian distribution obtained by performing YJ transformation in step S3.1 are subjected to MIC transformation, so that the nonlinear relationship between the data is converted into a linear relationship. According to the advantage of MIC in measuring the complex relationship between linear, nonlinear and non-functional variables, applying MIC to the PCA algorithm can better handle the complex relationship between the data. In the traditional PCA algorithm, the covariance matrix is used to measure the linear relationship between the data features, but the covariance matrix cannot handle nonlinear and non-functional relationships. In reality, there may be more complex relationships such as nonlinearity and non-function between the data. When using MIC to process the relationship between the data, the covariance matrix needs to be converted into a maximum information matrix. However, the eigenvalue of the maximum information matrix is not necessarily greater than 0, and the eigenvalue needs to be used in PCA for decomposition, so it is necessary to transform the maximum information matrix, square it to obtain a non-negative matrix, denoted as M. This can ensure that the eigenvalue is always greater than 0, so that the PCA algorithm can proceed normally.
[0157] S3.3. Perform PCA dimensionality reduction on the data that satisfy the linear relationship after MIC transformation in step S3.2, extract the eigenvalues, and use X∈R as the sample data. PxN In the formula, P represents the dimension, N represents the amount of sample data, and the expression in the data center is:
[0158]
[0159] Then the calculated new coordinates are {w1,w2,…,w p}, where the standard orthogonal basis is w i It is expressed and satisfies the following formula:
[0160]
[0161] In the process of dimensionality reduction, some dimensions are discarded, and the matrix is shown in the following formula, which represents the standard orthogonal basis:
[0162] w k ={w1,w2,…,w k},k <p and w m {m=1,2,…k};
[0163] The realization is reduced from p dimension to k dimension, and the original sample x is obtained (i) The expression for projection in the k-dimensional feature space is:
[0164] z (i) =(z1 (i) ,z2 (i) ,…,z n (i) ) T
[0165] Among them, x (i) In the k-dimensional coordinate system, the m-dimensional coordinate is expressed as z m (i) =w m T x (i) , extract the important features of the data by projecting the data into a new feature space to reduce the dimension, according to z (i) Feature space reconstruction x (i) , the expression is:
[0166]
[0167] After simplification, the expression is:
[0168]
[0169] Among them, W k * It is to minimize the reconstruction error between the reduced-dimensional data and the original data;
[0170] In PCA, the sample point x is reconstructed by Euclidean distance (i)' and the original sample x (i) The distance between them is calculated by projecting the data into a low-dimensional subspace to reduce the dimensionality of the data and minimizing the reconstruction error between the reduced-dimensional data and the original data. The expression is:
[0171]
[0172] Let X = (x1, x2, ..., x P ), the corresponding eigenvector is (u 1i ,u 2i ,…,u pi , i=1,2,…,p) means, find the formula XX TEigenvalue, eigenvalue decomposition, find the eigenvalue using (μ1,μ2,…,μ p ) represents, then the principal component Z is obtained i for:
[0173] Z i =(u 1i X1+u 2i X2+…+u pi X p ,i=1,2,…,p);
[0174] S4. Construct a CNN urban waterlogging prediction model, and then use the rainstorm waterlogging data after the main feature extraction obtained in step S3 to train the CNN urban waterlogging prediction model to obtain a trained CNN urban waterlogging prediction model for predicting urban waterlogging.
[0175] Furthermore, the specific implementation method of step S4 includes the following steps:
[0176] S4.1. Design a CNN model for the rainstorm waterlogging data after extracting the main features in step S3. The CNN model contains multiple convolutional layers, each of which is used to extract the spatial features of the input data. The calculation formula of the convolutional layer is as follows:
[0177] a l+1 =σ(W l *a l +b l )
[0178] Among them, a l is the activation output of layer l, W l and b l are the weight and bias of the convolutional layer, σ is the nonlinear activation function, and the ReLU function is usually used to enhance the nonlinear expression ability of the model;
[0179] S4.2. Design a pooling layer based on the data calculated by the convolution layer in step S4.1. Each convolution layer is usually followed by a maximum pooling layer to reduce the feature dimension and reduce the amount of calculation. The expression is:
[0180]
[0181] in, is the eigenvalue output by the pooling layer, is the local area in the input feature map;
[0182] S4.3 fully connects the feature data extracted by the maximum pooling layer in step S4.2. The final stage of the network includes at least one fully connected layer, which is responsible for mapping the learned features to the predicted output. The expression is:
[0183] aL =W L-1 a L-1 +b L-1
[0184] Among them, a L is the output of the fully connected layer, L is the index of the layer, and W L-1 and b L-1 are the weights and biases of the fully connected layer;
[0185] S4.4 The CNN model designed in step S4.3 is used to train and test the rainstorm waterlogging data with the main features extracted in step S3 to predict the water depth data at a future time; based on a ten-fold cross-validation strategy, the data set is divided into 9:1, 90% for training and 10% for testing;
[0186] S4.5 Select mean square error MSE, mean absolute error MAE and goodness of fit R 2 As a performance measure, it is used to quantify the difference between the model predictions and the actual observed values;
[0187] The expression of mean square error is:
[0188]
[0189] Among them, y i is the true value of the i-th sample, is the predicted value of the i-th sample;
[0190] The expression of mean absolute error is:
[0191]
[0192] The expression of goodness of fit is:
[0193]
[0194] Embodiment 2:
[0195] An electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of a method for predicting urban waterlogging based on machine learning technology described in Example 1 are implemented.
[0196] The computer device of the present invention may be a device including a processor and a memory, such as a single chip microcomputer including a central processing unit, etc. Moreover, the processor is used to implement the steps of the urban waterlogging prediction method based on machine learning technology when executing the computer program stored in the memory.
[0197] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0198] The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0199] Embodiment 3:
[0200] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for predicting urban waterlogging based on machine learning technology described in Example 1 is implemented.
[0201] The computer-readable storage medium of the present invention can be any form of storage medium that can be read by a processor of a computer device, including but not limited to non-volatile memory, volatile memory, ferroelectric memory, etc. A computer program is stored on the computer-readable storage medium. When the processor of the computer device reads and executes the computer program stored in the memory, the steps of the above-mentioned urban waterlogging prediction method based on machine learning technology can be implemented.
[0202] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0203] It should be noted that relational terms such as "first" and "second" are used only 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. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0204] Although the present application has been described above with reference to specific embodiments, various modifications may be made thereto and parts thereof may be replaced with equivalents without departing from the scope of the present application. In particular, as long as there is no structural conflict, the various features in the specific embodiments disclosed in the present application may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present application is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.
Claims
1. A method for predicting urban waterlogging based on machine learning technology, characterized in that: The steps include: S1. For urban flood events, extract rainstorm waterlogging data from environmental monitoring data, build a mathematical model, and pre-process the collected rainstorm waterlogging data; S2. for the pre-processed rainstorm waterlogging data obtained in step S1, an edge-peeling clustering algorithm is used to repeatedly peel off the outer layer of data points to find the core of potential clusters, analyze the hierarchical structure of potential clusters, iteratively estimate boundary points, and associate them with inner points to remove interference points in the rainstorm waterlogging data, thereby obtaining the rainstorm waterlogging data after removing interference points; S3. Design a YJ-MICPCA algorithm to process the rainstorm waterlogging data obtained in step S2 after removing interference points, including YJ transformation, MIC transformation and PCA dimension reduction, extract the main features of the rainstorm waterlogging data, and obtain the rainstorm waterlogging data after the main features are extracted; S4. Construct a CNN urban waterlogging prediction model, and then use the rainstorm waterlogging data after the main feature extraction obtained in step S3 to train the CNN urban waterlogging prediction model to obtain a trained CNN urban waterlogging prediction model for predicting urban waterlogging.
2. The urban waterlogging prediction method based on machine learning technology according to claim 1 is characterized in that: The specific implementation method of step S1 includes the following steps: S1.
1. Extract rainstorm waterlogging data from environmental monitoring data and construct a mathematical model, which is expressed as follows: Q=P·A·φ Where Q is the runoff volume, P is the rainfall intensity, A is the area of the affected area, and φ is the flow coefficient determined by topography and soil conditions; Define a feature extraction function F(x) to convert the original data x into a set of feature vectors. F(x)=(f1(x),f2(x),...,f m (x)) Among them, f i (x) is the i-th feature extracted from the original data x; S1.
2. All eigenvalues obtained in step S1 are normalized. The normalized expression is: Where μ is the mean of the data, σ is the standard deviation, and x normalized It is the normalized data.
3. The urban waterlogging prediction method based on machine learning technology according to claim 1 or 2, characterized in that: The specific implementation method of step S2 includes the following steps: S2.
1. Based on the normalized feature data of step S1, based on the identification of edge points, a data set X with n data nodes is set to be {x1, x2, ...x n }, set the input to be the dissimilarity function δ:R, δ is the Euclidean distance δ used to represent the dissimilarity, X t is the set of data nodes that have not yet been stripped at the tth iteration; For each node x i ∈X (t) , use N k (t) (x i ) represents the tth iteration x i node and the set of k-th nearest neighbor nodes, then x i The inverse k nearest neighbors of a node are expressed as: RN k (t) (x i )←{x j |x i ∈N k (t) (x j )} In order to calculate the distance between the i-th node and the j-th node in the region, the dissimilarity function δ:R is used and solved by the locally scaled Gaussian kernel, which is expressed as: Among them, f(x i ,x j ) is the Gaussian kernel function of the i-th node and the j-th node, σ j =||x j -N k (t) (x j )[k]||2; Then calculate the expected association b between nodes i (t) , expressed by the following formula: For each node x in the dataset i ∈X (t) , the boundary classification value of the node is represented by B(t), x i The value of the node is 1 when it is a boundary node, and 0 otherwise; Then each time the boundary classification value B is calculated i (t) When the iteration is terminated with a specific value, the expression is: Among them, π (t) is the fixed value of the attribute of the rainstorm-induced waterlogging data at the t-th iteration, otherwise is other; Then calculate the boundary node set X at iteration t B (t) , the expression is: X B (t) ={x i ∈X (t) :B i (t) =1}; Then the data set that has not been stripped at the t+1th iteration is expressed as: X (t+1) =X (t) / X B (t) ; S2.
2. Associate the boundary points identified in step S2.
1. At the tth iteration of the dataset, associate these boundary nodes with their non-neighbor nodes to represent the identified nodes ρ i ∈X (t+1) , the calculation formula is as follows: Among them, x j is the set of non-boundary nodes closest to x after t iterations i The non-boundary nodes, l i Indicates the spatial variation threshold, 0 means x i is an out-of-cluster node; Other distant neighbors are associated to avoid isolated border nodes, but this results in distant clusters being mistakenly merged and marked as out-cluster nodes, i.e., nodes that are not members of any cluster; Each boundary node x in the region i When dividing into boundary nodes, first calculate the threshold l i , τ represents the maximum threshold parameter. In each iteration, the value of τ is used as the base point to determine whether the node is a boundary node; From the formula Get the k nearest neighbor data node set to x i , the set is defined as NN B,k t (x i ), calculate the threshold l i , the expression is: Among them, c represents the strictness of the threshold; S2.3 performs self-directed upward clustering on the boundary points associated in step S2.2, starting with each data point as a single cluster, and then gradually merging into larger clusters until an overall cluster is formed. The merging process is as follows: Define a cluster head node coordinate Head(x i ,x j )∈X (t+1) , the coordinates of other cluster head nodes are expressed as and Therefore, for (x r ,x r+1 ) in which each two neighbor nodes have the following index: Established.
4. The urban waterlogging prediction method based on machine learning technology according to claim 3 is characterized in that: The specific implementation method of step S3 includes the following steps: S3.
1. Perform YJ transformation on the rainstorm waterlogging data after removing interference points and reducing noise in step S2. The expression is: Among them, δ(μ,x) is a function of the data that obeys the Gaussian distribution obtained by YJ transformation of the known data point x, and μ is the unknown parameter to be estimated; S3.
2. Perform MIC transformation on the data that obeys Gaussian distribution obtained by YJ transformation in step S3.1 to solve mic(x i ,x j ), by simplifying the maximum information coefficient between any two variables, the expression of the maximum information coefficient matrix Q is obtained as follows: Where M is the square of the maximum mutual information coefficient matrix, M = Q 2 , Q is a symmetric matrix, so Q = Q T , for any vector y, there exists y T My=y T QQ T y=||y T Q|| 2 ≥0, perform eigenvalue decomposition to ensure that the eigenvalues of M are all non-negative; S3.
3. Perform PCA dimensionality reduction on the data that satisfy the linear relationship after MIC transformation in step S3.2, extract the eigenvalues, and use X∈R as the sample data. PxN In the formula, P represents the dimension, N represents the amount of sample data, and the expression in the data center is: Then the calculated new coordinates are {w1,w2,…,w p }, where the standard orthogonal basis is w i It is expressed as, and satisfies the following formula: In the process of dimensionality reduction, some dimensions are discarded, and the matrix is shown in the following formula, which represents the standard orthogonal basis: w k ={w1,w2,…,w k },k<p and w m {m=1,2,…k}; The realization is reduced from p dimension to k dimension, and the original sample x is obtained (i) The expression for projection in the k-dimensional feature space is: With (i) =(z1 (i) ,z2 (i) ,…,With n (i) ) T Among them, x (i) In the k-dimensional coordinate system, the m-dimensional coordinate is expressed as z m (i) =w m T x (i) , extract the important features of the data by projecting the data into a new feature space to reduce the dimension, according to z (i) Feature space reconstruction x (i) , the expression is: After simplification, the expression is: Among them, W k * It is to minimize the reconstruction error between the reduced-dimensional data and the original data; In PCA, the sample point x is reconstructed by Euclidean distance (i)’ and the original sample x (i) The distance between them is calculated by projecting the data into a low-dimensional subspace to reduce the dimensionality of the data and minimizing the reconstruction error between the reduced-dimensional data and the original data. The expression is: Let X = (x1, x2, ..., x P ), the corresponding eigenvector is (u 1i ,u 2i ,…,u pi , i=1,2,…,p) means, find the formula XX T Eigenvalue, eigenvalue decomposition, find the eigenvalue using (μ1,μ2,…,μ p ) represents, then the principal component Z is obtained i for: Z i =(u 1i X1+u 2i X2+…+u pi X p ,i=1,2,…,p).
5. The urban waterlogging prediction method based on machine learning technology according to claim 4 is characterized in that: The specific implementation method of step S4 includes the following steps: S4.
1. Design a CNN model for the rainstorm waterlogging data after extracting the main features in step S3. The CNN model contains multiple convolutional layers, each of which is used to extract the spatial features of the input data. The calculation formula of the convolutional layer is as follows: a l+1 =σ(W l *a l +b l ) Among them, a l is the activation output of layer l, W l and b l are the weight and bias of the convolutional layer, σ is the nonlinear activation function, and the ReLU function is usually used to enhance the nonlinear expression ability of the model; S4.
2. Design a pooling layer based on the data calculated by the convolution layer in step S4.
1. Each convolution layer is usually followed by a maximum pooling layer to reduce the feature dimension and reduce the amount of calculation. The expression is: in, is the eigenvalue output by the pooling layer, is the local area in the input feature map; S4.3 fully connects the feature data extracted by the maximum pooling layer in step S4.
2. The final stage of the network includes at least one fully connected layer, which is responsible for mapping the learned features to the predicted output. The expression is: a L =W L-1 a L-1 +b L-1 Among them, a L is the output of the fully connected layer, L is the index of the layer, and W L-1 and b L-1 are the weights and biases of the fully connected layer; S4.4 The CNN model designed in step S4.3 is used to train and test the rainstorm waterlogging data with the main features extracted in step S3 to predict the water depth data at a future time; based on a ten-fold cross-validation strategy, the data set is divided into 9:1, 90% for training and 10% for testing; S4.5 Select mean square error MSE, mean absolute error MAE and goodness of fit R 2 As a performance measure, it is used to quantify the difference between the model predictions and the actual observed values; The expression of mean square error is: Among them, y i is the true value of the i-th sample, is the predicted value of the i-th sample; The expression of mean absolute error is: The expression of goodness of fit is:
6. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of a method for predicting urban waterlogging based on machine learning technology as described in any one of claims 1 to 5 when executing the computer program.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for predicting urban waterlogging based on machine learning technology described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Urban rainstorm waterlogging rapid simulation method based on deep convolutional neural network
CN116702627A
Urban inland inundation simulation method based on topographic feature deep learning
CN116933621A
