Runoff prediction method, device, equipment and medium based on hyperparameter optimization

By building a hyperparameter optimization algorithm library and using a variety of optimization algorithms to optimize the hyperparameters of long and short-term memory network models, combining the association relationship between distribution characteristic indicators and hyperparameter optimization algorithms, the problems of high cost of hyperparameter training and low generalization capabilities in the existing technology are solved, and efficient runoff prediction and rapid improvement of site prediction accuracy are achieved.

CN119760353APending Publication Date: 2025-04-04TIANFU YONGXING LAB +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411843188.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the process of building runoff prediction model, the training of model hyperparameters requires a lot of computing power and time cost. Especially in the process of finding multiple hyperparameters for model optimization, a large amount of training is required to find the optimal hyperparameter combination, thereby reducing the generalization ability of the model.

Method used

By building a hyperparameter optimization algorithm library, a variety of optimization algorithms (such as particle swarm optimization algorithm, whale optimization algorithm, gray wolf optimization algorithm and white shark optimization algorithm) are used to optimize the hyperparameters of long and short-term memory network models, determine the optimal hyperparameters, and establish an association relationship with the hyperparameter optimization algorithm based on the distribution characteristic indicators, and adaptively match the best hyperparameter optimization algorithm.

Benefits of technology

By reducing the calculation cost and time in the hyperparameter optimization process, the generalization ability and prediction accuracy of the model are improved, and the effect of rapidly improving site prediction accuracy in the prediction of new sites is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760353A_ABST
    Figure CN119760353A_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of runoff prediction, and discloses a runoff prediction method, device, equipment and medium based on hyperparameter optimization. The method includes: obtaining runoff data observation values ​​of multiple original sites, and constructing a hyperparameter optimization algorithm library; constructing a long short-term memory network model based on the runoff data observation values ​​and the hyperparameter optimization algorithm library, and determining the optimal hyperparameters of the long short-term memory network model; using the optimal hyperparameters to determine the best hyperparameter optimization algorithm for each original site, and using the best hyperparameter optimization algorithm for each original site to determine the distribution characteristic index; establishing a correlation relationship mapping set between the best hyperparameter optimization algorithm and the distribution characteristic index; determining the best hyperparameter optimization algorithm for a newly added site according to the correlation relationship mapping set, and using the best hyperparameter optimization algorithm for the newly added site to determine the runoff data prediction value for the newly added site. The present application achieves the effect of quickly improving the site prediction accuracy by only executing a single optimization algorithm driven by a data model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of runoff prediction, and in particular to a runoff prediction method, device, equipment and medium based on hyperparameter optimization. Background Art

[0002] In traditional runoff prediction, the main methods used are causal analysis (based on physical mechanisms) and mathematical statistics (based on historical data). Among the many machine learning models for time series analysis, the long short-term memory network model (LSTM) is widely used in runoff series prediction due to its excellent performance. As an improved version of the traditional recurrent neural network, the LSTM model has a relatively complex model principle and structure. After the model structure is determined, the hyperparameters formed through training directly determine the accuracy and ability of the prediction.

[0003] At present, in the process of building a runoff prediction model, the training of model hyperparameters requires a lot of computing power and time cost. In particular, in the process of optimizing multiple types of hyperparameters of the model, a large amount of training is required to find the optimal hyperparameter combination, which reduces the generalization ability of the model. Summary of the invention

[0004] In view of this, the purpose of the present invention is to overcome the deficiencies in the prior art and to provide a runoff prediction method, device, equipment and medium based on hyperparameter optimization.

[0005] The present invention provides the following technical solutions:

[0006] In a first aspect, an embodiment of the present disclosure provides a runoff prediction method based on hyperparameter optimization, the method comprising:

[0007] Obtain runoff data observations from multiple original sites and build a hyperparameter optimization algorithm library, which includes multiple optimization algorithms;

[0008] A long short-term memory network model is constructed based on the runoff data observation value and the hyperparameter optimization algorithm library, and each optimization algorithm in the hyperparameter optimization algorithm library is used in turn to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters;

[0009] The optimal hyperparameters are used to predict the runoff of each original site, and the optimal hyperparameter optimization algorithm of each original site is determined. The optimal hyperparameter optimization algorithm of each original site is used to calculate the distribution characteristics of the runoff data of the corresponding original site, and the distribution characteristic index of each original site is obtained;

[0010] Perform correlation analysis on the best hyperparameter optimization algorithm and distribution characteristic index of each original site to obtain a correlation relationship mapping set between the best hyperparameter optimization algorithm and distribution characteristic index;

[0011] The optimal hyperparameter optimization algorithm for the newly added site is determined according to the association relationship mapping set, and the runoff prediction for the newly added site is performed using the optimal hyperparameter optimization algorithm for the newly added site to obtain the predicted value of the runoff data for the newly added site.

[0012] Optionally, before constructing the long short-term memory network model based on the runoff data observations and the hyperparameter optimization algorithm library, the following is also included:

[0013] Divide the runoff data observations into training runoff data and verification runoff data according to a preset ratio;

[0014] Design basic parameters of the long short-term memory network model, wherein the basic parameters include at least one of the number of layers, input dimension, output dimension, random initialization, prediction step size, and training loss.

[0015] Optionally, each optimization algorithm in the hyperparameter optimization algorithm library is used in turn to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters, including:

[0016] Determine the hyperparameters of the long short-term memory network model and set the framework parameters of each optimization algorithm in the hyperparameter optimization algorithm library;

