Random forest model-based runoff prediction method and system

By adopting a random forest model method in runoff prediction, using a self-attention mechanism algorithm to extract features and combine it with a multi-layer perceptron to predict, the problems of complex data preprocessing and high requirements for input data accuracy in the prior art are solved, and higher prediction accuracy and robustness are achieved.

CN119884971APending Publication Date: 2025-04-25SICHUAN ZHONGDIAN AOSTAR INFORMATION TECHNOLOGIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411941759.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Existing runoff prediction methods require complex data preprocessing, basin extraction and graph structure construction. The processing is complex and cumbersome, and the accuracy of the input data is high, and it is susceptible to data noise and uncertainty.

Method used

The runoff prediction method based on the random forest model is adopted, and the characteristics are extracted by obtaining historical hydrological and meteorological data using the self-attention mechanism algorithm, and these characteristics are fused to train the random forest model and predicted with a multi-layer perceptron.

Benefits of technology

This method can more comprehensively capture various factors affecting runoff, improve the accuracy and robustness of predictions, reduce the complexity and cumbersome steps of data preprocessing, and adapt to different watershed and climatic conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884971A_ABST
    Figure CN119884971A_ABST
Patent Text Reader

Abstract

The invention relates to a runoff prediction method and system based on a random forest model, and the method comprises the following steps: obtaining runoff data of a to-be-detected drainage basin, including historical hydrological data and historical meteorological data, and carrying out the normalization processing of the data; respectively inputting the historical hydrological data and the historical meteorological data into a self-attention mechanism algorithm, and extracting a first feature and a second feature; and fusing the two features to obtain a runoff feature. And training a random forest model by using the runoff characteristics, and predicting the first initial runoff of the drainage basin to be detected. The historical hydrological data and the historical meteorological data are fused with the runoff characteristics, and a second initial runoff is obtained by inputting the fused data into a multi-layer perceptron (MLP); and finally, fusing the first initial runoff volume and the second initial runoff volume to obtain final runoff volume prediction. According to the method, various factors influencing the runoff volume are comprehensively captured, so that the prediction accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a runoff prediction method and system based on a random forest model, belonging to the technical field of hydrology and water resources. Background Art

[0002] Changes in runoff have an important impact on the development, allocation and management of water resources. With the intensification of global climate change and human activities, the prediction of runoff has become increasingly important. At present, runoff prediction is mainly carried out through three methods: qualitative analysis, physical driven model and data driven model. Among them, data driven model has attracted much attention because it can process a large amount of historical data and discover the laws therein. Traditional prediction methods are based on modeling of hydrological physical processes and can simulate the changes in hydrological processes more accurately. However, such models usually require a large number of input parameters and complex calculation processes, and their applicability to different basins varies greatly. In addition, the model has high requirements for the accuracy of input information such as rainfall data. If the input data is inaccurate, the final simulated runoff results will also have errors.

[0003] The patent document with the patent number "CN116955450A" has developed a hydrological forecasting method and system that integrates the temporal and spatial processes of watershed runoff. The problem with this method is that it requires complex preprocessing of various data of the watershed and watershed extraction and graph structure construction, which includes the use of GIS software and Python and other tools, which has high requirements for data processing and relatively cumbersome steps. Summary of the invention

[0004] In order to solve the above problems existing in the prior art, the present invention proposes a runoff prediction method and system based on a random forest model.

[0005] The technical solution of the present invention is as follows:

[0006] In one aspect, the present invention provides a method for predicting runoff based on a random forest model, comprising the following steps:

[0007] Acquire runoff data of the watershed to be measured, wherein the runoff data includes historical hydrological data and historical meteorological data;

[0008] Normalize the runoff data;

[0009] Input historical hydrological data into the self-attention mechanism algorithm to obtain the first feature, and input historical meteorological data into the self-attention mechanism algorithm to obtain the second feature;

[0010] The first feature and the second feature are combined to obtain the runoff feature;

[0011] Use the runoff characteristics to train the random forest model, and use the trained random forest model to predict the first initial runoff of the watershed to be tested;

[0012] The historical hydrological data and historical meteorological data are fused with the runoff characteristics and then input into the multi-layer perceptron MLP to obtain the second initial runoff. The first initial runoff is fused with the second initial runoff to obtain the runoff of the basin to be measured.

