A machine learning-based early prediction method for flood disasters in a watershed
By introducing a dynamic smoothing coefficient adaptive adjustment mechanism and a multi-objective optimization fruit fly optimization algorithm into the prediction of watershed flood disasters, the problems of prediction accuracy and adaptability of traditional models in complex environments have been solved, and higher accuracy and stability of precipitation prediction and flood disaster early warning have been achieved.
Patent Information
- Application Number
- CN202510580265.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-05-07
AI Technical Summary
Traditional river basin flood disaster prediction methods struggle to accurately capture precipitation trends when faced with complex and ever-changing meteorological and geographical environments, resulting in limited prediction accuracy. Furthermore, unreasonable hyperparameter settings in flood disaster early warning models lead to poor adaptability and unstable prediction results.
A precipitation prediction model is constructed using the Holt-Winters three-parameter model with a dynamic smoothing coefficient adaptive adjustment mechanism and a bidirectional long short-term memory network. Hyperparameters are optimized in the decision tree model by combining the fruit fly optimization algorithm and Pareto optimization with multi-objective optimization. A composite objective function is designed to improve the model's adaptability and generalization ability.
It improves the accuracy of precipitation forecasting and the adaptability of flood disaster early warning, enabling stable and accurate forecasting in different river basins and time periods.
Smart Images