[0017] Generate multiple hyperparameter combinations using the optimization algorithms after setting, and train the long short-term memory network model based on the hyperparameter combinations and the validation runoff data and using the preset objective function to obtain multiple objective function values;

[0018] The hyperparameter combinations are sorted according to the objective function value, and the hyperparameter combination with the best objective function value is selected as the optimal hyperparameter.

[0019] Optionally, the optimal hyperparameters are used to predict the runoff of each original site, and the optimal hyperparameter optimization algorithm for each original site is determined, including:

[0020] The long short-term memory network model with optimal hyperparameters is used to predict the runoff of each original site, and the predicted value of the runoff data of each original site is obtained;

[0021] Based on the predicted values ​​of runoff data of each original station and the verified runoff data, the prediction accuracy evaluation results were obtained using the absolute percentage error and the coefficient of determination;

[0022] The optimal hyperparameter optimization algorithm for each original site is determined based on the prediction accuracy evaluation results.

[0023] Optionally, the distribution characteristic index includes coefficient of variation and kurtosis. The distribution characteristics of the runoff data of the corresponding original site are calculated using the optimal hyperparameter optimization algorithm of each original site to obtain the distribution characteristic index of each original site, including:

[0024] Arrange the runoff data observations of each original station in chronological order to obtain a time series;

[0025] The best hyperparameter optimization algorithm for each original site is used to calculate the mean and standard deviation of the time series of the corresponding original site, and the coefficient of variation is calculated based on the mean and standard deviation of the time series;

[0026] Determine the length of the time series and calculate the kurtosis based on the mean, standard deviation, and length of the time series.

[0027] Optionally, the distribution characteristic index also includes skewness and Hurst index. The distribution characteristics of the runoff data of the corresponding original site are calculated using the best hyperparameter optimization algorithm of each original site to obtain the distribution characteristic index of each original site, which also includes:

[0028] Get the expected value of the time series and calculate the skewness based on the mean, standard deviation and expected value of the time series;

[0029] Determine the cumulative deviation sequence based on the mean, calculate the range and standard deviation of the cumulative deviation sequence, and calculate the Hurst exponent based on the range and standard deviation of the cumulative deviation sequence.

[0030] Optionally, an optimal hyperparameter optimization algorithm for the newly added site is determined according to the association relationship mapping set, and the optimal hyperparameter optimization algorithm for the newly added site is used to perform runoff prediction on the newly added site to obtain a predicted value of runoff data for the newly added site, including:

[0031] Obtain the runoff data observation values ​​of the newly added stations, and calculate the distribution characteristic index of the newly added stations according to the runoff data observation values ​​of the newly added stations;

[0032] The optimal hyperparameter optimization algorithm corresponding to the distribution characteristic index of the newly added site is determined according to the association relationship mapping set.

[0033] In a second aspect, an embodiment of the present disclosure provides a runoff prediction device based on hyperparameter optimization, the device comprising:

[0034] A construction module is used to obtain runoff data observation values ​​of multiple original sites and build a hyperparameter optimization algorithm library, which includes multiple optimization algorithms;

[0035] An optimization module is used to construct a long short-term memory network model based on runoff data observations and a hyperparameter optimization algorithm library, and to sequentially use various optimization algorithms in the hyperparameter optimization algorithm library to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters;

[0036] A determination module is used to use the optimal hyperparameters to predict the runoff of each original site, determine the optimal hyperparameter optimization algorithm for each original site, calculate the distribution characteristics of the runoff data of the corresponding original site using the optimal hyperparameter optimization algorithm for each original site, and obtain the distribution characteristic index of each original site;

[0037] An association module is used to perform association analysis on the best hyperparameter optimization algorithm and the distribution characteristic index of each original site to obtain a mapping set of association relationships between the best hyperparameter optimization algorithm and the distribution characteristic index;

[0038] The prediction module is used to determine the best hyperparameter optimization algorithm for the newly added site according to the association relationship mapping set, and use the best hyperparameter optimization algorithm for the newly added site to predict the runoff of the newly added site to obtain the predicted value of the runoff data of the newly added site.

[0039] In a third aspect, a computer device is provided in an embodiment of the present disclosure, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the steps of the runoff prediction method based on hyperparameter optimization in the first aspect when executing the computer program.

[0040] In a fourth aspect, a computer-readable storage medium is provided in an embodiment of the present disclosure, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the runoff prediction method based on hyperparameter optimization in the first aspect are implemented.

[0041] The runoff prediction method based on hyperparameter optimization provided in the embodiment of the present application is based on the LSTM model. By establishing an association between distribution characteristic indicators and hyperparameter optimization algorithms, in the prediction of subsequent new sites, only the data distribution characteristic indicators are used to adaptively match the best hyperparameter optimization algorithm, thereby achieving the effect of quickly improving the site prediction accuracy by only executing a single optimization algorithm driven by the data model.

[0042] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below.

[0044] Figure 1 A flow chart of a runoff prediction method based on hyperparameter optimization provided in an embodiment of the present application is shown;

[0045] Figure 2 A schematic diagram showing the distribution of the coefficient of variation provided by an embodiment of the present application on the site type is shown;

[0046] Figure 3 A schematic diagram showing the distribution of the Hurst index on the site type provided by an embodiment of the present application is shown;

[0047] Figure 4 A schematic diagram showing the distribution of kurtosis on site types provided in an embodiment of the present application is shown;

