Flood disaster prediction method based on multi-layer perceptron (MLP) model
By combining a multi-layer perceptron (MLP) model with a variety of data processing and analysis techniques, the shortcomings of existing flood prediction algorithms in feature selection and computational complexity are addressed, achieving high-precision flood disaster prediction and risk assessment, and supporting scientific decision-making and disaster management.
Patent Information
- Application Number
- CN202510836788.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-22
- Publication Date
- 2025-09-16
AI Technical Summary
Existing flood prediction algorithms are relatively simple in feature selection, making it difficult to screen out the key features that have the greatest impact on the probability of flood occurrence. This results in limited model prediction accuracy and high computational complexity, making it difficult to meet real-time prediction needs.
A multi-layer perceptron (MLP) model is used in combination with data preprocessing, feature selection, model construction and optimization, flood risk level classification and visualization technology. Through missing value processing, outlier detection, correlation analysis, factor analysis, decision tree analysis, K-means clustering and random forest algorithm, an accurate flood disaster prediction model is constructed to improve prediction accuracy and stability.
It has significantly improved the accuracy of flood predictions, achieved refined grading of flood risks, provided scientific decision-making support for the government and relevant departments, and reduced flood disaster losses.
Smart Images

Figure BDA0005460886560000071 
Figure BDA0005460886560000101 
Figure BDA0005460886560000113
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of flood disaster prediction, and in particular to a flood disaster prediction method based on a multi-layer perceptron (MLP) model, which is suitable for early warning and risk assessment of flood disasters. Background Art
[0002] Floods, a major disaster triggered by the natural environment, are known for their high incidence, destructive power, and widespread impact. As global temperatures rise, the frequency and intensity of floods are increasing, posing a significant threat to both human society and the ecological environment.
[0003] In recent years, with the rapid development of machine learning technology, flood prediction methods based on machine learning have gradually become a research hotspot. While existing algorithms can process high-dimensional data and capture complex nonlinear relationships, they are relatively simple in feature selection, making it difficult to effectively screen out the key features that most influence flood probability, resulting in limited model prediction accuracy. Some algorithms, such as support vector machines (SVMs), have high computational complexity when processing large amounts of data, making them difficult to meet the requirements of real-time prediction.
[0004] In response to the shortcomings of existing algorithms, the present invention proposes a flood disaster prediction method and system based on the multi-layer perceptron (MLP) model, which can not only significantly improve the accuracy of flood prediction, but also provide scientific decision-making support for the government and relevant departments, and reduce the losses caused by flood disasters. Summary of the Invention
[0005] The present invention comprises a data preprocessing module, a feature selection module, a model construction and training module, a model evaluation and optimization module, a flood risk level classification module and a flood prediction and visualization module.
[0006] A flood disaster prediction method based on a multi-layer perceptron (MLP) model mainly includes the following steps:
[0007] S1: Data preprocessing
[0008] Missing Value Handling: We performed missing value detection on the flood disaster dataset, using Python and MATLAB combined with the find function to perform a thorough search and handle missing values. To more intuitively demonstrate the distribution of missing items, we also generated a histogram of the number of missing values. The results showed that there were no missing values in the dataset.
[0009] Outlier detection and processing: Use box plots and kernel density (KDE) estimation plots to identify outliers in the data. By calculating the range of each feature index and removing rows with feature values greater than 10, data accuracy is ensured.
[0010] Data visualization: Display the data distribution through histograms and kernel density (KDE) estimation plots, identify the multimodal distribution characteristics of the data, and provide guidance for subsequent data analysis.
[0011] S2: Feature Selection
[0012] Correlation Analysis: The Spearman correlation coefficient was used to calculate the correlation between each characteristic indicator and flood probability. A Spearman correlation matrix heat map and bar chart were generated to screen for characteristic indicators that were highly correlated with flood probability. The preprocessed data was constructed into a linear regression scatter plot, and linear regression analysis was used to further verify the linear relationship between each characteristic indicator and flood probability.
[0013] Factor Analysis: Factor analysis techniques are used to extract common factors from the original features, simplifying the interpretation and understanding of the data. Using the factor loading matrix, the key factors that have the greatest impact on flood probability are identified. Heat maps of the factor loading matrix are generated to visually demonstrate the impact of each factor on flood probability.
[0014] Decision Tree Analysis: A decision tree model was used to perform feature importance analysis, identifying the key features that most significantly impact flood probability. A post-pruning strategy was implemented to improve the model's generalization performance and reduce its complexity. A feature importance histogram was generated to visually demonstrate the impact of each feature on flood probability.
[0015] S3: Model building and training
[0016] Model Construction: Build a multilayer perceptron (MLP) model, consisting of an input layer, hidden layers, and an output layer. The number of neurons in the hidden layers is 64 and 32, respectively. The ReLU function is used as the activation function, and the Adam optimizer is used. A maximum number of iterations is set at 500 to ensure that the model fully captures the data characteristics.
[0017] Model training: The data set is divided into a training set and a validation set in a ratio of 8 to 2 to ensure that the model can fully learn the inherent laws of the data during the training process, while at the same time the generalization ability of the model can be evaluated through the validation set to avoid overfitting. 2 ) is used as an evaluation indicator to assess the fit of the regression model.
[0018] Model optimization: L2 regularization strategy is adopted to further improve the performance and generalization ability of the model.
[0019] S4: Flood risk classification
[0020] K-means cluster analysis: K-means cluster analysis was used to cluster the flood probability of each event into three risk categories: high, medium, and low. By calculating the mean of each cluster center, the characteristic distribution of different risk levels was identified. A scatter plot of the clustering results was generated to visually display the distribution of flood events at different risk levels.
[0021] Feature Importance Analysis: A random forest algorithm was used to assess the importance of various indicators and clarify the importance of flood-influencing factors. A clustering mean plot based on cluster analysis visualized the specific performance of each feature in the cluster analysis. A radar chart of important features was generated to visually display the distribution of key features at different risk levels, enabling a comprehensive, multi-dimensional assessment of flood risk.
[0022] Sensitivity analysis: Perform a sensitivity analysis on the initially constructed prediction model to assess the impact of different feature weights on the model's prediction results and identify the key features that are most decisive for flood prediction. By adjusting feature weights, the model's prediction accuracy and stability can be further optimized.
[0023] S5: Flood Prediction and Visualization
[0024] It is used to predict the probability of flood occurrence for the test dataset using the trained MLP model and visualize the prediction results through histograms and line graphs.
[0025] The Shapiro-Wilk normality test method was used to test the distribution characteristics of the predicted data to ensure the reliability of the prediction results. Beneficial effects
[0026] This paper constructs a flood disaster prediction model using a multi-layer perceptron (MLP) neural network, accurately capturing the complex nonlinear relationship between flood probability and multiple factors, significantly improving prediction accuracy. Combined with the K-means clustering and random forest algorithms, it enables refined flood risk classification and assessment, providing a scientific basis for flood disaster prevention and control, helping to formulate appropriate response strategies in advance and effectively reducing flood disaster losses.
[0027] The flood disaster prediction model proposed in this paper has broad applicability and can perform in-depth analysis based on regional data, providing support for flood warnings in various regions. Its core data processing and analysis techniques, including data preprocessing, feature selection, model training, and optimization, provide a solid foundation for improving prediction accuracy. Furthermore, the integration of this model with Geographic Information System (GIS) technology enables refined assessment of flood risks in different regions, providing strong support for urban planning and disaster management, demonstrating strong potential for widespread adoption and practical value. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram of a flood disaster prediction method based on a multi-layer perceptron (MLP) model according to the present invention;
[0029] Figure 2 This is a detailed algorithm step diagram of a flood disaster prediction method based on a multi-layer perceptron (MLP) model of the present invention. Specific implementation
[0030] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described below with reference to 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 intended to limit the present invention. 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.
[0031] A flood disaster prediction method and system based on a multi-layer perceptron (MLP) model includes the following steps:
[0032] S1. Data preprocessing:
[0033] Step (1) Missing value processing:
[0034] Check missing values: Use Python’s isnull() and sum() functions to count the number of missing values for each feature, and use visualization tools to display the distribution of missing values.
[0035] Handling Missing Values: Appropriate methods should be used to handle missing values based on the dataset. For example, if there are few missing values, rows containing them can be deleted. If there are many missing values, methods such as the mean, median, or mode can be considered for imputation. In this study, no missing values were found in the dataset, so no further imputation was required.
[0036] Step (2) Outlier Detection
[0037] Draw a box plot: Use a box plot to visually display the distribution of each feature, including the median, quartiles, and outliers. The box plot can clearly identify outliers in the data.
[0038] Calculate the range of values: Based on the interquartile range (IQR) of the boxplot, calculate the range of values for each feature and identify outliers that fall outside the normal range. In this study, we found that some features had a large range of values, including some with values greater than 18. Therefore, we deleted all rows with feature attribute values greater than 18.
[0039] S2. Feature Selection
[0040] The purpose of feature selection is to screen out key features that have a significant impact on the probability of flood occurrence from a large number of features, thereby improving the predictive ability and interpretability of the model.
[0041] Step (1) Calculate the Spearman correlation coefficient
[0042] Correlation Analysis: The Spearman correlation coefficient is used to calculate the correlation between each characteristic and flood probability. The Spearman correlation coefficient is applicable to non-normally distributed data and effectively measures the monotonic relationship between variables. The resulting correlation coefficient matrix provides a visual representation of the correlation between each characteristic and flood probability. The closer the absolute value of the Spearman correlation coefficient is to 1, the stronger the correlation. Conversely, a value closer to 0 indicates a weakening correlation. The calculation formula of Spearman correlation coefficient ρ is:
[0043] Visualizing Correlation: The correlation coefficient matrix is visualized as a heat map, with warmer colors indicating stronger correlations and cooler colors indicating weaker correlations. A bar chart can also be used to display the correlation between each feature and flood probability, making it easier to identify key features.
[0044] Step (2) Factor extraction
[0045] Common Factors: Factor analysis is a dimensionality reduction technique that simplifies the data structure by extracting common factors. By reducing individual characteristic indicators to a smaller number of factors, we can reveal underlying patterns or structures in the data. In this study, we extracted five factors through factor analysis and plotted a factor loading matrix to show the loading of each factor on each characteristic.
[0046] Select important features: Based on the factor loading matrix, select features with high loadings on each factor as important features. These features play an important role in explaining data variability and correlation and can serve as key input variables for subsequent model construction.
[0047] Step (3) Decision tree model
[0048] Building a decision tree: A decision tree model recursively divides a dataset into smaller subsets to minimize classification or prediction errors. In this study, a decision tree model was used to classify the data, and a post-pruning strategy was used to optimize the model to reduce model complexity and the risk of overfitting.
[0049] Assessing feature importance: Decision tree models can output a ranking of feature importance. By analyzing the decision tree structure and feature importance, we can identify features that have a significant impact on flood probability. In this study, we found that features such as ineffective disaster prevention, terrain drainage, and dam quality have a significant impact on flood probability.
[0050] S3. Model construction and training
[0051] The Multilayer Perceptron (MLP) model is a feedforward neural network that can learn complex nonlinear relationships between input features and output targets.
[0052] Step (1) Build the MLP model
[0053] Model architecture design: Design the architecture of the MLP model, including the input layer, hidden layer, and output layer. In this study, the model has two hidden layers with 64 and 32 neurons respectively, and uses the ReLU activation function to enhance the nonlinear learning ability of the model. Neuron: Contains a linear transformation with weights and biases, and an activation function (usually, the input layer does not use an activation function, and the hidden layer and output layer use an activation function) to introduce nonlinearity, so that the neural network can arbitrarily approximate any nonlinear function, so that the neural network can be used in more nonlinear models. Hidden layer neurons: Assume that the input layer uses vector The output of the hidden layer is Function f can be a sigmoid function or a tanh function, w1 is the weight (connection coefficient), and b1 is the bias.
[0054] The output of the output layer is: softmax(w2×x1+b2), where x1 is the output of the hidden layer. Data from the input layer undergoes nonlinear transformations through multiple hidden layers before reaching the output layer for classification or regression, completing the MLP training process.
[0055] Optimizer selection: Choose an appropriate optimizer for model weight updates. In this study, the Adam optimizer was used, which combines the advantages of the momentum method and RMSprop. It can automatically adjust the learning rate of each parameter to achieve efficient and stable convergence.
[0056] Step (2) Model training
[0057] Data partitioning: Divide the dataset into a training set and a validation set, usually in an 8:2 ratio. The training set is used to train the model, while the validation set is used to evaluate the model's generalization ability and prevent overfitting.
[0058] Training process: The MLP model is trained using the training set data. The weights and biases of the model are adjusted by iteratively optimizing the loss function. During training, the changes in training loss and validation loss are recorded to monitor the training progress and performance of the model.
[0059] Step (3) L2 regularization optimization
[0060] Adding a regularization term: To prevent overfitting and improve generalization, add an L2 regularization term to the model's loss function. L2 regularization penalizes the sum of the squares of the model's weights, encouraging the model to choose smaller weights, thereby reducing model complexity.
[0061] Adjust the regularization parameter: Select an appropriate regularization parameter α through cross-validation and other methods to balance the bias and variance of the model. In this study, α = 0.001 was selected as the regularization parameter. The optimized model had a mean square error and coefficient of determination (R 2 ) have improved.
[0062] S4. Model Evaluation and Optimization
[0063] Step (1) Evaluation indicator selection
[0064] Mean Squared Error (MSE): The mean squared error (MSE) is a commonly used metric to measure the difference between a model's predicted value and the true value. A smaller value indicates a higher prediction accuracy. In this study, the mean squared error (MSE) was calculated for both the training and test sets to evaluate the model's predictive performance on different datasets.
[0065] Coefficient of determination (R 2 The coefficient of determination (CDR) measures how well the model fits the data. Its value ranges from 0 to 1, with values closer to 1 indicating a better fit. By calculating the CDR for the training and test sets, you can gain an intuitive understanding of the model's ability to explain the data.
[0066] Step (2) Analysis of evaluation results
[0067] Comparing training and test set performance: By comparing the mean squared error (MSE) and coefficient of determination (CDR) of the training and test sets, we assessed whether the model was overfitting or underfitting. In this study, the optimized model achieved a mean squared error of 0.00036912 on the training set and 0.00036816 on the test set, and a CDR of 0.85331226 and 0.85271417, respectively, demonstrating good generalization and prediction accuracy.
[0068] Model optimization: Based on the evaluation results, further analyze the model's shortcomings and propose optimization directions. For example, if the model has large prediction errors on certain features, consider adding feature engineering or adjusting the model architecture. If the model's generalization ability is insufficient, try increasing the regularization strength or adjusting the training parameters.
[0069] S5. Flood risk classification
[0070] Step (1) K-means clustering algorithm Suppose there is a set of data points {x1,x2,…,x n}, where each data point Represents a data point in d-dimensional space. Randomly select K initial cluster centers {c1,c2,…,c K}, where each is a d-dimensional vector. For each data point x i , calculate its relationship with each cluster center c j Distance (usually using Euclidean distance): x i Assign to the nearest cluster center c j , where j * =argmin j dist(x i ,c j ). For each cluster j = 1, 2, ..., K, update its cluster center c j , is the mean of all data points assigned to this cluster: Among them, |C j | represents the number of data points in cluster j, C j Represents the set of data points assigned to cluster j. Repeat steps 2 and 3. Repeat the assignment and update phases until the convergence condition is reached. The convergence condition usually means that the cluster center no longer changes or changes very little. The final output is K cluster centers {c1, c2, ..., c K}, and the cluster label to which each data point belongs.
[0071] Select key features: Based on the previous feature selection results, select features related to flood risk as input variables for clustering. In this study, multiple key factors were selected as the basis for clustering.
[0072] Determine cluster centers: Use the K-means clustering algorithm to classify flood events into three risk levels: high, medium, and low. First, randomly select K initial cluster centers. Then, through iterative optimization of the cluster centers, assign data points to the nearest cluster center until convergence.
[0073] Step (2) Weighted Scoring Model
[0074] Establish a weighted scoring system: To quantify the risk level of each flood event, a weighted scoring model was developed. Based on expert knowledge, historical data analysis, and statistical tests, weights were assigned to each key characteristic to comprehensively consider their impact on flood risk.
[0075] Risk classification: A risk score for each flood event is calculated based on a weighted scoring model, categorizing each event into three risk levels: high, medium, and low. In this study, the risk classification model was optimized by adjusting the weights of key features, and the model's stability and accuracy were verified through sensitivity analysis.
[0076] S6. Flood prediction and visualization Use the trained MLP model to predict flood probability for the test data set in test.csv, and record and save the prediction results in the submit.csv file. Draw a line chart and a histogram of the flood probability prediction for the test set. The line chart shows the trend of flood probability as a function of sample points, and the histogram shows the distribution of predicted probabilities. Use the matplotlib library to draw the chart. Use the Shapiro-Wilk normality test method to evaluate the distribution characteristics of the predicted data. First, sort the data to generate a sequence of order statistics and calculate the test statistic. and the corresponding p-value. The calculated test statistic, W, for the predicted data in this study was 0.980, and the p-value was 0.000. Based on the sample data, the null hypothesis was rejected, indicating that the data did not follow a normal distribution. A normality test was performed using the scipy.stats library.
Claims
1. A flood disaster prediction method based on a multi-layer perceptron (MLP) model mainly includes the following steps: S1. Data Preprocessing Used to preprocess flood disaster datasets, including missing value processing, outlier detection and data standardization; S2. Feature Selection Calculate the Spearman correlation coefficient and use factor analysis and decision tree models to perform dimensionality reduction. This method can identify the key influencing factors of flood disasters and propose countermeasures and suggestions for dealing with flood problems. S3. Model construction and training Used to build a multi-layer perceptron (MLP) model and optimize the model using L2 regularization technology; S4. Model Evaluation and Optimization For using mean square error and coefficient of determination (R 2 ) is used as the evaluation index of the model to evaluate the prediction performance of the model; S5. Flood risk classification Used to classify flood events into three risk levels: high, medium, and low using the K-means clustering algorithm; S6. Flood prediction and visualization It is used to predict the probability of flood occurrence for the test dataset using the trained MLP model and visualize the prediction results through histograms and line graphs.
2. The algorithm according to claim 1, characterized in that: (1) Step S1 includes using box plots, histograms, and kernel density estimation plots to identify and process outliers and noise in the data; (2) Step S2 includes using stepwise regression and feature selection algorithms to further optimize the feature set and reduce redundant features; (3) In step S3, the number of hidden layer neurons of the MLP model is 64 and 32 respectively, the activation function uses the ReLU function, and the optimizer uses the Adam optimizer; (4) Step S4 performs sensitivity analysis on the model to evaluate the impact of different features on the model prediction results; (5) Step S5 includes constructing a weighted scoring model to quantitatively assess the risk level of each flood event; (6) Step S6 includes performing a normality test on the distribution characteristics of the predicted data using the Shapiro-Wilk test method.
Citation Information
Cited By
A flood flow prediction model construction method
CN122634338A