[0013] As a preferred embodiment, the normalization method is:

[0014]

[0015] Among them, x new represents the runoff data after normalization, x represents the runoff data before normalization, and x min represents the minimum value of runoff data before normalization, x max Indicates the maximum value of runoff data before normalization.

[0016] As a preferred implementation, the method for obtaining the first feature and the second feature is:

[0017] Input historical hydrological data into the self-attention mechanism algorithm to construct the first attention matrix:

[0018]

[0019] Input historical meteorological data into the self-attention mechanism algorithm to construct the second attention matrix:

[0020]

[0021] Among them, E H represents historical hydrological data, E L Represents historical meteorological data, W q1 , W k1 and W v1 denote the query, key and value of the first attention matrix respectively, W q2 , W k2 and W v2 denote the query, key, and value of the second attention matrix, Q H , K H and V H They represent the first query weighted feature, the first key weighted feature, and the first value weighted feature of the historical hydrological data after attention concentration, respectively. L , K L and V L They respectively represent the second query weighted feature, the second key weighted feature, and the second value weighted feature of the historical meteorological data after attention concentration;

[0022] Use the softmax function to normalize the first attention matrix and the second attention matrix respectively:

[0023]

[0024] Among them, S H represents the first initial feature after normalization, S L represents the normalized second initial feature, K H The transposed matrix of K L The transposed matrix of

[0025] The first initial feature S H Concatenate the first value weighted feature V H Get the first feature M H :

[0026] M H =S H V H ;

[0027] The second initial feature S L Concatenate the second value weighted feature V L Get the second feature M L :

[0028] M L =S L V L .

[0029] As a preferred implementation, the method of fusing the first feature and the second feature is:

[0030] For the first feature M H and the second feature M L Perform normalization:

[0031]

[0032] Among them, Rp1 represents the normalization function, represents the normalized M H , represents the normalized M L ;

[0033] Will and To perform the fusion:

[0034]

[0035] in, represents feature splicing, and XG represents runoff characteristics.

[0036] As a preferred implementation, the random forest model training method is:

[0037] Get the runoff characteristics XG at different historical moments to form a feature set {d1...d i ...d n}, the runoff characteristics XG at different historical moments are sampled using a random sampling method with replacement to obtain a random set {x1...x i ...x n};

[0038] Among them, d i represents the runoff characteristics at the i-th random historical moment in the feature set, x i represents the runoff characteristics at the i-th random historical moment in the random set;

[0039] In the feature set {d1...d i ...d n} randomly selects several runoff features to construct a decision tree Tr;

[0040] According to the runoff characteristics x of the i-th random historical moment in the random set i The reduced Gini impurity when the decision tree Tr splits to classify the features;

[0041] According to the classification results of each decision tree, the category with the most votes is taken as the prediction result of random forest;

[0042] The Gini impurity calculation method is:

[0043]

[0044] Among them, G represents the Gini impurity, p(i) represents the runoff characteristic x at the i-th random historical moment in the random set i The probability of belonging to this feature;

[0045] Calculate the runoff characteristics x at the i-th random historical moment in the random set i The reduced Gini impurity during the split is taken as the Gini impurity reduction, and the Gini impurity reduction is normalized using the following formula:

[0046]

[0047] Among them, G k represents the reduction of Gini impurity after normalization, G s represents the reduction in Gini impurity, represents the reduction in total Gini impurity;

[0048] The normalized Gini impurity reduction is used as the runoff characteristic x at the i-th random historical moment in the random set i feature score.

[0049] As a preferred implementation, the method for obtaining the runoff of the watershed to be measured is:

[0050]

[0051] Where N is the number of decision trees, Y is the runoff of the basin to be tested, E is the runoff data, T(E) is the prediction result of the decision tree in lesson i, and f MLP represents the implicit function of the multi-layer perceptron MLP, represents the first initial runoff, Represents the second initial runoff.

[0052] In another aspect, the present invention provides a runoff prediction system based on a random forest model, comprising:

[0053] Data acquisition module: obtains the runoff data of the watershed to be measured, wherein the runoff data includes historical hydrological data and historical meteorological data;

[0054] Data preprocessing module: normalize the runoff data;