[0048] Figure 5 A schematic diagram showing the distribution of skewness on site types provided by an embodiment of the present application is shown;

[0049] Figure 6 A schematic diagram showing prediction results of a newly added site under various optimization algorithms provided in an embodiment of the present application is shown;

[0050] Figure 7 A schematic diagram showing prediction results of another newly added site under various optimization algorithms provided in an embodiment of the present application is shown;

[0051] Figure 8 A schematic diagram showing prediction results of another newly added site under various optimization algorithms provided in an embodiment of the present application is shown;

[0052] Fig. 9 A schematic structural diagram of a runoff prediction device based on hyperparameter optimization provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0053] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0054] Example 1

[0055] like Figure 1 , which is a flow chart of a runoff prediction method based on hyperparameter optimization in an embodiment of the present application, and the runoff prediction method based on hyperparameter optimization provided in an embodiment of the present application includes the following steps:

[0056] Step S110, obtaining runoff data observation values ​​of multiple original sites, and constructing a hyperparameter optimization algorithm library, which includes multiple optimization algorithms.

[0057] In this embodiment, runoff data should be included according to the actual site conditions in the basin. Site types generally include: hydrological stations, hydropower stations, and other runoff monitoring sites. In principle, the number of original sites should be more than the number of hyperparameter optimization algorithms. More site data can provide more significant correlations.

[0058] It should be noted that this embodiment collects and counts runoff data observation data for at least 3 years (36 points), with a period of one year (12 points) and a month as the unit. The original stations used are all stations in the Yangtze River Basin, and there are 9 of them.

[0059] Preferably, after collecting a plurality of runoff data observation data, these data are divided into training runoff data and verification runoff data according to a preset ratio (e.g., 8:2). Understandably, in principle, the data within one cycle (year) is not divided. For example, the runoff data observation data is 16 years, with a total of 192 points; according to the 8:2 principle, the training runoff data time is 16*0.8=12.8 years, which is rounded to 13 years, with a total of 156 points; the verification runoff data time is 16*0.2=3.2 years, which is rounded to 3 years, with a total of 36 points. There is no monthly requirement for the data start time, for example, January, July, and December are all acceptable.

[0060] Furthermore, a hyperparameter optimization algorithm library containing multiple optimization algorithms is constructed. The optimization algorithm refers to the data-driven model intelligent optimization algorithm used in the field of machine learning / deep learning in recent years. For example, in this embodiment, the following four optimization algorithms are included in the hyperparameter optimization algorithm library:

[0061] (1) Particle Swarm Optimization (PSO):

[0062] PSO is an optimization algorithm based on swarm intelligence. It searches for the optimal solution by simulating the foraging behavior of bird flocks. Each particle represents a potential solution, and gradually approaches the global optimal solution by updating the speed and position. The iterative calculation method of speed and position is as follows:

[0063] Speed ​​update formula:

[0064] v i (t+1)=ω*v i (t)+c1*r1*(p i *x i (t))+c2*r2*(gx i (t))

[0065] Position update formula:

[0066] x i (t+1)=x i (t)+c

[0067] In the formula, v i (t+1) represents the velocity of the i-th particle at time t+1, v i (t) represents the velocity of the ith particle at time t, x i(t+1) represents the position of the i-th particle at time t+1, x i (t) represents the position of the i-th particle at time t; p i represents the individual optimal position of the i-th particle, g represents the global optimal position of all particles, c1 and c2 represent learning factors, r1 and r2 represent random numbers (0, 1), and ω represents the inertia weight, which is calculated as follows:

[0068]

[0069] In the formula, ω max represents the initial inertia weight, ω min represents the final inertia weight, T max represents the maximum number of iterations of the algorithm, and t represents the current number of iterations.

[0070] (2) Whale Optimization Algorithm (WOA):

[0071] WOA is optimized by simulating the behavior of humpback whales swimming in spirals around prey, which mainly includes encircling prey, spiral updating, and prey searching. The position update formula for each iteration is as follows:

[0072] D=|C1*X ′ (t)-X(t)|

[0073] X(t+1)=X′(t)-A*D

[0074] In the formula, t represents the number of iterations, X ′ (t) represents the candidate optimal position, X(t) and X(t+1) represent the optimal solutions at time t and the next time, A and C1 are vector coefficients, and the calculation formula is as follows:

[0075] A=2*a1*r1-a1

[0076] C=2*r2

[0077] In the formula, r1 and r2 represent random numbers in (0, 1), and a1 represents a number that decreases linearly from 2 to 0 during the iteration process:

[0078]

[0079] Spiral Update Location:

[0080] X(t+1)=D ′ *e bl *cos(2πl)+X * (t)

[0081] D ′ =|X* (t)-X(t)|

[0082] The comprehensive position update formula is as follows:

[0083]

[0084] In the formula, G represents the maximum number of iterations, t represents the current number of iterations, and D ′ represents the distance between the i-th individual and the optimal individual, b is a constant, and l represents a random number distributed between [-1, 1].

[0085] (3) Grey Wolf Optimizer (GWO)

[0086] GWO is optimized by simulating the hunting strategy of gray wolves, where alpha, beta, and delta wolves guide the capture of prey, while omega wolves follow and attack. The definitions are as follows:

[0087] Position update formula:

[0088] Roundup phase:

[0089] D=|C*X p (t)-X(t)|

[0090] X(t+1)=X p (t)-A*D

[0091] A=2a*r1-a

[0092] C=2*r2

