An integrated learning-based short-term water level prediction method
By employing an ensemble learning approach, combining operational condition identification and site relationship embedding, the problems of trend tracking, peak characterization, and anomaly adaptation in short-term water level forecasting were solved, achieving higher forecast accuracy and stability.
Patent Information
- Application Number
- CN202611250325.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-17
AI Technical Summary
Existing short-term water level forecasting technologies struggle to balance trend tracking and peak value characterization, adapt to abnormal disturbances and operational condition switching, and fail to adequately utilize the river network relationships between stations, resulting in large forecast errors and poor stability.
An ensemble learning-based approach is adopted, which uses working condition identification, sub-working condition learners, and site relationship embedding, combined with residual time shift correction and a similar event error library, to perform short-term water level forecasting.
It improves the accuracy and stability of short-term water level forecasts, enhances the ability to characterize peak processes, and improves the ability to generalize across sites.
Smart Images

Figure CN123115752A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water level forecasting technology, and in particular to a short-term water level forecasting method based on ensemble learning. Background Technology
[0002] Water level forecasting is a crucial component of hydrological forecasting and flood control scheduling, widely applied in scenarios such as river flood control, reservoir operation, urban flooding early warning, and joint operation of dams and sluices. With the development of automatic monitoring networks, telemetry communication, and computing capabilities, existing short-term water level forecasting technologies have evolved from traditional empirical extrapolation and statistical regression models to data-driven methods based on machine learning and deep learning, such as support vector machines, random forests, gradient boosting trees, recurrent neural networks, long short-term memory networks, and their improved models. These methods can extract nonlinear relationships from historical water levels, flow rates, rainfall, and scheduling information, thus improving the accuracy of short-term forecasts to a certain extent.
[0003] Short-term water level changes are often influenced by multiple factors simultaneously, including upstream inflow, local rainfall, gate operation, river network propagation, and downstream backwater, resulting in rapid fluctuations, sharp peaks, high noise, and complex operating conditions. Current technologies typically train and predict models using a single set of samples from different operating conditions, making it difficult to differentiate models for different stages of change, such as stable periods, rising periods, peak periods, falling periods, and disturbance periods. This leads to insufficient adaptability of the models to complex water level processes.
[0004] The existing technology still has the following shortcomings:
[0005] 1. It is difficult to balance trend tracking and peak characterization. Most existing models focus on optimizing the overall mean square error and pay insufficient attention to the peak arrival time, peak amplitude and peak shape changes. This can easily lead to premature forecasting, delayed forecasting or peak amplitude deviation, and the error is more obvious in scenarios with rapid changes in flood peak.
[0006] 2. It has weak adaptability to abnormal disturbances and operating condition changes. When rainfall changes abruptly, gates are frequently adjusted, or upstream water propagates, the water level sequence will exhibit obvious non-stationarity. Existing single-model or simple ensemble methods often lack specialized modeling and correction mechanisms for different operating conditions, making it difficult to correct prediction errors in abnormal segments in a timely manner.
[0007] 3. Insufficient utilization of river network relationships and historical response differences between stations. Different stations are significantly affected by river network distance, confluence path and response delay. Existing technologies often directly splice the characteristics of each station, lacking explicit modeling of station topology relationships and response differences, resulting in limited generalization ability of the model between different stations and unstable cross-station adaptation effect.
[0008] Therefore, there is an urgent need for a short-term water level forecasting method that can combine multi-source hydrological information, operating condition identification, station relationship modeling, and peak error correction to improve the accuracy, stability, and ability to characterize peak processes in short-term water level forecasting under complex conditions. Summary of the Invention
[0009] The purpose of this invention is to propose a short-term water level forecasting method based on ensemble learning. Addressing the issues of rapid water level fluctuations, peak spikes, and numerous abnormal operating conditions under multiple source disturbances, the method first collects multi-source hydrological and scheduling data from the target station and its upstream related stations to construct multi-step forecast samples. Then, based on the rate of rise, second-order difference, cumulative rainfall, gate state change rate, and upstream-downstream response difference, operating condition vectors are generated and divided into operating conditions. Initial values are output by trend base learners, peak base learners, and disturbance base learners, respectively. These initial values are then stacked and fused by a meta-learner. A secondary correction is completed by combining residual time shift correction, similar event error library retrieval, and peak window reweighting, thereby outputting the short-term water level forecast curve and the time of exceeding the threshold.
[0010] This invention provides a short-term water level forecasting method based on ensemble learning, comprising: S1, acquiring historical water levels, flow rates, rainfall, gate openings, downstream backwater conditions, and station topological features of the target station and its upstream related stations, and constructing multi-step forecast samples according to a sliding time window; S2, calculating water level rise rate, second-order difference, rainfall accumulation, gate state change rate, and upstream-downstream response difference based on the multi-step forecast samples, generating a condition vector, and determining the condition probabilities of stable, rising, peak, falling, and disturbed segments accordingly; S3 S1. Based on the operating condition probability, the trend base learner, peak base learner, and perturbation base learner are called respectively, and their corresponding short-term water level initial values are output; S4. The short-term water level initial values, operating condition probabilities, station relationship embedding representations, and recent observation residual sequences are input into the meta-learner and stacked and fused to obtain multi-step short-term water level forecast values; S5. Based on the recent observation residual sequence, a time shift correction term is constructed to perform lead correction, lag correction, and amplitude deviation correction on the multi-step short-term water level forecast values, and the forecast curve and the time of exceeding the threshold are output.
[0011] Optionally, S1 includes: aligning historical water levels, flow rates, rainfall, gate openings, and downstream backwater over time, and constructing a station relationship matrix based on the river network distance, confluence path, and historical correlation coefficient of relevant upstream stations;
[0012] Based on the site relationship matrix and the sliding time window, multi-step forecast samples containing an input window, a prediction window, and a label window are generated.
[0013] Optionally, S2 includes: standardizing and concatenating the water level rise rate, second-order difference, rainfall accumulation, gate state change rate, and upstream-downstream response difference into a working condition vector, and calculating the probability of each working condition according to the normalized distance between the working condition vector and the center vectors of various types in the historical working condition sample library, wherein the boundaries of the stable segment, rising segment, peak segment, falling segment, and disturbance segment of the historical working condition sample are determined by the rise rate quantile, peak width quantile, and falling slope quantile of the corresponding sample;
[0014] Furthermore, after step S2, the method also includes constructing a similar event error library, which stores the residual templates of historical events and recommended time shifts according to the rate of increase, peak height, peak width, rainfall pattern, gate action sequence and site code.
[0015] During online prediction, similar events are retrieved from the similar event error library based on the current sample's working condition vector, and the retrieved residual templates are input into the meta-learner as correction features.
[0016] Furthermore, when retrieving similar events, the similarity between the current sample and historical events is determined based on the weighted distance in terms of rate of increase, peak height, peak width, rainfall pattern, gate action sequence, and station code. At least one historical event with the highest similarity is selected, and its residual template and the recommended time shift are normalized according to the similarity and then input into the meta-learner.
[0017] Furthermore, the peak window reweighting module divides the prediction window into a pre-peak segment, a peak segment, and a post-peak segment, and determines the weights of the pre-peak segment, the peak segment, and the post-peak segment based on the quantile statistics of historical peak height and peak width. The peak segment weight is obtained by mapping the quantile value of the absolute value of the historical peak residual, and is used to perform segmented fusion of the time series values output by the meta-learner.
[0018] Furthermore, when training the trend base learner, peak base learner, perturbation base learner, and meta-learner, segmented losses for the pre-peak segment, peak segment, and post-peak segment are introduced. The segmented losses include a peak arrival time deviation term, a peak amplitude deviation term, and a time shift penalty term, and the losses are weighted and summed according to the three segment weights output by the peak window reweighting module.
[0019] Optionally, S3 includes: training a trend base learner for samples of the stable and rising segments, training a peak base learner for samples of the peak segment, and training a perturbation base learner for samples of the falling and perturbation segments.
[0020] During prediction, the outputs of each learner are weighted according to the probability of the operating condition to obtain the corresponding short-term water level initial value.
[0021] Optionally, S4 includes: constructing a site relationship embedding representation based on the site relationship matrix, the confluence path from upstream to the target station, and the historical response correlation coefficient, and inputting the short-term water level initial value, operating probability, site relationship embedding representation, and recent observation residual sequence into the meta-learner;
[0022] The meta-learner generates fusion weights based on the output variance of each learner and the direction of recent observation residuals, in order to output the multi-step short-time water level forecast values.
[0023] Optionally, S5 includes: determining the time shift based on the cross-correlation peak value of the recent observation residual sequence and the forecast increment sequence corresponding to the multi-step short-time water level forecast value, mapping the time shift to time advance correction, time lag correction and amplitude deviation correction coefficients, and outputting the time exceeding the threshold after hourly correction of the forecast curve.
[0024] The beneficial effects of this invention are:
[0025] 1. By dividing the working conditions and using a sub-working condition learner to collaboratively process stable, rising, peak, falling and disturbance phases, the ability to track short-term water level trends is improved.
[0026] 2. By using a similar event error library and time shift correction, directional correction is performed on abnormal operating conditions and peak segment errors, reducing advance or lag forecasts and amplitude deviations.
[0027] 3. By embedding site relationships and reweighting peak windows, the generalization ability between different sites is enhanced and the consistency between peak time and peak amplitude is improved. Attached Figure Description
[0028] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0029] Figure 1 This is a flowchart of a short-term water level forecasting method based on ensemble learning.
[0030] Figure 2 This is a flowchart of the time shift and amplitude deviation correction included in step S5 of the present invention. Detailed Implementation
[0031] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0032] refer to Figures 1-2A short-term water level forecasting method based on ensemble learning includes: S1, acquiring historical water levels, flow rates, rainfall, gate openings, downstream backwater conditions, and station topological features of the target station and its upstream related stations, and constructing multi-step forecast samples according to a sliding time window; S2, calculating water level rise rate, second-order difference, rainfall accumulation, gate state change rate, and upstream-downstream response difference based on the multi-step forecast samples, generating a condition vector, and determining the condition probabilities of stable segment, rising segment, peak segment, receding segment, and disturbance segment accordingly; S3, based on the... The operating condition probability calls the trend base learner, peak base learner, and perturbation base learner respectively, and outputs their corresponding short-term water level initial values; S4, the short-term water level initial values, operating condition probabilities, station relationship embedding representations, and recent observation residual sequences are stacked and fused into the meta-learner to obtain multi-step short-term water level forecast values; S5, a time shift correction term is constructed based on the recent observation residual sequence, and the multi-step short-term water level forecast values are corrected by lead correction, lag correction, and amplitude deviation correction, and the forecast curve and the time of exceeding the threshold are output.
[0033] In this specific embodiment, S1 includes:
[0034] Historical data of the target station and its upstream related stations are acquired and time-aligned according to a unified time benchmark, where the target station is denoted as station. The set of upstream related sites is denoted as The total number of sites is ;
[0035] The collected historical data includes water level sequences, flow sequences, rainfall sequences, gate opening sequences, and downstream backwater sequences for each station, and the topological attributes of each station in the river network are obtained simultaneously for subsequent relationship modeling.
[0036] Time alignment uses a fixed time step. An equally spaced time axis is used to project the original observations onto the time axis according to their timestamps and then resample them. The resampling rule is that when there are multiple records within the same time step, the arithmetic mean is taken; when there are no records within the same time step, linear interpolation is used to fill in the gaps, and the interpolation span does not exceed a certain value. Missing time steps exceeding this span are marked as unavailable and samples containing unavailable time steps are removed during sample construction. This yields aligned feature sequences for all stations on the same time axis, ensuring a strict temporal correspondence between input and label features. The matrix construction is based on deterministic calculations of river network distances, confluence paths, and historical correlation coefficients of upstream related stations. Arbitrary stations are then extracted from the river network topology. to station River network distance It is measured in km, and the confluence path indicator is determined based on the river network connectivity. If and only if the site Located at the station When taking the upstream confluence path Otherwise take ;
[0037] Historical correlation coefficients were obtained using Pearson correlation coefficients and with a length of [missing information]. The historical window is calculated at each time step, and the calculation object is the site. Traffic sequences and sites The water level sequence, and the stations before calculation A fixed propagation delay is applied to the flow sequence to reflect the confluence response, with the propagation delay varying according to the river network distance and a fixed propagation velocity. The correlation coefficient is obtained by converting the time steps and rounding them. And the range of values is ;
[0038] Based on this, construct a site relationship matrix. Its elements The following method is used to determine and quantify the intensity of inter-site impact:
[0039] ;
[0040] in Indicates site For the site The strength of the relationship Indicates the flow path indicator quantity. Indicates the distance of the river network. Represents the distance attenuation scale and takes Represents the historical correlation coefficient. Represents an exponential function. Indicates by all The site relationship matrix is constructed and then normalized row-wise so that the sum of the elements in each row is 1, so that it can be used as a stable weight input in subsequent site relationship embedding. The sliding time window sample construction adopts a multi-step forecast sample structure including an input window, a prediction window, and a label window, and in this embodiment, the length of the input window is taken as... Each time step, prediction window length Each time step has a label window and a prediction window that correspond one-to-one;
[0041] Termination time for each available sample The input window is defined as The multi-source aligned feature sequences of all stations are concatenated in the order of "station dimension × time dimension × variable dimension" to form the input tensor. The prediction window is defined as... The time index set is used to indicate the future time that needs to be output, and the label window is defined as the target station. exist The actual water level sequence within the area is used as a monitoring signal;
[0042] During sample generation, a sample is generated only when all alignment features involved in the input window and label window are available time steps, and the generated sample is compared with the site relationship matrix. The data are stored together for use in steps S2 to S5, thereby completing the multi-source data alignment, site relationship matrix construction, and multi-step forecast sample generation in step S1.
[0043] In this specific embodiment, S2 includes:
[0044] The product generated in step S1 Based on the multi-step forecast samples with time steps, the working condition vector is generated and the working condition probability is calculated. After the working condition probability calculation is completed, a similar event error library and its retrieval rules are established. At the same time, the peak window reweighting parameters are formed and solidified into the segmented loss configuration used in subsequent model training.
[0045] For any sample termination time From the target station Extracting water level rise rate from aligned water level sequences With second-order difference ,in The intensity of the rise or fall is determined by dividing the water level difference between two adjacent moments by the time step. The peak and inflection point characteristics are characterized by the second-order discrete difference between the current water level and the water levels at the previous two moments.
[0046] Extracting Rainfall Accumulation from Aligned Rainfall Sequences ,in Defined as The endpoint is and the length is The cumulative rainfall at each time step is used to characterize proximate rainfall input;
[0047] Extracting the gate state change rate from the aligned gate opening sequence ,in Defined as the difference in gate opening between two adjacent moments divided by the time step to characterize the intensity of the scheduling action;
[0048] Collection from upstream related sites Site Relationship Matrix Extracting upstream and downstream response differences First press The upstream response water level is obtained by weighting and summing the water levels of each upstream station according to the relationship strength of the corresponding column of the target station and superimposing the sum with the propagation delay consistent with the river network distance. The difference between this upstream response water level and the current water level of the target station is then defined. To characterize the degree of inconsistency in upstream and downstream responses;
[0049] The five features mentioned above are standardized according to the mean and standard deviation of the corresponding features in the historical working condition sample database. The historical working condition sample database consists of the five features of all samples during the training period, and the mean and standard deviation are calculated and fixed once in the offline stage. The standardized features are concatenated into a working condition vector in a fixed order. ,in This represents the standardized rate of increase in water level. This represents the standardized second-order difference. This represents the standardized cumulative rainfall. This represents the standardized rate of change of the gate state. This indicates the difference in upstream and downstream response after standardization. Indicates transpose;
[0050] The historical operating condition sample database was annotated offline, and center vectors for each operating condition were generated. During annotation, the boundaries were determined using the quantiles of water level rise rate, peak width, and fall slope to ensure the uniqueness of the annotation results. The quantiles of water level rise rate were obtained during the training period. 0.2 quantile With the 0.8 quantile The 0.8 quantile of the peak width during the training period was used as the stationary boundary and the significant fluctuation boundary, respectively. As the boundary of the peak segment, the quantile of the retracement slope is taken as the 0.8 quantile of the absolute value of the retracement slope during the training period. As the boundary of the pullback segment;
[0051] The peak width is defined as the area around the local maximum water level. The number of consecutive time steps, satisfying that the water level at that time step is not lower than The slope of the decline is defined as the average rate of decrease in water level over three consecutive time steps after the peak.
[0052] Based on this, the sample time is divided into five types of operating conditions: stable segment, rising segment, peak segment, falling segment, and disturbance segment, and the center vector of the corresponding operating condition is calculated for each. ,in Indicates a stable segment. Indicates an upward trend. Indicates the peak segment. Indicates the pullback segment. Indicates the disturbance segment. According to the vector of all working conditions of this type The arithmetic mean is obtained;
[0053] When calculating the probability of a working condition online, first calculate With each The normalized distance between them is used to obtain the working condition probability vector through the soft maximum function. The calculation formula is as follows:
[0054] ;
[0055] in Indicates time Belongs to the The probability of such working conditions Represents an exponential function. Represents the L2 distance. Indicates time The working condition vector, Indicates the first The center vector of the working condition Represents the temperature coefficient and takes Indicates the working condition category index. Represents the summation operator;
[0056] After completing the probability calculation of operating conditions, a similar event error library is constructed. The similar event error database uses events as basic units and is indexed and stored according to rise rate, peak height, peak width, rainfall pattern, gate action sequence, and station code. Events are selected from the target station water level sequence during the training period that satisfy a pre-peak rise rate greater than [missing information]. And the absolute value of the slope of the fall after the peak is greater than The local peak process was captured, and the peak height was defined as the difference between the peak water level and the starting water level of the event. The peak width was obtained using the same method as described above. The continuous time step definition defines the rainfall pattern, which is uniquely determined by the time distribution of rainfall within the event input window and is divided into three categories: pre-event, uniform, and post-event. The pre-event type... If the proportion of rainfall at a given time step to the cumulative rainfall is not less than 0.7, it is considered a pre-rainfall type. If the proportion of rainfall at a given time step to the cumulative rainfall is not less than 0.7, it is classified as a post-processing type; otherwise, it is classified as a uniform type. The gate action sequence is continuously calculated from the end of the input window. The sign of the gate opening increment at each time step is uniquely determined and used... These represent closing, maintaining, and opening respectively. The site code uses the target site. A unique integer encoding;
[0057] For each historical event, the error library stores the residual template. and recommended time shift ,in For the prediction window length, the residual template The recommended time shift amount is calculated hourly based on the difference between the multi-step forecast output (excluding time shift correction) and the corresponding actual water level during offline playback of this historical event, and is then bound and saved to the event. In the set of integers The inner search maximizes the cross-correlation between the residual template and the event prediction increment sequence, and then selects the corresponding value. And save it together with the residual template;
[0058] Online prediction is based on the working condition vector of the current sample. In the similar event error library The search for similar events is performed by calculating the search distance as a weighted sum of differences in tension rate, peak height, peak width, rainfall pattern, gate action sequence, and station coding, with a fixed weight. And select the one with the smallest distance. Each event is treated as a set of similar events. The residual template of the set of similar events is normalized with the recommendation time shift by the inverse of the distance to obtain the fusion weight, and then output as the correction feature for the meta-learner of S4 to call.
[0059] Simultaneously, peak window reweighting parameters are generated during the offline phase and written into the configuration table. The peak window will be the prediction window. The peak is divided into three sections: the fore-peak section, the summit section, and the post-peak section, with the summit section having a length of [missing information]. Furthermore, the peak segment is located on both sides of the peak time within the prediction window. The pre-peak segment is the set of time steps before the peak segment, and the post-peak segment is the set of time steps after the peak segment. The weights of the three segments are uniquely determined by the quantile statistics of the peak height and peak width during the training period and the quantile statistics of the absolute value of the historical peak residual. The peak segment weight is set when the 0.8 quantile of the absolute value of the historical peak residual is not greater than 0.10m. Set when the distance is greater than 0.10m and not greater than 0.20m. When the value is greater than 0.20m, set And make the weight of the peak segment Weighting of the post-peak segment To ensure that the sum of the weights of the three segments is 1;
[0060] Segmented loss is introduced when training the trend base learner, peak base learner, perturbation base learner, and meta-learner. The segmented loss consists of a peak arrival time deviation term, a peak amplitude deviation term, and a time shift penalty term, and each term uses the weights of the peak front segment. Peak segment weight Post-peak weighting Weighting is applied, where the peak arrival time deviation term is calculated as the absolute difference between the predicted peak time index and the actual peak time index within the prediction window, the peak amplitude deviation term is calculated as the absolute difference between the predicted peak value and the actual peak value within the prediction window, and the time shift penalty term is calculated as the recommended time shift amount. Calculate the absolute value and multiply by a fixed penalty coefficient. This allows the division of operating conditions, correction of similar events, and reweighting of peak windows to work synergistically under the same training statistical caliber in the subsequent prediction and correction process.
[0061] In this specific embodiment, S3 includes:
[0062] Based on multi-step forecast samples and operating condition probabilities Complete the training of the condition-based learner and output the short-term initial water level value online;
[0063] For any sample termination time , input window length The multi-source aligned features within each time step are concatenated in chronological order into the input sequence. ,in Indicates the length of the input window. This represents the feature dimension at each time step. Indicates the total number of sites. This represents the number of variables at each station at each time step, in the following order: water level, flow rate, rainfall, gate opening, and downstream backwater. The The line represents the time step. The corresponding vector is a concatenation of all site variables;
[0064] The corresponding monitoring tag is the target site. In prediction window length The true water level sequence at each time step ,in Indicates the number of prediction steps. The Each component represents a time. The actual water level;
[0065] During the offline training phase, each sample is first classified into a unique working condition category based on the principle of maximizing the probability of the working condition. ,in Indicates time Working condition category index, Indicates time Belongs to the The probability of each working condition is determined, and three unique samples are constructed using a two-layer long short-term memory network structure. Both the first and second layers have 64 hidden units, and Dropout with a dropout rate of 0.1 is used between the two layers. The hidden state of the second layer at the last time step is mapped through a fully connected layer. Output multi-step water level prediction;
[0066] Peak basis learner The operating condition category meets the requirements. The sample data was processed using a temporal convolutional network structure. The network consisted of four residual blocks connected in series, with each residual block containing a one-dimensional causal convolution, a ReLU activation, and a residual connection. The kernel size was set to 3, and the dilation coefficients were set sequentially to... The number of channels is taken in sequence. The Dropout value within the residual block is set to 0.1. After global average pooling of the last layer's temporal features, the data is mapped through a fully connected layer. Output multi-step water level prediction;
[0067] Perturbation base learner The operating condition category meets the requirements. The samples were processed using a two-layer gated recurrent unit network structure. Both layers had 64 hidden units and an inter-layer Dropout rate of 0.1. The hidden states of the second layer at all time steps were converged through temporal attention to obtain a context vector, which was then mapped through a fully connected layer. Output multi-step water level prediction;
[0068] All three base learners are trained using the Adam optimizer with a learning rate of [value missing]. The batch size is set to 256, the number of training rounds is set to 50, and the loss function is the hourly mean square error between the predicted sequence and the true sequence on non-peak samples. On peak samples, the peak window reweighting and segmented loss configuration solidified in step S2 are superimposed to constrain the peak arrival time deviation, peak amplitude deviation and time shift penalty, and ensure that the training objective is consistent with the subsequent peak focus.
[0069] Online prediction phase for the same input sequence Call each Obtain three-way multi-step prediction output And based on the probability of working conditions The outputs of each learner are weighted to form a short-term initial water level value for stacking and fusion in step S4. The calculation is as follows:
[0070] ,
[0071] ,
[0072] ;
[0073] in This represents the short-term initial water level sequence corresponding to the trend base learner. This represents the short-time initial water level sequence corresponding to the peak basis learner. This represents the short-time initial water level sequence corresponding to the perturbation base learner. This represents the multi-step prediction output of the trend base learner. This represents the multi-step prediction output of the peak basis learner. This represents the multi-step prediction output of the perturbation base learner. to These represent the operating probabilities for the steady phase, the rising phase, the peak phase, the falling phase, and the disturbance phase, respectively. This indicates the sample termination time, thereby enabling the generation of the sub-condition learner output triggered by the working condition probability and the short-term water level initial value, and providing deterministic input for subsequent meta-learner stacking and fusion.
[0074] In this specific embodiment, S4 includes:
[0075] The initial short-term water level values are stacked and fused to generate multi-step short-term water level forecast values. Specifically, the site relationship embedding representation is first constructed, then the meta-learner is constructed to input features and output fusion weights.
[0076] Site relationship embedding representation based on site relationship matrix Upstream to target station The confluence path and historical response correlation coefficients were completed, with each site... Construct node feature vectors The four components are, in order, the river network distance from the station to the target station. through Normalized values, from the site to the destination station Convergence path length through Normalized values, historical correlation coefficient linearly mapped to The following values, station degrees through Normalized value, confluence path length The station degree is defined as the number of edges on the confluence path and is uniquely determined by the river network topology. Defined as the sum of the in-degree and out-degree of the station in the river network topology, and uniquely determined by the river network topology;
[0077] The node feature matrix is obtained by stacking the node features of all sites according to their site indices. and in Adding a self-join to get Then normalize by row to obtain ,in Represents the identity matrix. This represents the normalized relation matrix;
[0078] A two-layer graph convolutional network is used to generate the site embedding matrix. First layer weight matrix With the second layer weight matrix During offline training, backpropagation is used to determine that the inter-layer activation function is ReLU and batch normalization is not employed. The row vector corresponding to the target station is taken as the site relationship embedding representation. And it is used consistently during the online prediction phase;
[0079] The input to the meta-learner is obtained by concatenating four types of information while ensuring that the dimensions and order are fixed. The first type of information is the three short-term initial water level values output in step S3. The second type of information is the operating condition probability output in step S2. The third type of information is the embedded representation of site relationships. The fourth type of information is the recently observed residual sequence. and The residual is defined as follows: Indicates time The measured water level Indicates at time The time interval output after running steps S1 to S5 One-step forecast value, Collected in chronological order The residuals within the data are rolled back to the most recently available consecutive values when there are missing measurements. One time step;
[0080] To further illustrate the impact of the output variance of each learner and the direction of recent observation residuals on the fusion weights, for each prediction step... Calculate the mean and variance of the three short-time water level initial values over this prediction step as statistical characteristics and combine them with... as well as Common input meta-learner, and from The residual slope is obtained by least-squares linear fitting and used as a residual direction feature, which is then input together.
[0081] The meta-learner employs a two-layer multilayer perceptron structure with independent prediction steps. The first hidden layer has 64 neurons, and the second hidden layer has 32 neurons. The activation function is ReLU, and the dropout between the two layers is 0.1. The output layer outputs three unnormalized scores for each prediction step, and the three-way fusion weights are obtained through Softmax. , And constrain any prediction step All meet To ensure that the fusion is a convex combination;
[0082] The multi-step short-time water level forecast value is obtained by stacking and fusing the three initial short-time water level values using the following formula with fusion weights:
[0083] ;
[0084] in Indicates time The output multi-step short-time water level forecast values, Indicates the number of prediction steps. Let represent the progressively fused weight vectors corresponding to the trend base learner, peak base learner, and perturbation base learner, respectively. These represent the short-time initial water level sequences for the three types of base learners. This indicates element-wise multiplication;
[0085] The meta-learner freezes the parameters of the three base learners in the offline phase and trains them using the training set samples as input. The optimizer uses the Adam target learning rate. The batch size is set to 512, the number of training rounds is set to 30, and the training loss adopts the S2 fixed peak window reweighting and segmented loss configuration to synchronously constrain the peak arrival time deviation, peak amplitude deviation and time shift penalty, so that the meta-learner can adaptively generate fusion weights and output stable multi-step short-term water level forecast values by utilizing the output variance of each learner and the direction of recent observation residuals.
[0086] In this specific embodiment, S5 includes:
[0087] Based on multi-step short-time water level forecast values Compared with recently observed residual sequences Perform time-shift correction and output the forecast curve and the time of exceeding the threshold, where Indicates the end time of the sample. Indicates the prediction window length. Indicates the length of the recent observation residual. and Indicates time Water level forecast value, and Indicates time Measured water level With at moment Output one-step forecast value difference;
[0088] Building and Corresponding forecast increment sequence , of which Increment Defined as The difference between the water level and the previous forecast value and the value of the water level. The predicted water level at the previous moment is fixed as the current measured water level. This allows the incremental sequence to reflect the phase and velocity of future water level changes;
[0089] The time shift was determined using the cross-correlation peak value. Cross-correlation calculations use the length of the residual subsequence. And only take The most recent A residual, and In integer time-shift set Perform cross-correlation within the interval and take the time shift corresponding to the peak value as... The calculation is as follows:
[0090] ;
[0091] in This represents the time shift amount, with the unit being time steps. This represents the independent variable that maximizes the objective function. Indicates the candidate time shift. Represents the candidate time-shift set, This represents the summation operator. Indicates the cross-correlation summation index. The residual length used to indicate cross-correlation. Indicates the first cross-correlation window One residual, Indicates the forecast increment component aligned with the residual and when the index Exceeding the range Take the nearest boundary value or To ensure the closure of cross-correlation calculations;
[0092] Will Mapped to time advance correction factor With time lag correction factor ,in This indicates the number of time steps required to shift the forecast curve forward. This indicates the number of time steps required to shift the forecast curve backward, and based on this, [the following is used to] adjust [the forecast curve]. Perform hourly reindexing to form time-corrected forecast sequences ,when season To achieve early correction and fill out the out-of-bounds portion with terminal values, when season To achieve hysteresis correction and fill the out-of-bounds portion with the first-end value;
[0093] The amplitude deviation correction coefficient is denoted as , its origin The absolute value and direction of the residuals are jointly determined, with the mean of the residuals being calculated first. ,when The residual direction is defined as the underreporting direction and then... ,when The residual direction is defined as the overshoot direction and then... and to Apply a cutoff to make it fall within a closed interval The amplitude correction range is limited.
[0094] After correction for early or late completion time, the current measured water level will be used. As a benchmark The final forecast curve is obtained by performing amplitude deviation correction. The gradual modification rule is as follows: and Indicates time Corrected water level forecast value Indicates the amplitude deviation correction coefficient, This represents the time-corrected water level forecast value;
[0095] According to the warning threshold water level Determine the time when the threshold is exceeded ,in For pre-set and with target station The fixed threshold for binding Defined as satisfying The smallest If for all If none of them are satisfied, then Set to empty and output As the forecast curve output in step S5.
[0096] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
[0097] This invention does not simply fit historical water level sequences, but rather integrates a single algorithm through "condition identification, condition-specific prediction, stacking fusion, and error correction" to collaboratively address the challenges of rapid short-term water level fluctuations, sharp peaks, strong disturbances, and the tendency for premature or delayed forecasts. Specifically, different conditions are first identified based on the rate of rise, second-order difference, accumulated rainfall, gate state change rate, and upstream-downstream response difference. Initial values are then output by trend-based, peak-based, and disturbance-based learners, respectively. Subsequently, a meta-learner combines site relationship embedding and recent residuals for fusion. Finally, the forecast curve is corrected a second time through time shift correction and amplitude deviation correction. This process enables the model to not only capture overall trend changes but also to synchronously correct peak arrival times, peak amplitudes, and errors in anomalous segments, thereby improving the temporal consistency and peak characterization capability of short-term water level forecasts.
[0098] This invention addresses the problem that existing single-model or simple ensemble methods are ill-suited to complex operating conditions, and makes targeted improvements to the technical issues addressed in this case. On one hand, this invention replaces the original unified modeling approach with a probabilistic, condition-specific learning structure, allowing different stages of change to be modeled by corresponding learners, reducing the interference of mixed operating conditions on the prediction results. On the other hand, it introduces site relationship embedding, a similar event error library, time shift correction, and peak window reweighting mechanisms, incorporating river network topology, historical similarity error characteristics, and the importance of peak segments into the prediction process, enhancing the model's adaptability to site differences, scheduling disturbances, and peak shifts. Through these structural improvements, this invention can better achieve joint forecasting and error correction of trends, peaks, and anomalous segments, thereby improving overall forecast accuracy and stability.
Claims
1. A short-time water level forecasting method based on ensemble learning, characterized in that, include: S1. Obtain historical water levels, flow rates, rainfall, gate openings, downstream backwater conditions, and station topological features of the target station and its upstream related stations, and construct multi-step forecast samples according to a sliding time window; S2. Calculate water level rise rate, second-order difference, rainfall accumulation, gate state change rate, and upstream-downstream response difference based on the multi-step forecast samples to generate a condition vector, and determine the condition probabilities for the stable segment, rising segment, peak segment, falling segment, and disturbance segment accordingly; S3. Call the trend base learner, peak base learner, and disturbance base learner respectively according to the condition probabilities, and output their corresponding short-term water level initial values; S4. Stack and fuse the short-term water level initial values, condition probabilities, station relationship embedding representations, and recent observation residual sequences into the meta-learner to obtain multi-step short-term water level forecast values; S5. Construct a time shift correction term based on the recent observation residual sequence, perform lead correction, lag correction, and amplitude deviation correction on the multi-step short-term water level forecast values, and output the forecast curve and the time of exceeding the threshold.
2. The method according to claim 1, characterized in that, S1 includes: aligning historical water levels, flow rates, rainfall, gate openings, and downstream backwater over time, and constructing a station relationship matrix based on the river network distance, confluence path, and historical correlation coefficient of relevant upstream stations; and generating multi-step forecast samples containing an input window, a prediction window, and a label window based on the station relationship matrix and the sliding time window.
3. The method according to claim 1, characterized in that, S2 includes: standardizing and concatenating the water level rise rate, second-order difference, rainfall accumulation, gate state change rate, and upstream-downstream response difference into a working condition vector, and calculating the probability of each working condition according to the normalized distance between the working condition vector and the center vectors of various types in the historical working condition sample library. The boundaries of the stable segment, rising segment, peak segment, falling segment, and disturbance segment of the historical working condition sample are determined by the rise rate quantile, peak width quantile, and falling slope quantile of the corresponding sample.
4. The method according to claim 1, characterized in that, The S3 includes: training a trend base learner for samples of the stable and rising segments, training a peak base learner for samples of the peak segment, and training a perturbation base learner for samples of the falling and disturbed segments; during prediction, the outputs of each learner are weighted according to the working condition probabilities to obtain their respective short-term initial water level values.
5. The method according to claim 1, characterized in that, S4 includes: constructing a site relationship embedding representation based on the site relationship matrix, the confluence path from upstream to the target station, and the historical response correlation coefficient, and inputting the initial short-term water level value, operating probability, site relationship embedding representation, and recent observation residual sequence into a meta-learner; the meta-learner generates fusion weights based on the variance of each learner output and the direction of recent observation residuals to output the multi-step short-term water level forecast value.
6. The method according to claim 1, characterized in that, S5 includes: determining the time shift based on the cross-correlation peak value of the recent observation residual sequence and the forecast increment sequence corresponding to the multi-step short-time water level forecast value, mapping the time shift to time advance correction, time lag correction and amplitude deviation correction coefficients, and outputting the time exceeding the threshold after hourly correction of the forecast curve.
7. The method according to claim 5, characterized in that, Step S2 is followed by constructing a similar event error library. The similar event error library stores residual templates and recommended time shifts of historical events according to the rate of increase, peak height, peak width, rainfall pattern, gate action sequence, and station code. During online prediction, similar events are retrieved from the similar event error library based on the current sample's working condition vector, and the retrieved residual templates are used as correction features and input into the meta-learner.
8. The method according to claim 7, characterized in that, When retrieving similar events, the similarity between the current sample and historical events is determined based on the weighted distance in terms of rate of increase, peak height, peak width, rainfall pattern, gate action sequence, and station code. At least one historical event with the highest similarity is selected, and its residual template and the recommended time shift are normalized according to the similarity and then input into the meta-learner.
9. The method according to claim 7, characterized in that, The peak window reweighting module divides the prediction window into a pre-peak segment, a peak segment, and a post-peak segment, and determines the weights of the pre-peak segment, the peak segment, and the post-peak segment based on the quantile statistics of historical peak height and peak width. The peak segment weight is obtained by mapping the quantile value of the absolute value of the historical peak residual, and is used to perform segmented fusion of the time series values output by the meta-learner.
10. The method according to claim 9, characterized in that, When training the trend base learner, peak base learner, perturbation base learner, and meta-learner, segmented losses for the pre-peak segment, peak segment, and post-peak segment are introduced. The segmented losses include a peak arrival time deviation term, a peak amplitude deviation term, and a time shift penalty term. The losses are weighted and summed according to the three segment weights output by the peak window reweighting module.