[0055] Feature extraction module: input historical hydrological data into the self-attention mechanism algorithm to obtain the first feature, and input historical meteorological data into the self-attention mechanism algorithm to obtain the second feature;

[0056] Feature fusion module: fuses the first feature and the second feature to obtain the runoff feature;

[0057] Model training module: Use the runoff characteristics to train the random forest model, and use the trained random forest model to predict the first initial runoff of the watershed to be tested;

[0058] Runoff prediction module: The historical hydrological data and historical meteorological data are integrated with the runoff characteristics, and the integrated data are input into the multi-layer perceptron MLP to obtain the second initial runoff. The first initial runoff is integrated with the second initial runoff to obtain the runoff of the basin to be measured.

[0059] The present invention has the following beneficial effects:

[0060] The present invention combines historical hydrological data and historical meteorological data, uses a self-attention mechanism algorithm to extract features, and then fuses these features to train a random forest model. This method can more comprehensively capture the various factors that affect runoff, thereby improving the accuracy of prediction. The random forest model itself has good generalization performance because it reduces the risk of overfitting by constructing multiple decision trees and integrating their prediction results. The present invention further optimizes the feature extraction and fusion process so that the model can better adapt to different watersheds and climatic conditions, thereby improving the generalization ability of the model. The method of the present invention performs normalization processing in the data preprocessing stage, which helps to reduce the impact of uncertainty and noise of the input data on the prediction results. At the same time, by combining the multi-layer perceptron MLP for prediction, the fault tolerance and robustness of the model to the input data can be further improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 The present invention is a flowchart for implementing the method. DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] It should be understood that the step numbers used in this document are only for convenience of description and are not intended to limit the order in which the steps are executed.

[0064] It should be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0065] The terms “include” and “comprising” indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0066] The term "and / or" means and includes any and all possible combinations of one or more of the associated listed items.

[0067] Embodiment 1:

[0068] See also Figure 1The present invention provides a method for predicting runoff based on a random forest model, comprising the following steps:

[0069] Obtaining runoff data of the watershed to be measured, the runoff data including historical hydrological data (rainfall, evaporation, water level in the watershed, etc.) and historical meteorological data (temperature, humidity, wind speed, air pressure, etc.);

[0070] Normalize the runoff data;

[0071] Input historical hydrological data into the self-attention mechanism algorithm to obtain the first feature, and input historical meteorological data into the self-attention mechanism algorithm to obtain the second feature;

[0072] The first feature and the second feature are combined to obtain the runoff feature;

[0073] Use the runoff characteristics to train the random forest model, and use the trained random forest model to predict the first initial runoff of the watershed to be tested;

[0074] The historical hydrological data and historical meteorological data are fused with the runoff characteristics and then input into the multi-layer perceptron MLP to obtain the second initial runoff. The first initial runoff is fused with the second initial runoff to obtain the runoff of the basin to be measured.

[0075] As a preferred embodiment, the normalization method is:

[0076]

[0077] Among them, x new represents the runoff data after normalization, x represents the runoff data before normalization, and x min represents the minimum value of runoff data before normalization, x max Indicates the maximum value of runoff data before normalization.

[0078] As a preferred implementation, the method for obtaining the first feature and the second feature is:

[0079] Input historical hydrological data into the self-attention mechanism algorithm to construct the first attention matrix:

[0080]

[0081] Input historical meteorological data into the self-attention mechanism algorithm to construct the second attention matrix:

[0082]

[0083] Among them, E H represents historical hydrological data, E L Represents historical meteorological data, Wq1 , W k1 and W v1 denote the query, key and value of the first attention matrix respectively, W q2 , W k2 and W v2 denote the query, key, and value of the second attention matrix, Q H , K H and V H They represent the first query weighted feature, the first key weighted feature, and the first value weighted feature of the historical hydrological data after attention concentration, respectively. L , K L and V L They respectively represent the second query weighted feature, the second key weighted feature, and the second value weighted feature of the historical meteorological data after attention concentration;

[0084] Use the softmax function to normalize the first attention matrix and the second attention matrix respectively:

[0085]

[0086] Among them, S H represents the first initial feature after normalization, S L represents the normalized second initial feature, K H The transposed matrix of K L The transposed matrix of

[0087] The first initial feature S H Concatenate the first value weighted feature V H Get the first feature M H :