[0093] Where r1 and r2 represent random numbers in (0, 1), A represents a random value distributed on [-a, a], and a gradually decreases from 2 to 0 during the iteration process.

[0094] Attack distance D:

[0095] D α =|C1*X α -X|

[0096] D β =|C2*X β -X|

[0097] D δ =|C3*X δ -X|

[0098] Where C1, C2, and C3 represent random coefficient vectors with values ​​of (0, 2) for balancing exploration and development; X α , X β , X δThey represent the positions of three better working wolves respectively, and X is the position of the current working wolf.

[0099] X1=X α -A1*D α

[0100] X2=X β -A2*D β

[0101] X3=X δ -A3*D δ

[0102]

[0103] In the formula, X new Indicates the location of the current optimal solution, D α , D β , D δ They represent the distance between different working wolves and their prey respectively. A1, A2 and A3 are dynamic coefficients.

[0104] (4) White Shark Optimizer (WSO):

[0105] WSO is optimized by simulating the rapid pursuit and attack behavior of white sharks when hunting. White sharks approach their prey using an exploration and exploitation strategy when searching for food. The speed update formula is as follows:

[0106]

[0107] Where i=1, 2, 3, ..., n is the number of the great white shark population of size n, represents the new velocity vector of the i-th great white shark in the k+1th step, represents the current velocity vector of the i-th great white shark in the k-th step, represents the best position vector known to the group, i is the i-th index vector of the white shark reaching the best position, C1 and C2 represent two random numbers distributed in (0,1), and μ is the shrinkage factor. Among them, P1 and P2 are adaptive parameters, which change with the increase of the number of iterations. The calculation formula is as follows:

[0108]

[0109] Where P max and P min are the maximum and minimum values ​​of P1 and P2 respectively, k is the current iteration number, and K is the maximum iteration number.

[0110] Position update formula:

[0111]

[0112] In the formula, and is a one-dimensional binary vector defined by the formula, ω0=⊕(a,b), f represents the frequency parameter of the wave, and ⊕ represent negation and XOR operations, mv represents the hearing and smell strength of the white shark, which increases as a function of iteration. When mv is small, local search is performed, and when mv is large, global search is performed. The calculation formula is as follows:

[0113]

[0114] Move towards prey:

[0115]

[0116] In the formula, is the updated position of the ith white shark relative to the prey position, sgn(r2-0.5) gives 1 or -1 to change the search direction, and r1, r2, and r3 are random numbers in the range [0,1].

[0117] D w is the distance between the prey and the white shark, calculated as follows:

[0118]

[0119] S s It is the recommended parameter for mv impact, and the calculation formula is as follows:

[0120]

[0121] The final updated position of the individual is:

[0122]

[0123] It should be noted that the above four optimization algorithms are only used as an example. The specific optimization algorithm involved can be determined according to the actual situation and is not limited to the above four. The embodiments of the present application do not limit this.

[0124] The above method builds a hyperparameter optimization algorithm library, which facilitates the subsequent flexible selection of the optimization algorithm that best suits the current data and problem, and helps improve model performance.

[0125] Step S120, constructing a long short-term memory network model based on the runoff data observation value and the hyperparameter optimization algorithm library, and sequentially using each optimization algorithm in the hyperparameter optimization algorithm library to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters.

[0126] Understandably, before building a long short-term memory network model, it is necessary to set the basic parameters of the model first. The basic parameters include at least one of the number of layers, input dimension, output dimension, random initialization, prediction step size, and training loss.

[0127] Exemplarily, in this embodiment, the network structure adopted by the long short-term memory network model is a 2-layer structure (1 layer of long short-term memory network, 1 layer of linear full link), the model input is a 1-dimensional time series, the model output is a 1-dimensional time series, the random number seed is 42, the prediction step is 12, and the training loss is NSE (Nash-Sutcliffe Efficiency).

[0128] After setting the basic parameters, a long short-term memory network model (LSTM) is constructed based on the runoff data observations and the hyperparameter optimization algorithm library. The model can be implemented in any language, such as MATLAB, python or JAVA, which is not limited in this embodiment.