Figure CN120409822B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of flood disaster prediction, in particular to a watershed flood disaster early prediction method based on machine learning. BACKGROUND
[0002] Flood disaster prediction is a technical means for predicting the possibility, scale, and time of flood occurrence by analyzing, monitoring, and simulating various factors such as historical flood data, meteorological data, topography, river hydrological characteristics, soil type, and vegetation coverage. In traditional watershed flood disaster prediction, when predicting rainfall, it is often difficult to accurately capture the trend of precipitation changes in the face of complex and variable weather and geographical environment, and it is difficult to fully consider the influence of seasonality, trend, and sudden events in time series data on precipitation. Although some physical models consider physical processes, errors in parameter estimation and simplification of complex environments also limit the prediction accuracy. In flood disaster warning, some simple classification models only rely on a single indicator for judgment, ignoring the comprehensive influence of other related factors, while some complex models consider multiple factors, but the setting of model hyperparameters is often not reasonable, leading to poor model adaptability and unstable prediction results in different watersheds or different times. SUMMARY
[0003] In view of the above, in order to overcome the defects of the prior art, the present application provides a flood disaster early prediction method for a watershed based on machine learning. In the traditional watershed flood disaster prediction, when predicting rainfall, it is often difficult to accurately capture the change trend of precipitation when facing complex and variable meteorological and geographical environments, and it is difficult to fully consider the influence of seasonality, trend and sudden events in time series data on precipitation. Although some physical models consider physical processes, errors in parameter estimation and simplification of complex environments also limit the prediction accuracy. The present scheme introduces a dynamic smoothing coefficient adaptive adjustment mechanism in the Holt-Winters three-parameter model, calculates the smoothing level, trend change rate and seasonal component of the current time series data, automatically adjusts the smoothing coefficient according to the real-time changes of the data, and combines a bidirectional long short-term memory network to build a precipitation prediction model, which can capture the change characteristics of recent data in time and further improve the accuracy of precipitation prediction. In flood disaster warning, some simple classification models only rely on a single indicator for judgment, ignoring the comprehensive influence of other related factors, while some complex models consider multiple factors, but the setting of the model's hyperparameters is often not reasonable, resulting in poor model adaptability and unstable prediction effect in different watersheds or different times. The present scheme introduces a multi-objective optimization fruit fly optimization algorithm into the decision tree model, selects the optimal parameter combination to update the global optimal solution, designs a composite objective function, and comprehensively considers the accuracy, model complexity and training time of the decision tree, while introducing Pareto optimization to avoid the optimization result falling into a local optimal solution, ensuring that a balance is found among multiple objectives while obtaining parameter combinations with different characteristics, further improving the adaptability and generalization ability of the model.
[0004] The technical scheme adopted by the present application is as follows: The present application provides a flood disaster early prediction method for a watershed based on machine learning, which specifically includes the following steps:
[0005] Step S1: Data acquisition, acquire meteorological data, hydrological data, precipitation and historical flood disaster data in the watershed in chronological order to form a source data set, fill in the missing values of numerical data in the source data set using the mean value, process the missing values of categorical data in the source data set using one-hot encoding, and detect and process the outliers in the source data set using the interquartile range method;
[0006] Step S2: Data structuring, the data in the source data set is time series data, the source data is cut into input windows and target values by using a sliding window technique, the window length is set as a preset time period, the target value is the water level of the next day, training samples are generated, the same period data is associated by taking years as a cycle, the meteorological data and hydrological data in the source data set are taken as features, and the historical flood disaster data is taken as a label, and the features of numerical values are subjected to Min-Max normalization;
[0007] Step S3: Constructing a precipitation prediction model, introducing a dynamic smoothing coefficient self-adaptive adjustment mechanism into a Holt-Winters three-parameter model, and using a bidirectional long short-term memory network to predict precipitation;
[0008] Step S4: Constructing a flood disaster grading model, introducing a multi-objective optimization fruit fly optimization algorithm into a decision tree model, optimizing the hyperparameters in the decision tree, making the flood disaster grading model predict flood disasters and grade them;
[0009] Step S5: Flood disaster warning, collecting real-time meteorological data and hydrological data, inputting the data into the precipitation prediction model to predict precipitation, and inputting the real-time meteorological data, hydrological data and predicted precipitation into the flood disaster grading model to predict flood disasters and grade them.
[0010] Further, step S3: constructing a precipitation prediction model, specifically comprising the following steps:
[0011] Step S31: Adopting a Holt-Winters three-parameter model to de-seasonize and extract trends from time series data, the Holt-Winters three-parameter model including three smoothing functions, namely a level function, a trend function and a seasonal function, using the level function to calculate the smoothing level of the current time series data, using the trend function to calculate the trend change rate of the current time series data, and using the seasonal function to extract the seasonal component of the current time series data, the formula being as follows:
[0012] ;
[0013] ;
[0014] ;
[0015] In the formula, is the smoothing level at the time step , is the trend change rate at the time step , is the seasonal component at the time step , is the time step, , and is a dynamically smoothed coefficient of adaptive adjustment in the interval [0, 1], when the dynamically smoothed coefficient is 1, it means analyzing the current time series data, when the dynamically smoothed coefficient is 0, it means predicting the current time series data, is the historical flood disaster data at time step is the seasonal cycle length;
[0016] Step S32: A long short-term memory network is constructed and initialized, and the source data set is input into the long short-term memory network for training. A forget gate, an input gate and an output gate are set for each layer of the long short-term memory network. The forget gate determines the discard proportion of historical information, the input gate generates a new candidate state, and the output gate outputs the current hidden layer state. The used formula is as follows:
[0017] ;
[0018] In the formula, is an output function of the forget gate, the input gate and the output gate at time step is a Sigmoid function, is a weight matrix of the forget gate, the input gate and the output gate at time step is a hidden state at time step is an input of the long short-term memory network at time step is a bias term at time step
[0019] Step S33: An exponential smoothing seasonal factor and a trend term are introduced into the output layer of the long short-term memory network, and the rainfall is predicted. The used formula is as follows:
[0020] ;
[0021] In the formula, is the rainfall predicted by the output layer of the long short-term memory network.
[0022] Further, step S4: a flood disaster grading model is constructed, specifically including the following steps:
[0023] Step S41: initialization, a decision tree model is established and initialized as the flood disaster grading model, the source data set is input into the flood disaster grading model for training, and a fruit fly optimization algorithm is used to optimize the hyperparameters of the decision tree. The parameter space of the decision tree is defined, each fruit fly individual corresponds to a set of candidate parameter combinations, and the fruit fly population size and the maximum iteration number are preset.
[0024] Step S42: olfactory search generates a new position, and the fruit fly individual generates a new parameter combination through random disturbance, and a random offset is added to the current candidate parameter, and the formula is as follows:
[0025] ;
[0026] ;
[0027] In the formula, and is the new coordinate of the fruit fly, is the index of the fruit fly, and is the coordinate of the initial position of the fruit fly, is a random disturbance factor, and the value range is [-1, 1], is the random flight range of the fruit fly, that is, the search step;
[0028] Step S43: visual search, evaluate the accuracy of each parameter combination through cross-validation, select the optimal parameter combination to update the global optimal solution, and adjust the search direction of the fruit fly;
[0029] Step S44: dynamically adjust the search range, dynamically reduce the search range according to the number of iterations and the quality of the current optimal solution, set the optimization iteration threshold, if the global optimal solution is still not improved after continuously exceeding the optimization iteration threshold times of iteration, reduce the search step, and if the improvement is significant, enlarge the search step, and reserve the optimal 10% fruit flies for the next iteration;
[0030] Step S45: multi-objective optimization fusion, design a composite objective function, and the formula is as follows:
[0031] ;
[0032] In the formula, is the composite objective function, , and is the weight coefficient, is the accuracy of the decision tree, is the model complexity of the decision tree, is the training time of the decision tree;
[0033] Step S46: Pareto optimization, calculate the crowding degree of each parameter combination in the preset target space, and the crowding degree is the sum of the normalized distances of each parameter combination in the target space and other adjacent parameter combinations, and the parameter combination with the most diversity is selected through crowding degree sorting.
[0034] The beneficial effects obtained by the above scheme are as follows:
[0035] (1) In the traditional prediction of basin flood disasters, when predicting rainfall, it is often difficult to accurately capture the trend of precipitation changes in the face of complex and variable meteorological and geographical environments, and it is difficult to fully consider the influence of seasonality, trend and sudden events in time series data on precipitation. Although some physical models consider physical processes, errors in parameter estimation and simplification of complex environments also limit the prediction accuracy. The scheme introduces a dynamic smoothing coefficient self-adaptive adjustment mechanism in the Holt-Winters three-parameter model, calculates the smoothing level, trend change rate and seasonal component of the current time series data respectively, automatically adjusts the smoothing coefficient according to the real-time changes of the data, and combines a bidirectional long short-term memory network to build a precipitation prediction model, which can capture the characteristics of recent data changes in time and further improve the accuracy of precipitation prediction;
[0036] (2) In the flood disaster early warning, some simple classification models only rely on a single indicator for judgment, ignoring the comprehensive influence of other related factors, while some complex models consider multiple factors, but the setting of model hyperparameters is often not reasonable, resulting in poor model adaptability and unstable prediction effect in different basins or different times. The scheme introduces a multi-objective optimization fruit fly optimization algorithm into the decision tree model, selects the optimal parameter combination to update the global optimal solution, designs a composite objective function to consider the accuracy, model complexity and training time of the decision tree, and introduces Pareto optimization to avoid the optimization result falling into a local optimal solution, ensuring that a balance is found between multiple objectives while obtaining parameter combinations with different characteristics, further improving the adaptability and generalization ability of the model BRIEF DESCRIPTION OF DRAWINGS
[0037] Figure 1 A flowchart of a basin flood disaster early prediction method based on machine learning provided by the present application is shown.
[0038] Figure 2 A flowchart of a flood disaster classification model provided by the present application is shown.
[0039] The accompanying drawings are used to provide a further understanding of the present application, and constitute a part of the specification, together with the embodiments of the present application, to explain the present application, and do not constitute a limitation of the present application. DETAILED DESCRIPTION
[0040] With reference to the accompanying drawings, the technical solutions in the embodiments of the present application will be clearly and completely described in order to make the present application apparent to those skilled in the art. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application; based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of the present application.
[0041] In the description of the present application, it should be understood that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application.
[0042] Embodiment one: refer to Figure 1 The present embodiment provides a kind of early flood disaster prediction method of watershed based on machine learning, the early flood disaster prediction method of watershed based on machine learning, specific and include the following steps:
[0043] Step S1: data acquisition, acquisition watershed in time sequence ordered meteorological data, hydrological data, precipitation and historical flood disaster data constitute source data set, the missing value of numerical data in source data set is handled using mean filling, the missing value of category data in source data set is handled using one-hot encoding, using quartile interval method detects and processes the abnormal value in source data set;
[0044] Step S2: data structuring, the data in source data set is time series data, source data is cut into input window and target value using sliding window technology, set window length as preset time period, target value is the water level of future one day, generate training sample, build same period data association with year as cycle, meteorological data and hydrological data in source data set are used as features, historical flood disaster data is used as label, numerical type feature is carried out Min-Max normalization;
[0045] Step S3: construct precipitation prediction model, introduce dynamic smoothing coefficient self-adaptive adjustment mechanism in Holt-Winters three-parameter model, use bidirectional long short-term memory network to predict precipitation;
[0046] Step S4: build flood disaster grading model, introduce multi-objective optimization fruit fly optimization algorithm in decision tree model, optimize the hyperparameter in decision tree, so that flood disaster grading model predicts flood disaster and carries out grading;
[0047] Step S5: flood disaster warning, collecting real-time meteorological data and hydrological data, inputting into the precipitation prediction model to predict the precipitation, and inputting the real-time meteorological data, hydrological data and predicted precipitation into the flood disaster classification model to predict the flood disaster and classify it.
[0048] Embodiment two: refer to Figure 1 This embodiment is based on the above embodiment, and step S3: constructing a precipitation prediction model, specifically including the following steps:
[0049] Step S31: using Holt-Winters three-parameter model to de-seasonize and extract trend of time series data, the Holt-Winters three-parameter model includes three smoothing functions, namely horizontal function, trend function and seasonal function, using horizontal function to calculate the smoothing level of current time series data, using trend function to calculate the trend change rate of current time series data, using seasonal function to extract the seasonal component of current time series data, the formula is as follows:
[0050] ;
[0051] ;
[0052] ;
[0053] In the formula, is the smoothing level at time step , is the trend change rate at time step , is the seasonal component at time step , is the time step, , and are adaptive dynamic smoothing coefficients in the interval [0, 1], when the dynamic smoothing coefficient is 1, it means analyzing the current time series data, when the dynamic smoothing coefficient is 0, it means predicting the current time series data, is the historical flood disaster data at time step , is the seasonal period length;
[0054] Step S32: constructing and initializing a long short-term memory network, inputting the source data set into the long short-term memory network for training, setting a forget gate, an input gate and an output gate for each layer of the long short-term memory network, the forget gate determines the discard proportion of historical information, the input gate generates a new candidate state, and the output gate outputs the current hidden layer state, the formula is as follows:
[0055] ;
[0056] wherein, is the output function of the forget gate, the input gate and the output gate at time step is the Sigmoid function, is the weight matrix of the forget gate, the input gate and the output gate at time step is the hidden state at time step is the input of the long short-term memory network at time step is the bias term at time step
[0057] Step S33: introducing the exponential smoothing seasonal factor and the trend term in the output layer of the long short-term memory network, and predicting the rainfall, the formula used is as follows:
[0058] ;
[0059] wherein, is the rainfall predicted by the output layer of the long short-term memory network.
[0060] Embodiment Three: referring to Figure 1 and Figure 2 , this embodiment is based on the above-mentioned embodiment, and step S4: constructing a flood disaster grading model, specifically comprising the following steps:
[0061] Step S41: initialization, establishing and initializing a decision tree model as a flood disaster grading model, inputting the source data set into the flood disaster grading model for training, and using the fruit fly optimization algorithm to optimize the hyperparameters of the decision tree, defining the parameter space of the decision tree, each fruit fly individual corresponding to a set of candidate parameter combinations, presetting the fruit fly population size and the maximum iteration number;
[0062] Step S42: generating a new position by olfactory search, the fruit fly individual generates a new parameter combination by random disturbance, adding a random offset to the current candidate parameter, the formula used is as follows:
[0063] ;
[0064] ;
[0065] wherein, and are the new coordinates of the fruit fly, is the index of the fruit fly, and are the coordinates of the initial position of the fruit fly, is a random disturbance factor, taking a value in the range [-1, 1], is the random flight range of fruit flies, i.e. the search step;
[0066] Step S43: visual search, evaluate each parameter combination by cross-validation accuracy, select the optimal parameter combination to update the global optimal solution, and adjust the fruit fly search direction;
[0067] Step S44: dynamically adjust the search range, dynamically reduce the search range according to the number of iterations and the quality of the current optimal solution, set the optimization iteration threshold, if the global optimal solution is still not improved after continuously exceeding the optimization iteration threshold times of iteration, reduce the search step, if the improvement is significant, enlarge the search step, and retain the optimal 10% fruit flies into the next iteration each time;
[0068] Step S45: multi-objective optimization fusion, design a composite objective function, the formula is as follows:
[0069] ;
[0070] In the formula, is a composite objective function, , and is a weight coefficient, is the accuracy of the decision tree, is the model complexity of the decision tree, is the training time of the decision tree;
[0071] Step S46: Pareto optimization, calculate the crowding degree of each parameter combination in the preset target space, the crowding degree is the sum of the normalized distances of each parameter combination in the target space and other adjacent parameter combinations, and the parameter combination with the most diversity is selected by crowding degree sorting.
[0072] Example Four: This example is based on the above-mentioned examples, and in Example One, the same period data association is constructed with a period of one year, and each month is seasonally matched, so the seasonal cycle length is set to 12 in step S1.
[0073] Example Five: This example is based on the above-mentioned examples, and in Example Two, the number of neurons in the hidden layer of the long short-term memory network is 128, 64, and 32, respectively.
[0074] Example Six: This example is based on the above-mentioned examples, and in Example Three, the optimization iteration threshold is set to 5, if the global optimal solution is still not improved after continuously exceeding 5 times of iteration, the search step is reduced to 90% of the original, if the improvement is significant, the search step is enlarged to 130% of the original.
[0075] It is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting; it is not intended to exclude myriad other embodiments of the present application that other present or future technologies can provide. Specifically, it is contemplated that some embodiments of the present application can be practiced without the specific details set forth in the preceding description.
[0076] While the embodiments of the application have been illustrated and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the spirit and scope of the application, which is defined by the appended claims and their equivalents.
[0077] The above description of the application and its embodiments is not restrictive, and the embodiments shown in the drawings are only one of the embodiments of the application, and the actual structure is not limited thereto. In general, if a person skilled in the art is inspired by it, without departing from the purpose of the application, without creative design, similar structure and embodiments of the technical solution should belong to the protection scope of the application.
Claims
1. A method for early prediction of flood disaster in a river basin based on machine learning, characterized in that, Specifically comprising the following steps: Step S1: data collection, collecting time-ordered weather data, hydrological data, precipitation and historical flood disaster data in the basin to form a source data set, using mean filling to process the missing values of numerical data in the source data set, using one-hot encoding to process the missing values of categorical data in the source data set, and using the interquartile range method to detect and process outliers in the source data set; Step S2: data structuring, the data in the source data set is time series data, using sliding window technology to cut the source data into input window and target value, setting the window length as the preset time period, and the target value is the water level of the next day, generating training samples, associating the same period data with years, using the weather data and hydrological data in the source data set as features, and the historical flood disaster data as labels, and performing Min-Max normalization on numerical features; Step S3: constructing a precipitation prediction model, introducing a dynamic smoothing coefficient self-adaptive adjustment mechanism into the Holt-Winters three-parameter model, and using a bidirectional long short-term memory network to predict precipitation; Step S4: constructing a flood disaster classification model, introducing a multi-objective optimization fruit fly optimization algorithm into the decision tree model, optimizing the hyperparameters in the decision tree, and enabling the flood disaster classification model to predict and classify flood disasters; Step S5: flood disaster warning, collecting real-time weather data and hydrological data, inputting them into the precipitation prediction model to predict precipitation, and inputting the real-time weather data, hydrological data and predicted precipitation into the flood disaster classification model to predict and classify flood disasters.
2. The method according to claim 1, wherein, Step S3: constructing a precipitation prediction model, specifically comprising the following steps: Step S31: using the Holt-Winters three-parameter model to de-seasonize and extract trends from time series data; Step S32: constructing and initializing a long short-term memory network, inputting the source data set into the long short-term memory network for training; Step S33: introducing an exponential smoothing seasonal factor and a trend item into the output layer of the long short-term memory network to predict rainfall.
3. The method according to claim 2, wherein, Step S4: constructing a flood disaster classification model, specifically comprising the following steps: Step S41: initialization, establishing and initializing a decision tree model as a flood disaster classification model, inputting the source data set into the flood disaster classification model for training, and using a fruit fly optimization algorithm to optimize the hyperparameters of the decision tree, defining the parameter space of the decision tree, each fruit fly individual corresponding to a candidate parameter combination, and presetting the fruit fly population size and maximum iteration number; Step S42: generate a new position by olfactory search, generate a new parameter combination by random disturbance, and add a random offset to the current candidate parameters; Step S43: visual search, evaluate each parameter combination by cross-validation accuracy, select the optimal parameter combination to update the global optimal solution, and adjust the fruit fly search direction; Step S44: dynamically adjust the search range, dynamically narrow the search range according to the iteration number and the quality of the current optimal solution, set the optimization iteration threshold, and retain the best 10% fruit flies for the next iteration each time; Step S45: multi-objective optimization fusion, a composite objective function is designed, and the formula is as follows: ; wherein, is a composite objective function, , and is a weight coefficient, is the accuracy of the decision tree, is the model complexity of the decision tree, is the training time of the decision tree; Step S46: Pareto optimization, the crowding degree of each parameter combination in the preset target space is calculated, the crowding degree is the sum of the normalized distances of each parameter combination in the target space and other adjacent parameter combinations, and the most diverse parameter combination is selected through the crowding degree sorting.
Citation Information
Patent Citations
Flood forecasting model parameter multi-objective optimization method based on long short-term memory network and NSGA-II
CN113887787A
Energy consumption equipment operation adjusting method and device, equipment and storage medium
CN118941045A