[0088] M H =S H V H ;

[0089] The second initial feature S L Concatenate the second value weighted feature V L Get the second feature M L :

[0090] M L =S L V L .

[0091] As a preferred implementation, the method of fusing the first feature and the second feature is:

[0092] For the first feature M H and the second feature M LPerform normalization:

[0093]

[0094] Among them, Rp1 represents the normalization function, represents the normalized M H , represents the normalized M L ;

[0095] Will and To perform the fusion:

[0096]

[0097] in, represents feature splicing, and XG represents runoff characteristics.

[0098] As a preferred implementation, the random forest model training method is:

[0099] Get the runoff characteristics XG at different historical moments to form a feature set {d1...d i ...d n}, (For example, if we collect runoff data for a certain year in history, we can use the above-mentioned published runoff feature acquisition method to obtain a runoff feature XG for the runoff data of this year. Then, we can collect runoff data for several years in history and use this method to obtain several runoff features. Then, we can use these several runoff features to form feature sets and random sets. Here, we only explain how to obtain feature sets and random sets.) If we collect runoff data at n different times, we can obtain n runoff features XG through the published method of this example. We can use the random sampling method with replacement to extract the runoff features XG at different historical times to obtain the random set {x1...x i ...x n};

[0100] Among them, d i represents the runoff characteristics at the i-th random historical moment in the feature set, x i represents the runoff characteristics at the i-th random historical moment in the random set;

[0101] In the feature set {d1...d i ...d n} randomly selects several runoff features to construct a decision tree Tr;

[0102] According to the runoff characteristics x of the i-th random historical moment in the random set i The reduced Gini impurity when the decision tree Tr splits to classify the features;

[0103] According to the classification results of each decision tree, the category with the most votes is taken as the prediction result of random forest;

[0104] The Gini impurity calculation method is:

[0105]

[0106] Among them, G represents the Gini impurity, p(i) represents the runoff characteristic x at the i-th random historical moment in the random set i The probability of belonging to this feature;

[0107] Calculate the runoff characteristics x at the i-th random historical moment in the random set i The reduced Gini impurity during the split is taken as the Gini impurity reduction, and the Gini impurity reduction is normalized using the following formula:

[0108]

[0109] Among them, G k represents the reduction of Gini impurity after normalization, G s represents the reduction in Gini impurity, represents the reduction in total Gini impurity;

[0110] The normalized Gini impurity reduction is used as the runoff characteristic x at the i-th random historical moment in the random set i feature score.

[0111] As a preferred implementation, the method for obtaining the runoff of the watershed to be measured is:

[0112]

[0113] Where N is the number of decision trees, Y is the runoff of the basin to be tested, E is the runoff data, T(E) is the prediction result of the decision tree of lesson i, and f MLP represents the implicit function of the multi-layer perceptron MLP, represents the first initial runoff, Represents the second initial runoff.

[0114] Embodiment 2:

[0115] The present invention provides a runoff prediction system based on a random forest model, comprising:

[0116] Data acquisition module: obtains the runoff data of the watershed to be measured, wherein the runoff data includes historical hydrological data and historical meteorological data;

[0117] Data preprocessing module: normalize the runoff data;

[0118] Feature extraction module: input historical hydrological data into the self-attention mechanism algorithm to obtain the first feature, and input historical meteorological data into the self-attention mechanism algorithm to obtain the second feature;

[0119] Feature fusion module: fuses the first feature and the second feature to obtain the runoff feature;

[0120] Model training module: Use the runoff characteristics to train the random forest model, and use the trained random forest model to predict the first initial runoff of the watershed to be tested;

[0121] Runoff prediction module: The historical hydrological data and historical meteorological data are integrated with the runoff characteristics, and the integrated data are input into the multi-layer perceptron MLP to obtain the second initial runoff. The first initial runoff is integrated with the second initial runoff to obtain the runoff of the basin to be measured.

[0122] The system is used to implement the method in Example 1, which will not be described in detail here.

[0123] In the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.

[0124] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0125] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0126] In several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory; hereinafter referred to as: ROM), random access memory (Random Access Memory; hereinafter referred to as: RAM), disk or optical disk, and other media that can store program codes.