[0129] Furthermore, it is necessary to first clarify which hyperparameters will be optimized and set a reasonable value range or candidate value list for them. For the LSTM model, common hyperparameters include mandatory hyperparameters and optional hyperparameters, among which the mandatory hyperparameters include 5 hyperparameters, namely learning rate, number of hidden layer nodes, number of training iterations, batch size, and prediction step length. In this embodiment, the optimization space of the above 5 hyperparameters is set as follows: learning rate: [1e-5, 1e-1]; number of hidden layer nodes: [32, 256]; number of training iterations: [10, 100]; batch size: [8, 128]; prediction step length: [12, 120]. Optional hyperparameters include the following parameters: optimizer: [Adam, RMSprop, SGD, Adagrad]; loss function: [MSE / RMSE / NSE / MAPE]; dropout rate: [0, 1], etc., which are not described here. For example, the four hyperparameter optimization algorithm settings included in the calculation of this embodiment are shown in Table 1 below, where random numbers are generated using the random function in Numpy (random seed #42):

[0130] Table 1

[0131]

[0132] Next, one or more algorithms are selected from the hyperparameter optimization algorithm library (such as PSO, WOA, GWO, WSO, etc.), which will be used to search for the optimal solution in the defined hyperparameter space. For each selected optimization algorithm, this embodiment sets the following framework parameters: number of hidden layers: [2]; number of optimization attempts:

[600] ; sampler setting: [SequentialSampler]; objective function: [NSE (Nash efficiency coefficient)].

[0133] Further, the optimization algorithms described after setting are used to generate multiple hyperparameter combinations, and each group of hyperparameter combinations is used to initialize the long short-term memory network model, and the long short-term memory network model is trained on the training runoff data until a predetermined number of training rounds is reached or other stop conditions are met. Then, the prediction performance of the model is evaluated on the verification runoff data by a preset objective function to obtain multiple objective function values. It should be noted that in this embodiment, the preset objective function uses the Nash efficiency coefficient, which is the most commonly used in long-term runoff prediction, as an indicator. The Nash efficiency coefficient (Nash-Sutcliffe Efficiency, NSE) is a statistical indicator for evaluating the prediction accuracy of the model. The value range of NSE is (-∞, 1], where 1 indicates perfect model prediction, 0 indicates that the prediction effect of the model is the same as the effect of using the mean as the prediction, and a negative value indicates that the model prediction effect is poor.

[0134] The Nash efficiency coefficient is widely used in the verification of hydrological models. In order to match the general use requirements of machine learning loss function, the function range of the Nash efficiency coefficient (NSE) is adjusted according to the following formula:

[0135]

[0136] In the formula, X i is the observed value, X m is the model prediction value, μ is the mean of the observed value, and the adjusted value range changes from the original (-∞, 1] to (0, +∞). The closer the Nash efficiency coefficient value is to 0, the better the prediction effect is, which meets the basic characteristic requirements of the loss function.

[0137] After evaluating each hyperparameter combination, record its corresponding objective function value, sort all hyperparameter combinations according to the objective function value, and select the hyperparameter combination with the best objective function value (such as the highest accuracy) as the optimal hyperparameter.

[0138] The above method optimizes the hyperparameters of the LSTM model through a variety of optimization algorithms to find the optimal model configuration, thereby improving the accuracy of the prediction.

[0139] Step S130, using the optimal hyperparameters to predict the runoff of each original site, determining the optimal hyperparameter optimization algorithm for each original site, and using the optimal hyperparameter optimization algorithm for each original site to calculate the distribution characteristics of the runoff data of the corresponding original site, to obtain the distribution characteristic index of each original site.

[0140] Specifically, for each original site and each optimization algorithm, we applied the optimal hyperparameters to the LSTM model and used the validation data set for prediction to obtain the runoff data prediction value of each original site. Then, we used the absolute percentage error (MAPE) and the coefficient of determination (DC) as evaluation indicators to calculate the prediction performance, where MAPE: measures the relative error between the predicted value and the actual value, the smaller the value, the more accurate the prediction; DC: also known as R 2 (coefficient of determination) measures the degree of fit between the predicted value and the actual value. The closer the value is to 1, the better the fit.

[0141] For each original site, compare the MAPE and DC values ​​of different optimization algorithms on the validation runoff data. Select the optimization algorithm with the smallest MAPE value and the largest DC value as the best hyperparameter optimization algorithm for the original site. Understandably, if multiple optimization algorithms perform similarly in MAPE and DC, they can be selected based on other factors (such as algorithm stability and computational efficiency).

[0142] Furthermore, the optimal hyperparameter optimization algorithm of each original site is used to calculate the distribution characteristics of the runoff data of the corresponding original site, and the comprehensive distribution characteristic indicators of each original site are obtained, including the coefficient of variation (CV), kurtosis (Kurt), skewness and Hurst Exponent, which respectively characterize the degree of dispersion, peak height, degree of skewness and long-term memory of the runoff data distribution. Among them, the coefficient of variation, kurtosis and skewness of each original site are calculated using statistical software or programming language (such as Python), and the Hurst index is calculated using R / S analysis (rescaled range analysis). The specific process is as follows:

[0143] (1) Arrange the runoff data observations of each original station in chronological order to obtain a time series;

[0144] (2) The best hyperparameter optimization algorithm for each original site is used to calculate the mean and standard deviation of the time series of the corresponding original site, which is the basis for analyzing the data distribution characteristics;

[0145] (3) The coefficient of variation is the ratio of the standard deviation to the mean, which is usually used to measure the relative volatility of variables of different magnitudes. The calculation formula is:

[0146]

[0147] In the formula, σ is the standard deviation of the time series, μ is the mean of the time series, and CV is the coefficient of variation;

[0148] (4) Kurtosis is used to measure the degree of “peak” in the data distribution. Positive kurtosis indicates more extreme values ​​in the data set, while negative kurtosis indicates fewer extreme values. The calculation formula is as follows:

[0149]

[0150] Where N is the length of the time series, x is the time series, and kurt(x) is the kurtosis;

[0151] (5) Skewness is used to measure the symmetry of data distribution. Positive skewness indicates a right-skewed distribution (i.e., most data values ​​are less than the mean), and negative skewness indicates a left-skewed distribution (i.e., most data values ​​are greater than the mean). The calculation formula is as follows:

[0152]

[0153] Where E is the expected value of the time series, and Skew(x) is the skewness;

[0154] (6) The Hurst index is used to measure the long memory or self-similarity of a time series. The closer the Hurst index is to 1, the stronger the trend is, and the closer it is to 0, the reverse trend is. Specifically, we need to first define the cumulative deviation sequence Y based on the time series X:

[0155]

[0156] Then calculate the range R and standard deviation S of the cumulative deviation sequence Y:

[0157] R(t)=MAX(Y(t))-MIN(Y(t))

[0158]

[0159] Finally, calculate the Hurst exponent H:

[0160]

[0161] The above method determines the best hyperparameter optimization algorithm for each original site, improves the current selection method that relies mainly on experience to a selection method that relies on indicator quantification, determines the distribution characteristic indicators, and provides favorable data support for the establishment of subsequent correlation relationships.

[0162] Step S140 , performing correlation analysis on the best hyperparameter optimization algorithm and the distribution characteristic index of each original site to obtain a correlation relationship mapping set between the best hyperparameter optimization algorithm and the distribution characteristic index.

[0163] Understandably, after obtaining the distribution characteristic index of each original site and the best hyperparameter optimization algorithm, an association relationship mapping set between the two is established. Exemplarily, in this embodiment, the original sites include DATONG station, GAOLIN station, GONGTAN station, HANKOU station, JIAN station and LUNING station, and the corresponding relationship between each original site and its best hyperparameter optimization algorithm is: DATONG station-GWO, GAOLIN station-PSO, GONGTAN station-PSO, HANKOU station-GWO, JIAN station-WOA, LUNING station-WOA. The calculation results of the distribution characteristic index value established in this embodiment are shown in the following Table 2:

[0164] Table 2

[0165] Site Best Algorithm Coefficient of variation Skewness Kurtosis Hurst exponent DATONG GWO 0.523 -0.399 -0.399 1.364 GAOLIN PSO 2.388 4.643 25.253 1.499 GONGTAN PSO 0.992 1.173 2.498 1.526 HANKOU GWO 0.565 0.328 -1.079 0.946 JIAN WOA 0.861 1.522 1.81 1.393 LUNING WOA 0.863 1.226 0.747 1.018

[0166] Furthermore, in this embodiment, the best hyperparameter optimization algorithm for each original site is encoded (GWO-1, PSO-2, WOA-3, WSO-4), and the distribution of each distribution characteristic index on the original site type is statistically analyzed as follows: Figure 2 (coefficient of variation), Figure 3 (Hurst exponent), Figure 4 (kurtosis), Figure 5 (skewness), where the horizontal axis is the code of the best hyperparameter optimization algorithm. Since no original site obtains the optimal result through WSO in this embodiment, Figure 2 , Figure 3 , Figure 4 , Figure 5 There is no fourth box plot. According to the optimal hyperparameter optimization algorithm for each original site in this embodiment, the selection conditions for the distribution characteristic index are summarized as follows:

[0167] (1) When the kurtosis coefficient is low (kurtosis < 0), it means that the distribution of the data is flatter than the normal distribution (that is, the concentration of data near the mean is low, and there are more data points far away from the mean). In this case, the GWO optimization algorithm should be used;

[0168] (2) When the kurtosis coefficient is high (kurtosis>6), it means that the data distribution is very steep (that is, the data is highly concentrated near the mean), or when the Hurst index is high (Hurst index>1.5), it means that the data has long-term memory, that is, the current state has an impact on the future state. In this case, the PSO optimization algorithm should be used;

[0169] 3) When the coefficient of variation is in a specific range (0.8 < CoV < 1.0) and the skewness coefficient is relatively large (skewness > 1.5), it means that the data has a certain degree of discreteness and is significantly asymmetric. In this case, the WOA optimization algorithm is preferably selected;

[0170] 4) For the remaining non - conforming cases, the WSO optimization algorithm is preferably selected.

[0171] It should be noted that in this example, the reference values of the indicators are used for preliminary division. Preferably, classification methods such as random forest and logistic regression in machine learning can also be used to match the hyperparameter optimization algorithm.

[0172] In addition, the above - mentioned correlation relationship between the best hyperparameter optimization algorithm and the distribution characteristic indicators is only taken as an example. The specific correlation relationship can be determined according to the actual situation (such as the specific characteristics of the data, the nature of the model, the optimization goal, etc.). The embodiments of this application do not limit this and allow adjustment according to the actual situation.

[0173] It should be emphasized that for different climate intervals and different river basins, the above - mentioned index division values will be different. The method of forming new indicators through linear transformation or combination of the relevant indicators in the method of this embodiment for matching the relevant hyperparameter optimization algorithm is also within the protection scope of this application.

[0174] The above - mentioned method establishes a correlation relationship mapping set, so that when selecting the hyperparameter optimization algorithm for newly added stations in the future, the appropriate best hyperparameter optimization algorithm can be matched through the analysis of the distribution characteristic indicators, improving the prediction accuracy obtained by the initial selection of the hyperparameter optimization algorithm.

[0175] Step S150, determine the best hyperparameter optimization algorithm for the newly added station according to the correlation relationship mapping set, and use the best hyperparameter optimization algorithm of the newly added station to perform runoff prediction on the newly added station to obtain the predicted value of the runoff data of the newly added station.

[0176] It can be understood that for a newly added station, the appropriate best hyperparameter optimization algorithm can be directly matched according to the correlation relationship mapping set, and then accurate prediction can be carried out. The specific steps are as follows: First, obtain the observed value of the runoff data of the newly added station, and calculate the distribution characteristic indicators of the newly added station according to the calculation process of the distribution characteristic indicators in step S130; then determine the best hyperparameter optimization algorithm corresponding to the distribution characteristic indicators of the newly added station according to the correlation relationship mapping set in step S140; directly use the best hyperparameter optimization algorithm of the newly added station to establish a model and perform prediction to predict the predicted value of the runoff data of the newly added station.