[0127] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A runoff prediction method based on a random forest model, characterized in that: The following steps are involved: Acquire runoff data of the watershed to be measured, wherein the runoff data includes historical hydrological data and historical meteorological data; Normalize the runoff data; Input historical hydrological data into the self-attention mechanism algorithm to obtain the first feature, and input historical meteorological data into the self-attention mechanism algorithm to obtain the second feature; The first feature and the second feature are combined to obtain the runoff feature; Use the runoff characteristics to train the random forest model, and use the trained random forest model to predict the first initial runoff of the watershed to be tested; The historical hydrological data and historical meteorological data are fused with the runoff characteristics and then input into the multi-layer perceptron MLP to obtain the second initial runoff. The first initial runoff is fused with the second initial runoff to obtain the runoff of the basin to be measured.

2. The method for predicting runoff based on the random forest model according to claim 1 is characterized in that: The normalization method is: Among them, x new represents the runoff data after normalization, x represents the runoff data before normalization, and x min represents the minimum value of runoff data before normalization, x max Indicates the maximum value of runoff data before normalization.

3. The method for predicting runoff based on the random forest model according to claim 2 is characterized in that: The method for obtaining the first feature and the second feature is: Input historical hydrological data into the self-attention mechanism algorithm to construct the first attention matrix: Input historical meteorological data into the self-attention mechanism algorithm to construct the second attention matrix: Among them, E H represents historical hydrological data, E L Represents historical meteorological data, W q1 , W k1 and W v1 denote the query, key and value of the first attention matrix respectively, W q2 , W k2 and W v2 denote the query, key, and value of the second attention matrix, Q H , K H and V H They represent the first query weighted feature, the first key weighted feature, and the first value weighted feature of the historical hydrological data after attention concentration, respectively. L , K L and V L They respectively represent the second query weighted feature, the second key weighted feature, and the second value weighted feature of the historical meteorological data after attention concentration; Use the softmax function to normalize the first attention matrix and the second attention matrix respectively: Among them, S H represents the first initial feature after normalization, S L represents the normalized second initial feature, K H The transposed matrix of K L The transposed matrix of The first initial feature S H Concatenate the first value weighted feature V H Get the first feature M H : M H =S H V H ; The second initial feature S L Concatenate the second value weighted feature V L Get the second feature M L : M L =S L V L 。 4. The method for predicting runoff based on the random forest model according to claim 3 is characterized in that: The method of fusing the first feature and the second feature is: For the first feature M H and the second feature M L Perform normalization: Among them, Rp1 represents the normalization function, represents the normalized M H , represents the normalized M L ; Will and To perform the fusion: in, represents feature splicing, and XG represents runoff characteristics.

5. The method for predicting runoff based on the random forest model according to claim 4 is characterized in that: The random forest model training method is: Get the runoff characteristics XG at different historical moments to form a feature set {d1...d i ...d n }, the runoff characteristics XG at different historical moments are sampled using a random sampling method with replacement to obtain a random set {x1...x i ...x n }; Among them, d i represents the runoff characteristics at the i-th random historical moment in the feature set, x i represents the runoff characteristics at the i-th random historical moment in the random set; In the feature set {d1...d i ...d n } randomly selects several runoff features to construct a decision tree Tr; According to the runoff characteristics x of the i-th random historical moment in the random set i The reduced Gini impurity when the decision tree Tr splits to classify the features; According to the classification results of each decision tree, the category with the most votes is taken as the prediction result of random forest; The Gini impurity calculation method is: Among them, G represents the Gini impurity, p(i) represents the runoff characteristic x at the i-th random historical moment in the random set i The probability of belonging to this feature; Calculate the runoff characteristics x at the i-th random historical moment in the random set i The reduced Gini impurity during the split is taken as the Gini impurity reduction, and the Gini impurity reduction is normalized using the following formula: Among them, G k Represents the normalized Gini impurity reduction, G s represents the reduction in Gini impurity, represents the reduction in total Gini impurity; The normalized Gini impurity reduction is used as the runoff characteristic x at the i-th random historical moment in the random set i feature score.

6. The method for predicting runoff based on the random forest model according to claim 5, characterized in that: The method for obtaining the runoff of the watershed to be measured is: Where N is the number of decision trees, Y is the runoff of the basin to be tested, E is the runoff data, T(E) is the prediction result of the decision tree of lesson i, and f MLP represents the implicit function of the multi-layer perceptron MLP, represents the first initial runoff, Represents the second initial runoff.