[0177] Exemplarily, the newly added station, its distribution characteristic indicators, and the best hyperparameter optimization algorithm are shown in Table 3 below:

[0178] Table 3

[0179]

[0180] In order to verify the prediction accuracy of the above matching algorithm, each optimization algorithm in the hyperparameter optimization algorithm library is used in turn to optimize the hyperparameters, and the prediction is performed with the optimal hyperparameters. The prediction results are as follows: Figure 6 (GONGJU Station), Figure 7 (BAHADURABAD STATION), Figure 8 (ZHIMENGDA Station) shown.

[0181] Depend on Figure 6 It can be seen that the optimization algorithm used for the predicted value closest to the actual observation value of the GONGJU station is WOA, which is the same as the optimization algorithm matched by the association relationship mapping set in Table 3. The optimization algorithms and hyperparameter sets are shown in Table 4 below (arranged in descending order of accuracy):

[0182] Table 4

[0183]

[0184] Depend on Figure 7 It can be seen that the optimization algorithm used for the predicted value closest to the actual observation value of the BAHADURABAD station is GWO, which is the same as the optimization algorithm matched by the association relationship mapping set in Table 3. The optimization algorithms and hyperparameter sets are shown in Table 5 below (arranged in descending order of accuracy):

[0185] Table 5

[0186]

[0187] Depend on Figure 8 It can be seen that the optimization algorithm used for the predicted value closest to the actual observation value of the ZHIMENGDA station is PSO, which is the same as the optimization algorithm matched by the association relationship mapping set in Table 3. The optimization algorithms and hyperparameter sets are shown in Table 6 below (arranged in descending order of accuracy):

[0188] Table 6

[0189]

[0190] From the comparison curve of the prediction accuracy of the newly added stations, it can be seen that the best hyperparameter optimization algorithm selected has achieved better results among similar optimization algorithms in the prediction process. The results show that the distribution characteristic index obtained by calculating the index of long-term runoff data can be used as the basis for matching the long-term and short-term memory network model and the best hyperparameter optimization algorithm to quickly improve the prediction accuracy of the model under the condition of only calculating the distribution characteristic index.

[0191] The runoff prediction method based on hyperparameter optimization provided in the embodiment of the present application is based on the LSTM model. By establishing an association between distribution characteristic indicators and hyperparameter optimization algorithms, in the prediction of subsequent new sites, only the data distribution characteristic indicators are used to adaptively match the best hyperparameter optimization algorithm, thereby achieving the effect of quickly improving the site prediction accuracy by only executing a single optimization algorithm driven by the data model.

[0192] Example 2

[0193] like Fig. 9 , which is a schematic diagram of the structure of a runoff prediction device 900 based on hyperparameter optimization in an embodiment of the present application, wherein the device comprises:

[0194] A construction module 910 is used to obtain runoff data observation values ​​of multiple original sites and construct a hyperparameter optimization algorithm library, which includes multiple optimization algorithms;

[0195] The optimization module 920 is used to construct a long short-term memory network model based on the runoff data observation value and the hyperparameter optimization algorithm library, and sequentially use each optimization algorithm in the hyperparameter optimization algorithm library to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters;

[0196] A determination module 930 is used to use the optimal hyperparameters to predict the runoff of each original site, determine the optimal hyperparameter optimization algorithm for each original site, and use the optimal hyperparameter optimization algorithm for each original site to calculate the distribution characteristics of the runoff data of the corresponding original site to obtain the distribution characteristic index of each original site;

[0197] The association module 940 is used to perform association analysis on the best hyperparameter optimization algorithm and the distribution characteristic index of each original site to obtain a mapping set of association relationships between the best hyperparameter optimization algorithm and the distribution characteristic index;

[0198] The prediction module 950 is used to determine the best hyperparameter optimization algorithm for the newly added site according to the association relationship mapping set, and use the best hyperparameter optimization algorithm for the newly added site to predict the runoff of the newly added site to obtain the predicted value of the runoff data of the newly added site.

[0199] The runoff prediction device based on hyperparameter optimization provided in the embodiment of the present application can implement the process of the runoff prediction method based on hyperparameter optimization corresponding to Example 1, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0200] A computer device is also provided in an embodiment of the present disclosure. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the steps of the runoff prediction method based on hyperparameter optimization in Example 1 are implemented.

[0201] A computer-readable storage medium is also provided in an embodiment of the present disclosure. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of the runoff prediction method based on hyperparameter optimization in Example 1 are implemented.

[0202] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A runoff prediction method based on hyperparameter optimization, characterized in that: The method comprises: Obtaining runoff data observation values ​​of multiple original sites and constructing a hyperparameter optimization algorithm library, wherein the hyperparameter optimization algorithm library includes multiple optimization algorithms; Based on the runoff data observations and the hyperparameter optimization algorithm library, a long short-term memory network model is constructed, and each optimization algorithm in the hyperparameter optimization algorithm library is sequentially used to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters; Using the optimal hyperparameters to predict runoff for each of the original sites, determining the optimal hyperparameter optimization algorithm for each of the original sites, and using the optimal hyperparameter optimization algorithm for each of the original sites to calculate the distribution characteristics of runoff data of the corresponding original site, to obtain the distribution characteristic index of each of the original sites; Performing correlation analysis on the best hyperparameter optimization algorithm and the distribution characteristic index of each of the original sites to obtain a correlation relationship mapping set between the best hyperparameter optimization algorithm and the distribution characteristic index; An optimal hyperparameter optimization algorithm for the newly added site is determined according to the association relationship mapping set, and the optimal hyperparameter optimization algorithm for the newly added site is used to perform runoff prediction on the newly added site to obtain a predicted value of runoff data for the newly added site.

2. The runoff prediction method based on hyperparameter optimization according to claim 1 is characterized in that: Before constructing the long short-term memory network model based on the runoff data observation value and the hyperparameter optimization algorithm library, the method further includes: Dividing the runoff data observations into training runoff data and verification runoff data according to a preset ratio; Design basic parameters of the long short-term memory network model, wherein the basic parameters include at least one of the number of layers, input dimension, output dimension, random initialization, prediction step size, and training loss.

3. The runoff prediction method based on hyperparameter optimization according to claim 2 is characterized in that: The step of sequentially using the optimization algorithms in the hyperparameter optimization algorithm library to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters includes: Determine the hyperparameters of the long short-term memory network model, and set the framework parameters of each optimization algorithm in the hyperparameter optimization algorithm library; Generate a plurality of hyperparameter combinations using the optimization algorithms after setting, and train the long short-term memory network model based on the hyperparameter combinations and the verification runoff data and using a preset objective function to obtain a plurality of objective function values; The hyperparameter combinations are sorted according to the objective function value, and the hyperparameter combination with the best objective function value is selected as the optimal hyperparameter.

4. The runoff prediction method based on hyperparameter optimization according to claim 2 is characterized in that: The method of using the optimal hyperparameters to predict runoff at each of the original sites and determining the optimal hyperparameter optimization algorithm for each of the original sites includes: Using the long short-term memory network model containing the optimal hyperparameters to perform runoff prediction on each of the original sites, and obtain the predicted value of runoff data of each of the original sites; According to the runoff data prediction value and verification runoff data of each of the original sites, the prediction accuracy evaluation result is obtained by using the absolute percentage error and the coefficient of determination; The best hyperparameter optimization algorithm for each of the original sites is determined according to the prediction accuracy evaluation result.

5. The runoff prediction method based on hyperparameter optimization according to claim 1 is characterized in that: The distribution characteristic index includes coefficient of variation and kurtosis. The optimal hyperparameter optimization algorithm of each original site is used to calculate the distribution characteristics of the runoff data of the corresponding original site to obtain the distribution characteristic index of each original site, including: Arranging the runoff data observation values ​​of each of the original stations in chronological order to obtain a time series; Calculate the mean and standard deviation of the time series of the corresponding original site using the best hyperparameter optimization algorithm of each original site, and calculate the coefficient of variation according to the mean and standard deviation of the time series; The length of the time series is determined, and the kurtosis is calculated according to the mean, standard deviation and length of the time series.

6. The runoff prediction method based on hyperparameter optimization according to claim 5 is characterized in that: The distribution characteristic index also includes skewness and Hurst index. The optimal hyperparameter optimization algorithm for each original site is used to calculate the distribution characteristics of the runoff data of the corresponding original site to obtain the distribution characteristic index of each original site, and also includes: Obtaining an expected value of the time series, and calculating the skewness according to the mean, standard deviation and expected value of the time series; A cumulative deviation sequence is determined according to the mean, the range and standard deviation of the cumulative deviation sequence are calculated, and the Hurst index is calculated according to the range and standard deviation of the cumulative deviation sequence.

7. The runoff prediction method based on hyperparameter optimization according to claim 1 is characterized in that: The step of determining the best hyperparameter optimization algorithm for the newly added site according to the association relationship mapping set, and using the best hyperparameter optimization algorithm for the newly added site to perform runoff prediction on the newly added site to obtain the predicted value of runoff data for the newly added site includes: Obtaining the runoff data observation value of the newly added site, and calculating the distribution characteristic index of the newly added site according to the runoff data observation value of the newly added site; An optimal hyperparameter optimization algorithm corresponding to the distribution characteristic index of the newly added site is determined according to the association relationship mapping set.

8. A runoff prediction device based on hyperparameter optimization, characterized in that: The device comprises: A construction module is used to obtain runoff data observation values ​​of multiple original sites and construct a hyperparameter optimization algorithm library, wherein the hyperparameter optimization algorithm library includes multiple optimization algorithms; An optimization module, used for constructing a long short-term memory network model based on the runoff data observation value and the hyperparameter optimization algorithm library, and sequentially using each optimization algorithm in the hyperparameter optimization algorithm library to optimize the hyperparameters of the long short-term memory network model to determine the optimal hyperparameters; A determination module is used to use the optimal hyperparameters to predict the runoff of each of the original sites, determine the optimal hyperparameter optimization algorithm for each of the original sites, and use the optimal hyperparameter optimization algorithm for each of the original sites to calculate the distribution characteristics of the runoff data of the corresponding original site to obtain the distribution characteristic index of each of the original sites; An association module is used to perform association analysis on the best hyperparameter optimization algorithm and the distribution characteristic index of each of the original sites to obtain a mapping set of association relationships between the best hyperparameter optimization algorithm and the distribution characteristic index; The prediction module is used to determine the best hyperparameter optimization algorithm for the newly added site according to the association relationship mapping set, and use the best hyperparameter optimization algorithm for the newly added site to predict the runoff of the newly added site to obtain the predicted value of the runoff data of the newly added site.

9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the runoff prediction method based on hyperparameter optimization described in any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the runoff prediction method based on hyperparameter optimization according to any one of claims 1 to 7 are implemented.