7. A runoff prediction system based on a random forest model, characterized in that: include: Data acquisition module: obtains the runoff data of the watershed to be measured, wherein the runoff data includes historical hydrological data and historical meteorological data; Data preprocessing module: normalize the runoff data; Feature extraction module: input historical hydrological data into the self-attention mechanism algorithm to obtain the first feature, and input historical meteorological data into the self-attention mechanism algorithm to obtain the second feature; Feature fusion module: fuses the first feature and the second feature to obtain the runoff feature; Model training module: Use the runoff characteristics to train the random forest model, and use the trained random forest model to predict the first initial runoff of the watershed to be tested; Runoff prediction module: The historical hydrological data and historical meteorological data are integrated with the runoff characteristics, and the integrated data are input into the multi-layer perceptron MLP to obtain the second initial runoff. The first initial runoff is integrated with the second initial runoff to obtain the runoff of the basin to be measured.

8. The runoff prediction system based on the random forest model according to claim 7 is characterized in that: In the feature extraction module, the method for acquiring the first feature and the second feature is: Input historical hydrological data into the self-attention mechanism algorithm to construct the first attention matrix: Input historical meteorological data into the self-attention mechanism algorithm to construct the second attention matrix: Among them, E H represents historical hydrological data, E L Represents historical meteorological data, W q1 , W k1 and W v1 denote the query, key and value of the first attention matrix respectively, W q2 , W k2 and W v2 denote the query, key, and value of the second attention matrix, Q H , K H and V H They represent the first query weighted feature, the first key weighted feature, and the first value weighted feature of the historical hydrological data after attention concentration, respectively. L , K L and V L They respectively represent the second query weighted feature, the second key weighted feature, and the second value weighted feature of the historical meteorological data after attention concentration; Use the softmax function to normalize the first attention matrix and the second attention matrix respectively: Among them, S H represents the first initial feature after normalization, S L represents the normalized second initial feature, K H The transposed matrix of K L The transposed matrix of The first initial feature S H Concatenate the first value weighted feature V H Get the first feature M H : M H =S H V H ; The second initial feature S L Concatenate the second value weighted feature V L Get the second feature M L : M L =S L V L 。 9. The runoff prediction system based on the random forest model according to claim 8, characterized in that: In the feature fusion module, the method of fusing the first feature and the second feature is: For the first feature M H and the second feature M L Perform normalization: Among them, Rp1 represents the normalization function, represents the normalized M H , represents the normalized M L ; Will and To perform the fusion: in, represents feature splicing, and XG represents runoff characteristics.

10. The runoff prediction system based on the random forest model according to claim 9, characterized in that: The model training module, the random forest model training method is: Get the runoff characteristics XG at different historical moments to form a feature set {d1...d i ...d n }, the runoff characteristics XG at different historical moments are sampled using a random sampling method with replacement to obtain a random set {x1...x i ...x n }; Among them, d i represents the runoff characteristics at the i-th random historical moment in the feature set, x i represents the runoff characteristics at the i-th random historical moment in the random set; In the feature set {d1...d i ...d n } randomly selects several runoff features to construct a decision tree Tr; According to the runoff characteristics x of the i-th random historical moment in the random set i The reduced Gini impurity when the decision tree Tr splits to classify the features; According to the classification results of each decision tree, the category with the most votes is taken as the prediction result of random forest; The Gini impurity calculation method is: Among them, G represents the Gini impurity, p(i) represents the runoff characteristic x at the i-th random historical moment in the random set i The probability of belonging to this feature; Calculate the runoff characteristics x at the i-th random historical moment in the random set i The reduced Gini impurity during the split is taken as the Gini impurity reduction, and the Gini impurity reduction is normalized using the following formula: Among them, G k Represents the normalized Gini impurity reduction, G s represents the reduction in Gini impurity, represents the reduction in total Gini impurity; The normalized Gini impurity reduction is used as the runoff characteristic x at the i-th random historical moment in the random set i feature score.

Citation Information

Patent Citations

  • Hydrological forecasting method and system fusing drainage basin runoff production and confluence space-time process

    CN116955450A