Model training method based on water level forecasting and water level forecasting method and device

By collecting historical water level information, training the basic learner and building a fusion model, the challenges of existing water level forecasting solutions in achieving difficulty and accuracy are solved, and more efficient and accurate water level forecasting is achieved.

CN120217854APending Publication Date: 2025-06-27UNIV OF MACAU
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510285481.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The existing water level forecasting schemes have challenges in achieving difficulty and accuracy. The physical model calculation is complex and difficult to apply in real time, and the statistical model accuracy is low.

Method used

A model training method based on water level forecast is proposed. By collecting historical water level information, the first basic learner and the second basic learner are trained, and a fusion model is constructed to improve the accuracy of water level forecasting.

Benefits of technology

It reduces the difficulty of implementing the water level forecasting scheme and improves the accuracy of the water level forecasting results. By combining the prediction results of the basic learner with historical water level information, a more accurate fusion model is trained.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120217854A_ABST
    Figure CN120217854A_ABST
Patent Text Reader

Abstract

The invention discloses a model training method based on water level forecasting and a water level forecasting method and device, and relates to the technical field of water level forecasting. The water level forecast-based model training method comprises the following steps: acquiring historical water level information; obtaining two base learners corresponding to the two preset models; two base learners are trained according to the historical water level information, and a first prediction result is generated according to the two trained base learners; and constructing a new secondary model, and training the secondary model by adopting the first prediction result and the historical water level information to obtain a fusion model. According to the method, two base learners corresponding to two preset models are respectively trained through historical water level information, a secondary model is trained according to prediction results of the two base learners, the secondary model and the two base learners are stacked to form a fusion model, and the fusion model is used for water level forecasting. Therefore, the realization difficulty of the water level forecasting scheme is reduced, and the water level forecasting result accuracy of the water level forecasting scheme is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of water level prediction, and particularly to a model training method, a water level prediction method and a device based on water level prediction. Background Art

[0002] Water level prediction refers to quantitatively deducing and predicting the water level change trend of water bodies such as rivers, lakes, and reservoirs through mathematical models, data analysis, and sensing monitoring technologies, so as to provide a scientific decision-making basis for flood control dispatching, optimal allocation of water resources, safety assessment of water conservancy projects, and ecological protection.

[0003] In the current water level prediction scheme, calculations are usually carried out by combining physical models and statistical models.

[0004] However, physical models require a large amount of on-site observation data and parameter calibration, and have a high computational complexity, making it difficult to apply in real time. The accuracy of statistical models is relatively low. Therefore, it is difficult to implement using existing technologies and it is difficult to ensure accuracy. Summary of the Invention

[0005] The main purpose of the present application is to propose a model training method, a water level prediction method and a device based on water level prediction, aiming to reduce the implementation difficulty of the water level prediction scheme and improve the accuracy of the water level prediction result of the water level prediction scheme.

[0006] In a first aspect, the present invention provides a model training method based on water level prediction, including:

[0007] Collect and obtain historical water level information, where the historical water level information includes: a plurality of water depth data, and time information corresponding to each water depth data;

[0008] Obtain a first base learner corresponding to a first preset model and a second base learner corresponding to a second preset model;

[0009] Train the first base learner and the second base learner respectively according to the historical water level information, and generate a first prediction result according to the trained first base learner and the second base learner;

[0010] Construct a new secondary model based on the first preset model and the second preset model, and train the secondary model using the first prediction result and the historical water level information to obtain a fusion model, where the fusion model is used to predict the water level.

[0011] In an optional implementation manner, the collecting and obtaining historical water level information includes:

[0012] Collect historical water level information and establish a training data set, where the training data set includes: a training sample matrix and a target value vector. The training sample matrix includes multiple groups of the water depth data, and the target value vector includes multiple target values corresponding to each group of the above-mentioned water depth data;

[0013] Respectively training the first base learner and the second base learner according to the historical water level information, and generating a first prediction result according to the trained first base learner and second base learner, includes:

[0014] Respectively training the first base learner and the second base learner through a preset fusion algorithm, the training sample matrix, and the target value vector, and obtaining the first prediction result.

[0015] In an alternative embodiment, the respectively training the first base learner and the second base learner through a preset fusion algorithm, the training sample matrix, and the target value vector, and obtaining the first prediction result, includes:

[0016] Dividing the training sample matrix into at least two training sample matrix subsets, and respectively determining target value vector subsets corresponding to each fold of the training sample matrix subsets according to the divided training sample matrix subsets;

[0017] Respectively training the first base learner and the second base learner through the preset fusion algorithm, the training sample matrix subsets, and the target value vector subsets corresponding to each fold of the training sample matrix subsets, and obtaining the prediction values of the first base learner and the second base learner for each fold of the training sample matrix subsets;

[0018] Generating the first prediction result according to the prediction values.

[0019] In an alternative embodiment, constructing a new secondary model based on the first preset model and the second preset model, and training the secondary model using the first prediction result and the historical water level information to obtain a fusion model, where the fusion model is used to predict the water level, includes:

[0020] Constructing the secondary model based on the first preset model and the second preset model;

[0021] According to the first prediction result corresponding to the first base learner and the first prediction result corresponding to the second base learner, establishing a first prediction result matrix;

[0022] Training the secondary model using the first prediction result matrix and the target value vector to obtain a fusion model.

[0023] In an alternative embodiment, the acquisition of historical water level information includes:

[0024] Acquire historical water level information and establish a training data set, where the training data set includes: a training sample matrix and a target value vector. The training sample matrix includes multiple groups of the water depth data, and the target value vector includes multiple target values corresponding to each group of the above-mentioned water depth data;

[0025] The training of the first base learner and the second base learner respectively according to the historical water level information includes:

[0026] Obtain the prediction results of each training cycle corresponding to the first base learner and the prediction results of each training cycle corresponding to the second base learner respectively through the training sample matrix, the first base learner and the second base learner during training;

[0027] Calculate and obtain the loss value of each training cycle of the first base learner and the loss value of each training cycle of the second base learner respectively according to the prediction results, a preset loss algorithm, and the target value vector;

[0028] Determine the first base learner corresponding to the training cycle with the lowest loss value as the trained first base learner, and determine the second base learner corresponding to the training cycle with the lowest loss value as the trained second base learner.

[0029] In an alternative embodiment, before obtaining the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model, the method further includes:

[0030] Determine the model hyperparameters corresponding to the first preset model according to a first preset algorithm, and determine the model hyperparameters corresponding to the second preset model according to a second preset algorithm;

[0031] Determine the first preset model according to the model hyperparameters corresponding to the first preset model, and determine the second preset model according to the model hyperparameters corresponding to the second preset model.

[0032] In an alternative embodiment, the first preset model is a multi-layer perceptron (MLP) model, and the second preset model is a distributed gradient boosting library (XGBoost) model.

[0033] In a second aspect, the present invention provides a water level forecasting method, including:

[0034] Acquire water level forecasting information, where the water level forecasting information includes: water depth data within a preset time period and time information corresponding to the water depth data;

[0035] Substitute the water level prediction information into the fusion model obtained by training using the method described in any of the foregoing embodiments to obtain a water level prediction result.

[0036] In a third aspect, the present invention provides a model training device based on water level prediction, including:

[0037] A first acquisition module for acquiring historical water level information, where the historical water level information includes: a plurality of water depth data and time information corresponding to each water depth data;

[0038] An acquisition module for acquiring a first base learner corresponding to a first preset model and a second base learner corresponding to a second preset model;

[0039] A generation module for training the first base learner and the second base learner respectively according to the historical water level information, and generating a first prediction result according to the trained first base learner and second base learner;

[0040] A fusion module for constructing a new second-level model based on the first preset model and the second preset model, and training the second-level model using the first prediction result and the historical water level information to obtain a fusion model, where the fusion model is used to predict the water level.

[0041] In a fourth aspect, the present invention provides a water level prediction device, including:

[0042] A second acquisition module for acquiring water level prediction information, where the water level prediction information includes: water depth data within a preset time period and time information corresponding to the water depth data;

[0043] A prediction module for substituting the water level prediction information into the fusion model obtained by training using the method described in any of the foregoing embodiments to obtain a water level prediction result.

[0044] In a fifth aspect, the present application provides an electronic device, including: a processor, a storage medium, and a bus, where the storage medium stores machine-readable instructions executable by the processor, and the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to execute the method described in any of the foregoing embodiments.

[0045] In a sixth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is run by a processor, it executes the method described in any of the foregoing embodiments.

[0046] The beneficial effects of the present application are:

[0047] The model training method based on water level prediction provided by the embodiments of the present application includes: collecting historical water level information, where the historical water level information includes: a plurality of water depth data and the time information corresponding to each water depth data; obtaining the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model; training the first base learner and the second base learner respectively according to the historical water level information, and generating a first prediction result according to the trained first base learner and second base learner; constructing a new secondary model based on the first preset model and the second preset model, and training the secondary model using the first prediction result and the historical water level information to obtain a fusion model, where the fusion model is used to predict the water level. This method trains the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model respectively through the collected historical water level information, and trains the secondary model according to the prediction results of the first base learner and the second base learner combined with the above historical water level information, realizing the stacking of the secondary model with the first base learner and the second base learner to form a fusion model, where the fusion model is used for water level prediction. Among them, the first base learner and the second base learner are used to predict the water level according to the input information, and the secondary model is used to correct and optimize the water level prediction results of the first base learner and the second base learner, thereby reducing the implementation difficulty of the water level prediction scheme and improving the accuracy of the water level prediction result of the water level prediction scheme. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.

[0049] Figure 1 Schematic flow chart of the model training method based on water level prediction provided by an embodiment of the present application;

[0050] Figure 2 Schematic flow chart of the model training method based on water level prediction provided by another embodiment of the present application;

[0051] Figure 3 Schematic flow chart of the model training method based on water level prediction provided by still another embodiment of the present application;

[0052] Figure 4 Schematic flow chart of the overall process of training the fusion model provided by an embodiment of the present application;

[0053] Figure 5 Schematic flow chart of the water level prediction method provided by an embodiment of the present application;

[0054] Figure 6 This is a schematic structural diagram of a model training device based on water level prediction provided by an embodiment of the present application;

[0055] Figure 7 This is a schematic structural diagram of a water level prediction device provided by an embodiment of the present application;

[0056] Figure 8 This is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0057] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. The components of the embodiments of the present application usually described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.

[0058] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but merely represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts fall within the scope of protection of the present application.

[0059] It should be noted that like reference numerals and letters denote like items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. The term "including", "comprising", or any other variant thereof is intended to cover a non-exclusive inclusion, such that a process, method, article, or device including a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or device. Without further limitation, an element defined by the phrase "including one..." does not exclude the presence of additional identical elements in the process, method, article, or device including the element.

[0060] The following will describe in detail some embodiments of the present application with reference to the accompanying drawings. Without conflict, the following embodiments and the features in the embodiments can be combined with each other.

[0061] In the current water level forecasting scheme, calculations are usually carried out by combining physical models and statistical models. Among them, physical models usually need to build mathematical models of river basins or channels based on principles of hydrology and hydrodynamics, etc., and then simulate water level changes by solving partial differential equations. This requires a large amount of on-site observation data and parameter calibration, and has a high computational complexity, making it difficult to apply in real time. Statistical models, on the other hand, usually analyze historical water level data to establish statistical relationships between water levels and influencing factors, and then achieve water level prediction. However, this method has limited prediction accuracy when dealing with non-linear and complex water level changes. Against this background, the main purpose of this application is to propose a model training method based on water level forecasting, which aims to reduce the implementation difficulty of the water level forecasting scheme and improve the accuracy of the water level forecasting result of the water level forecasting scheme.

[0062] Figure 1 FIG. 4 is a schematic flow chart of a model training method based on water level forecasting provided by an embodiment of this application. The execution subject of this method can be, for example, a computer, a server, or other devices with computing and processing capabilities, but is not limited thereto. As Figure 1 shown, this method may include:

[0063] S101. Collect and obtain historical water level information, where the historical water level information includes: a plurality of water depth data and time information corresponding to each of the water depth data.

[0064] Exemplarily, the collection and acquisition of the historical water level information can be achieved, for example, through devices with the function of collecting water depth data, including but not limited to float-type water level gauges, pressure-type water level gauges, and radar water level gauges. In the specific implementation process, it can be continuous or periodic collection. When historical water level information needs to be collected, data within a specified time period can be extracted.

[0065] The specific types, models, performances, etc. of the above-mentioned devices with the function of collecting water depth data, such as float-type water level gauges, pressure-type water level gauges, and radar water level gauges, can be determined according to the conditions of the environment where the water body for which water depth data needs to be collected is located. And the above-mentioned devices with the function of collecting water depth data can be communicatively connected to the above-mentioned computers, servers, or other devices with computing and processing capabilities through communication protocols such as LoRa (Long Range Radio) or NB-IoT (Narrow Band Internet of Things). After the above-mentioned devices with the function of collecting water depth data collect and obtain the historical water level information, the historical water level information can be stored, for example, in the storage space of the above-mentioned computers, servers, or other devices with computing and processing capabilities. Of course, the above content is only a possible example, and the actual situation is not limited to the above content.

[0066] After collecting the above historical water level information, taking the storage of the historical water level information in the storage space of devices with computing and processing functions such as the above computer and server as an example, the above historical water level information can be stored in the form of a matrix as follows:

[0067] Y = [Y1 Y2 Y3 … Y T ,

[0068] wherein, the above Y represents the matrix storing the historical water level information, and the above Y1, Y2, Y3 … Y T represent multiple water depth data arranged according to the time information corresponding to the above water depth data, the above T represents the quantity of the water depth data, and Y T can represent the T-th water depth data in the matrix Y. For example, assuming that the above collection of historical water level information is collected once every 1 hour, starting from 8:00, and the matrix Y formed by storing the above historical water level information is:

[0069] Y = [Y1 Y2 Y3 Y4 Y5],

[0070] then the above Y1 is the water depth data at 8:00, Y2 is the water depth data at 9:00, Y3 is the water depth data at 10:00, Y4 is the water depth data at 11:00, and Y5 is the water depth data at 12:00, with a total of 5 water depth data. It can be understood that the above content is only an example based on the above assumed conditions. The actual quantity of the above water depth data, the time interval between each water depth data (i.e., the collection period of the historical water level information), etc. can all be adjusted and determined according to the actual situation, and are not limited to the above content, and the above historical water level information is not limited to being stored in the matrix form in the above example.

[0071] In addition, after collecting, obtaining, and storing the above historical water level information, data cleaning can also be performed on the above water depth data to remove outliers in the above water depth data. Continuing with the above example, after the above historical water level information is stored to form the matrix Y, for example, data cleaning of the above water depth data can be achieved through the 3σ principle. First, the mean and standard deviation of the above water depth data can be calculated according to the following formula:

[0072]

[0073] wherein, the above μ represents the mean of the above water depth data, the above σ represents the standard deviation of the above water depth data, the above n represents the quantity of the water depth data, which can be determined according to the above T (i.e., n = T), and the above i represents the index variable in the above formula, and can also be used to indicate the i-th water depth data Yi in the matrix Y i .

[0074] According to the 3σ principle, the range of outliers in the above water depth data Y outlier is:

[0075] Y outlier = {Y i ∈ Y | Y i < μ - 3σ} ∪ { Y i ∈ Y | Y i > μ + 3σ},

[0076] After filtering the water depth data in the matrix Y formed by storing the above historical water level information that exceeds the range of the above outliers Y outlier the range of the cleaned water depth data Y clean is:

[0077] Y clean = {Y i ∈ Y | μ - 3σ ≤ Y i ≤ μ + 3σ},

[0078] Furthermore, after cleaning the above water depth data, to ensure the integrity of the water depth data, the above water depth data can also be filled with missing data using the linear interpolation method. Specifically, for example, it can be implemented through the following formula:

[0079]

[0080] Optionally, based on the above example, the above water depth data can also be normalized so that when the above water depth data is used in scenarios such as machine learning model training, the training is more stable. The specific normalization formula can be, for example, the following formula:

[0081]

[0082] where represents the i-th water depth data after the normalization process is completed.

[0083] After completing the normalization process, the water depth data in the above matrix Y can also be checked for data integrity, that is, to ensure that the time information corresponding to each water depth data in the matrix Y only differs by 1 historical water level information acquisition period. If the missing value of the water depth data in the matrix Y does not exceed a preset threshold, such as the missing value of the water depth data does not exceed 4%, 5%, 6%, etc. of the total number of water depth data, then the water depth data in the matrix Y is valid; otherwise, the water depth data in the matrix Y is invalid and cannot be used in scenarios such as machine learning model training.

[0084] In addition, when the water depth data in the above matrix Y is valid, a moving average filter can also be used to smooth the water level data in the matrix Y to reduce the influence of sensor noise. Let the window size of the moving average filter be M, then the calculation formula can be, for example:

[0085]

[0086] The above-mentioned Y smooth [i] represents the smoothed water depth data Y i , where the above-mentioned j represents the index variable in the above formula, which can indicate the i-jth water depth data Y[i-j] in the above matrix Y.

[0087] The above-mentioned preprocessing steps such as data cleaning, filling in missing data, normalization processing, and smoothing processing can improve the data quality of the above-mentioned water depth data. When using these water depth data in scenarios such as machine learning model training, the trained model is more reliable. However, it can be understood that the above content is all a possible example. Specifically, which preprocessing steps can be performed on the above-mentioned water depth data, and how to implement the corresponding preprocessing steps with what methods and formulas, etc., can be adjusted and determined according to the actual situation, and it is not limited to completing the preprocessing of the water depth data according to the processing steps and formulas in the above example.

[0088] S102. Obtain the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model.

[0089] Exemplarily, the above-mentioned first preset model and second preset model can be determined according to a specific algorithm, and the specific algorithm can be selected and determined according to specific requirements. When determining the above-mentioned first preset model and second preset model according to the specific algorithm, the model parameters of the first preset model and second preset model can be determined first through methods including but not limited to experimental debugging, etc., and specific details are not limited here.

[0090] The above-mentioned obtaining of the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model is, for example, to facilitate training and combining multiple models including the above-mentioned first preset model and second preset model to form a model with stronger performance and higher accuracy.

[0091] S103. Train the first base learner and the second base learner respectively according to the above-mentioned historical water level information, and generate a first prediction result according to the trained first base learner and second base learner.

[0092] Exemplarily, training the first base learner and the second base learner according to the above historical water level information may be, for example, dividing the above historical water level information into input values and target output values to train the first base learner and the second base learner. Generating a first prediction result according to the trained first base learner and the second base learner may, for example, refer to inputting the divided input values into the trained first base learner and the second base learner respectively, and obtaining the predicted value of the first base learner based on the input value and the predicted value of the second base learner based on the input value respectively. The predicted value of the first base learner based on the input value and the predicted value of the second base learner based on the input value are the first prediction result.

[0093] Continuing to store the above historical water level information to form a matrix Y, for example:

[0094] Y = [Y1 Y2 Y3 Y4 Y5],

[0095] Dividing the above historical water level information into input values may, for example, refer to dividing the water depth data Y1 to Y4 into input values, and dividing the water depth data Y5 into target output values. At this time, dividing the above historical water level information into input values and target output values to train the first base learner and the second base learner may, for example, enable the first base learner and the second base learner to form a prediction logic such as "if the water depth data in the recent several acquisition cycles is Y1 to Y4, then it is expected that the water depth data in the next acquisition cycle is Y5". Of course, in actual training, the water depth data in the above matrix Y may be multiple groups of water depth data corresponding to multiple different time periods. At this time, the above multiple groups of water depth data can be divided into input values and target output values respectively and used to train the first base learner and the second base learner. Specific details are not limited here.

[0096] On this basis, generating a first prediction result according to the trained first base learner and the second base learner may, for example, refer to using the water depth data Y1 to Y4 as input values and inputting them into the trained first base learner and the second base learner to respectively obtain the predicted values of the first base learner and the second base learner based on Y1 to Y4, that is, the first prediction result. It can be understood that if the water depth data in the above matrix Y is multiple groups of water depth data corresponding to multiple different time periods, then there can also be multiple groups of the above input values and predicted values.

[0097] S104. Construct a new secondary model based on the first preset model and the second preset model, and use the first prediction result and the above historical water level information to train the secondary model to obtain a fusion model, where the fusion model is used to predict the water level.

[0098] Exemplarily, based on the above first preset model and second preset model, or experiments, the parameters of the secondary model can be determined. For example, the adaptability of the model parameters of the secondary model to the first preset model and the second preset model needs to be considered, and specifically, it can be matched through experiments. The secondary model can be determined according to a specific algorithm, for example. The specific algorithm can be selected and determined according to specific requirements. When determining the above secondary model according to the specific algorithm, the model parameters of the secondary model can be determined first through methods including but not limited to experimental debugging, and specific details are not limited here.

[0099] Training the above secondary model using the above first prediction result and the above historical water level information can refer to, for example, using the prediction values of the above first base learner and the above second base learner based on Y1 to Y4 as input values, and using the water depth data with the above divided target output value as Y5 as the target output value to train the above secondary model. For example, it can enable the above secondary model to form a correction logic such as "correcting the prediction values of the above first base learner and the above second base learner based on Y1 to Y4 to the water depth data of Y5", so as to obtain the final water level prediction result based on the corrected first prediction result.

[0100] The above fusion model can include, for example, the above trained first base learner, the model corresponding to the above second base learner, and the above trained secondary model.

[0101] It can be understood that the above content is only a further example based on the previous example content. The actual historical water level information is not limited to the water depth data Y1 to Y5 in the above matrix Y. Therefore, the input values and target output values actually used for training the above secondary model are not limited to the water depth data Y1 to Y5 in the above matrix Y.

[0102] The model training method based on water level prediction provided by the embodiments of the present application includes: collecting historical water level information, where the historical water level information includes: a plurality of water depth data and time information corresponding to each of the water depth data. Obtaining a first base learner corresponding to a first preset model and a second base learner corresponding to a second preset model. Training the first base learner and the second base learner respectively according to the historical water level information, and generating a first prediction result according to the trained first base learner and second base learner. Constructing a new secondary model based on the first preset model and the second preset model, and training the secondary model using the first prediction result and the historical water level information to obtain a fusion model, where the fusion model is used to predict the water level. This method trains the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model respectively through the collected historical water level information, and trains the secondary model according to the prediction results of the first base learner and the second base learner combined with the historical water level information, realizing the formation of a fusion model by stacking the secondary model with the first base learner and the second base learner. The fusion model is used for water level prediction, where the first base learner and the second base learner are used to predict the water level according to the input information, and the secondary model is used to correct and optimize the water level prediction results of the first base learner and the second base learner, thereby reducing the implementation difficulty of the water level prediction scheme and improving the accuracy of the water level prediction result of the water level prediction scheme.

[0103] Optionally, on the basis of the above Figure 1 embodiment, the collecting and obtaining of historical water level information may include:

[0104] Collecting and obtaining historical water level information, and establishing a training data set, where the training data set includes: a training sample matrix and a target value vector. The training sample matrix includes multiple groups of the water depth data, and the target value vector includes multiple target values corresponding to each group of the water depth data.

[0105] On this basis, the training of the first base learner and the second base learner respectively according to the historical water level information, and generating a first prediction result according to the trained first base learner and second base learner may include:

[0106] Training the first base learner and the second base learner respectively through a preset fusion algorithm, the training sample matrix, and the target value vector to obtain the first prediction result.

[0107] Exemplarily, the training sample matrix and the target value vector may be represented in the following manner:

[0108]

[0109] Wherein, the above X represents the training sample matrix, and the above Yo denotes the above-mentioned target value vector, where the above-mentioned m is used to indicate the m-th water depth data Y in matrix Y m , and the above-mentioned training sample matrix X and the above-mentioned target value vector Y o can both be established based on, for example, matrix Y storing the above-mentioned historical water level information in the above-mentioned example:

[0110] Y = [Y1 Y2 Y3 … Y T ,

[0111] For the convenience of illustration, it is still assumed that the time information intervals corresponding to the above-mentioned water depth data Y1, Y2, Y3 … Y T are 1 hour. That is, it is assumed that Y1 is the water depth data at 8:00, then Y2 is the water depth data at 9:00, Y3 is the water depth data at 10:00, and so on until Y T .

[0112] Based on the above assumption, it can be known that the water depth data Y o in the first row of the target value vector Y m+1 is actually the water depth data Y m one hour later than the water depth data at the end of the first row in the training sample matrix X. That is, if Y m is the water depth data at 12:00, then Y m+1 is the water depth data at 13:00.

[0113] The above-mentioned training sample matrix X and the above-mentioned target value vector Y are established based on matrix Y storing the above-mentioned historical water level information in the above-mentioned example o For example, it can be achieved through the sliding window m. That is, the sliding window m obtains the above-mentioned water depth data Y1, Y2, Y3 … Y m in the above-mentioned matrix Y as the water depth data in the first row of the above-mentioned training sample matrix X, that is, the first group of water depth data, and obtains the water depth data Y m+1 one hour later than the sliding window m as the target value corresponding to the first group of water depth data in the above-mentioned target value vector Y o After that, the sliding window m slides backward by one hour. That is, the sliding window m obtains the above-mentioned water depth data Y2, Y3, Y4 … Y m+1 in the above-mentioned matrix Y as the water depth data in the second row of the above-mentioned training sample matrix X, that is, the second group of water depth data, and obtains the water depth data Y m+2 one hour later than the sliding window m as the target value corresponding to the second group of water depth data in the above-mentioned target value vector Y o And so on until the sliding window m obtains the above-mentioned water depth data Y T-m , Y T-m+1 , Y T-m+2 … Y T-1As the last row of water depth data in the above training sample matrix X, that is, the last set of water depth data, and obtain the water depth data Y for the next hour after the sliding window m. T As the above target value vector Y o The target value corresponding to the last set of water depth data in.

[0114] It can be understood that the above example is based on the above water depth data Y1, Y2, Y3... Y T The assumption that the corresponding time information interval is 1 hour is made. If the above water depth data Y1, Y2, Y3... Y T The corresponding time information interval is other durations, then when the above sliding window m slides ··· and obtain the above target value vector Y o The target value in should also be based on the above water depth data Y1, Y2, Y3... Y T The corresponding actual time information interval shall prevail.

[0115] On this basis, the above-mentioned first base learner and second base learner are respectively trained through the preset fusion algorithm, the above-mentioned training sample matrix, and the above-mentioned target value vector, and obtaining the above-mentioned first prediction result may, for example, refer to using each set of water depth data in the above-mentioned training sample matrix X as the input value, and using the target value in the above-mentioned target value vector Y o The target value in is used as the target output value to train the above-mentioned first base learner and second base learner respectively. For example, it may enable the above-mentioned first base learner and second base learner to form, for example, "if the water depth data for several recent acquisition cycles is known as Y1, Y2, Y3... Y m , then it is predicted that the water depth data for the next acquisition cycle is Y m+1 " prediction logic. Subsequently, each set of water depth data in the above-mentioned training sample matrix X is used as the input value and input into the trained above-mentioned first base learner and second base learner respectively to obtain the predicted values of the above-mentioned first base learner and second base learner based on each set of water depth data in the above-mentioned training sample matrix X, that is, the first prediction result.

[0116] Figure 2 This is a schematic flowchart of a model training method based on water level prediction provided by another embodiment of the present application. Refer to Figure 2 , optionally, on the basis of the above embodiment, the above-mentioned first base learner and second base learner are respectively trained through the preset fusion algorithm, the above-mentioned training sample matrix, and the above-mentioned target value vector, and obtaining the above-mentioned first prediction result may include:

[0117] S201. Divide the above-mentioned training sample matrix into at least two training sample matrix subsets, and respectively determine the target value vector subsets corresponding to each fold of the above-mentioned training sample matrix subsets according to the divided above-mentioned training sample matrix subsets.

[0118] Exemplarily, the above-mentioned division of the training sample matrix into at least two subsets of training sample matrices, and respectively determining the subsets of target value vectors corresponding to each subset of the training sample matrices after division, for example, may refer to dividing multiple groups of the above-mentioned water depth data in the training sample matrix X into at least two subsets of training sample matrices as evenly as possible. Each subset of the training sample matrix may include at least one group of the water depth data in the training sample matrix X. The number of subsets of target value vectors corresponds to the subsets of the training sample matrices, and the subsets of target value vectors include the target values corresponding to each group of water depth data in the corresponding subsets of the training sample matrices.

[0119] Illustratively, taking the division of the training sample matrix X in the above embodiment into two subsets of training sample matrices as an example, one subset of the training sample matrix X1 may be, for example:

[0120]

[0121] The other subset of the training sample matrix X2 may be, for example:

[0122]

[0123] Correspondingly, the subset of the target value vector Y corresponding to one subset of the training sample matrix X1 o1 may be, for example:

[0124]

[0125] The subset of the target value vector Y corresponding to the other subset of the training sample matrix X2 o2 may be, for example:

[0126]

[0127] Of course, the above content is only a possible example. The actual number of folds for dividing the training sample matrix X and the target value vector Y in the above embodiment o the actual content included in each subset of the training sample matrix after division and the subsets of the target value vectors corresponding to each subset of the training sample matrix are not limited to the above examples.

[0128] S202. Respectively train the first base learner and the second base learner through the above-mentioned preset fusion algorithm, the subsets of the training sample matrices, and the subsets of the target value vectors corresponding to each subset of the training sample matrices, and obtain the predicted values of the first base learner and the second base learner for each subset of the training sample matrices.

[0129] Exemplarily, training the first base learner and the second base learner respectively through the above-mentioned preset fusion algorithm, the above-mentioned training sample matrix subset, and the above-mentioned target value vector subset corresponding to each fold of the above-mentioned training sample matrix subset, and obtaining the predicted values of the first base learner and the second base learner for each fold of the above-mentioned training sample matrix subset. For example, it may refer to selecting one fold of the divided training sample matrix subset as the input value for prediction, and using the remaining other training sample matrix subsets and the target value vector subsets corresponding to these training sample matrix subsets as the input values and target output values for training. Then, replace the selected training sample matrix subset used as the input value for prediction, and use the remaining other training sample matrix subsets and the target value vector subsets corresponding to these training sample matrix subsets as the input values and target output values for training until each fold of the training sample matrix subset has been selected as the input value for prediction, and then one training cycle ends. There can be multiple such training cycles.

[0130] Continuing with the example according to the content in the above example, if the training sample matrix X in the above embodiment is divided into two-fold training sample matrix subsets X1 and X2, then the training sample matrix subset X1 can be first selected as the input value for prediction, and the remaining training sample matrix subset X2 and the target value vector subset Y corresponding to the training sample matrix subset X2 o2 are used as the input values and target output values for training to train the first base learner and the second base learner respectively. After training is completed, input the training sample matrix subset X1 as the input value for prediction into the first base learner and the second base learner, then the predicted values of the first base learner and the second base learner for the training sample matrix subset X1 can be obtained respectively. At this time, use the training sample matrix subset X2 as the input value for prediction, and use the remaining training sample matrix subset X1 and the target value vector subset Y corresponding to the training sample matrix subset X1 o1 as the input values and target output values for training to train the first base learner and the second base learner respectively. After training is completed, input the training sample matrix subset X2 as the input value for prediction into the first base learner and the second base learner, then the predicted values of the first base learner and the second base learner for the training sample matrix subset X2 can be obtained respectively. At this time, the predicted values of the first base learner and the second base learner for the training sample matrix subset X1 and the training sample matrix subset X2 have been obtained, that is, the predicted values of each fold of the training sample matrix subset have been obtained, and one training cycle ends. Subsequently, multiple such training cycles can be repeated.

[0131] It can be understood that the above-exemplified content is proposed based on dividing the training sample matrix X in the above embodiment into two folds of training sample matrix subsets X1 and X2. If the training sample matrix X in the above embodiment is divided into training sample matrix subsets with other numbers of folds, then the training sample matrix subsets with other numbers of folds need to be used as input values for prediction, and only after one training cycle can it end.

[0132] S203. Generate the first prediction result according to the above prediction value.

[0133] Exemplarily, the above first prediction result can be, for example, a set of the above prediction values.

[0134] The model training method based on water level prediction provided by the embodiments of the present application includes: dividing the above training sample matrix into at least two folds of training sample matrix subsets, and respectively determining target value vector subsets corresponding to each fold of the above training sample matrix subsets according to the divided above training sample matrix subsets. Training the first base learner and the second base learner respectively through the above preset fusion algorithm, the above training sample matrix subsets, and the target value vector subsets corresponding to each fold of the above training sample matrix subsets to obtain the prediction values of the first base learner and the second base learner for each fold of the above training sample matrix subsets. Generate the first prediction result according to the above prediction values. This method divides the training sample matrix into at least two folds of training sample matrix subsets, and realizes training the first base learner and the second base learner through the method of K-fold cross-validation and obtaining the prediction values of the two base learners for each fold of the training sample matrix subsets, so that the obtained prediction values are more accurate and reliable.

[0135] Optionally, on the basis of any of the above embodiments, constructing a new secondary model based on the above first preset model and the second preset model, and training the secondary model with the above first prediction result and the above historical water level information to obtain a fusion model, where the fusion model is used to predict the water level, may include:

[0136] Construct the above secondary model based on the above first preset model and the second preset model.

[0137] Establish a first prediction result matrix according to the above first prediction result corresponding to the first base learner and the first prediction result corresponding to the second base learner.

[0138] Exemplarily, the above first prediction result matrix can be, for example, as shown in matrix Z:

[0139]

[0140] The first column data in the above matrix Z, that is, Z 1,1 ~Z 1,Nrepresent the 1st to Nth predicted values of the above-mentioned first base learner, and the second column data in the above matrix Z, i.e., Z 2,1 ~Z 2,N represent the 1st to Nth predicted values of the above-mentioned second base learner. It can be understood that each row of predicted values in this matrix Z corresponds to the target value vector Y o one by one. For example, Z 1,1 can be the predicted value of the first base learner, and Z 2,1 can be the predicted value of the second base learner corresponding to Z 1,1 , and Y m+1 can be the target value corresponding to Z 1,1 and Z 2,1 . Of course, the above corresponding relationship is only a possible example, and the actual corresponding relationship can be different from the above.

[0141] Use the above first prediction result matrix and the above target value vector to train the above secondary model to obtain a fusion model.

[0142] The above-mentioned training of the above secondary model using the above first prediction result matrix and the above target value vector can, for example, mean using the predicted values in the above matrix Z as the input values for training, and using the target values in the above target value vector Y o1 as the target output values for training to train the above secondary model, so that the above secondary model forms, for example, a correction logic of "correcting the predicted values in the above matrix Z to the corresponding target values in the target value vector Y o " to obtain the final water level prediction result based on the corrected first prediction result.

[0143] And the above fusion model can, for example, include the above-trained first base learner, the model corresponding to the above second base learner, and the above-trained secondary model.

[0144] Figure 3 is a schematic flow diagram of a model training method for water level prediction provided by another embodiment of the present application. As Figure 3 shown, on the basis of the Figure 1 embodiment, the above-mentioned acquisition of historical water level information can include:

[0145] Acquire historical water level information and establish a training data set. The above training data set includes: a training sample matrix and a target value vector. The above training sample matrix includes multiple groups of the above water depth data, and the above target value vector includes multiple target values corresponding to each group of the above water depth data.

[0146] The above-mentioned training of the above first base learner and the above second base learner according to the above historical water level information can include:

[0147] S301. Obtain the prediction results corresponding to each training cycle of the first base learner and the prediction results corresponding to each training cycle of the second base learner respectively through the above training sample matrix, the first base learner in training, and the second base learner in training.

[0148] Since the training of the first base learner and the second base learner can be carried out in multiple training cycles, and after each training cycle, the prediction results corresponding to the first base learner and the second base learner can be obtained by using the first base learner and the second base learner that have completed the training of the current training cycle, that is, the above prediction values.

[0149] S302. Calculate and obtain the loss value of each training cycle of the first base learner and the loss value of each training cycle of the second base learner respectively according to the above prediction results, the preset loss algorithm, and the above target value vector.

[0150] Exemplarily, the loss value of each training cycle of the first base learner and the loss value of each training cycle of the second base learner are calculated and obtained according to the above prediction results, the preset loss algorithm, and the above target value vector. For example, it can be calculated and obtained through the following formula:

[0151]

[0152] Among them, the above represents the loss value of a certain training cycle of the first base learner or the second base learner, the above y i is the i-th predicted value, the above is the target value corresponding to the i-th predicted value in the target value vector Y o , and the above M represents the number of the predicted values and the target values.

[0153] The loss value of each training cycle of the first base learner and the loss value of each training cycle of the second base learner can be stored in the form of Table 1 below, for example:

[0154]

[0155] Table 1 Record Table of Loss Values of Each Training Cycle

[0156] Please refer to Table 1 above. Taking the example that both the first base learner and the second base learner are trained for four training cycles, the loss values of each training cycle of the above-mentioned first base learner and the loss values of each training cycle of the above-mentioned second base learner are exemplified. However, it can be understood that the calculation method, storage method, and the actual number of training cycles of the loss values of each training cycle of the actual first base learner and the loss values of each training cycle of the above-mentioned second base learner can all be different from the exemplified content, and no restrictions are imposed here.

[0157] S303. Determine the above-mentioned first base learner corresponding to the training cycle with the lowest loss value as the trained first base learner, and determine the above-mentioned second base learner corresponding to the training cycle with the lowest loss value as the trained second base learner.

[0158] Generally speaking, it is not the case that the more training cycles there are, the better the training effects of the above-mentioned first base learner and the second base learner. When the number of training cycles exceeds a certain amount, the models corresponding to the trained first base learner and the second base learner may have situations such as overfitting, resulting in a decline in prediction performance. Therefore, by finding the first base learner and the second base learner corresponding to the training cycle with the lowest loss value through the loss values of each training cycle of the above-mentioned first base learner and the loss values of each training cycle of the above-mentioned second base learner, it can ensure that the models corresponding to the first base learner and the second base learner have better prediction performance. It should be noted that the training cycle with the lowest loss value of the above-mentioned first base learner and the training cycle with the lowest loss value of the above-mentioned second base learner are not necessarily the same training cycle. For example, it may occur that the loss value of the first base learner is the lowest after the third training cycle, while the loss value of the second base learner is the lowest after the second training cycle, and it is not limited to the exemplified content above.

[0159] The model training method based on water level prediction provided by the embodiments of the present application includes: obtaining the prediction results of each training cycle corresponding to the first base learner and the prediction results of each training cycle corresponding to the second base learner through the above training sample matrix, the first base learner in training, and the second base learner. Calculate and obtain the loss values of each training cycle of the first base learner and the loss values of each training cycle of the second base learner according to the above prediction results, the preset loss algorithm, and the above target value vector. Determine the first base learner corresponding to the training cycle with the lowest loss value as the trained first base learner, and determine the second base learner corresponding to the training cycle with the lowest loss value as the trained second base learner. By determining the first base learner and the second base learner corresponding to the training cycle with the lowest loss value, this method realizes finding the models corresponding to the first base learner and the second base learner with the highest accuracy among the first base learner and the second base learner corresponding to each training cycle, thereby preventing overfitting and other situations from occurring during the training of the first base learner and the second base learner, and improving the prediction accuracy of the models corresponding to the first base learner and the second base learner.

[0160] Further, on the basis of the above embodiments, before obtaining the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model, the method may further include:

[0161] Determine the model hyperparameters corresponding to the first preset model according to the first preset algorithm, and determine the model hyperparameters corresponding to the second preset model according to the second preset algorithm.

[0162] Determine the first preset model according to the model hyperparameters corresponding to the first preset model, and determine the second preset model according to the model hyperparameters corresponding to the second preset model.

[0163] Exemplarily, before training the model based on water level prediction, an appropriate algorithm can be determined according to specific requirements, and then the model corresponding to the algorithm can be selected. After determining the model type, the model hyperparameters corresponding to the model can also be determined and adjusted through experiments and other methods, so that the model can better adapt to relevant data and output relevant results more accurately.

[0164] According to differences such as the model type, the above model hyperparameters can also be different. The above model hyperparameters can include, for example: model learning rate, number of hidden layers, number of neurons in each layer, number of decision trees, etc., and are not specifically limited here.

[0165] Optionally, the above first preset model is an MLP (Multilayer Perceptron) model, and the above second preset model is an XGBoost (eXtreme Gradient Boosting) model. On this basis, the above secondary model can also be an MLP model, for example.

[0166] Exemplarily, the model hyperparameters corresponding to the above MLP model may include, for example, model learning rate, number of hidden layers, number of neurons in each layer, etc. For example, the model hyperparameters corresponding to the MLP model are model learning rate = 0.001, number of hidden layers = 5, and the number of neurons in each layer are 512, 256, 256, 128, 128, etc. And the model hyperparameters corresponding to the above XGBoost model may include, for example, model learning rate, number of decision trees, depth of decision trees, etc. For example, the model hyperparameters corresponding to the XGBoost model are model learning rate = 0.1, number of decision trees = 100, depth of decision trees = 3, etc., but not limited thereto.

[0167] The MLP model is a feedforward neural network model suitable for processing non - linear relationships, while the XGBoost model is an ensemble algorithm model based on decision trees, with efficient processing capabilities and good prediction performance. By combining these two models, their respective advantages can be fully utilized to improve the accuracy and robustness of prediction.

[0168] Figure 4 It is a schematic diagram of the overall training process of the fusion model provided by an embodiment of the present application, taking the above first preset model as an MLP model and the second preset model as an XGBoost model as an example. Please refer to Figure 4 First, divide the above historical water level information to obtain a training sample matrix and a target vector value. Use the data in the training sample matrix as the input value for training, and the data in the target vector value as the target output value for training. Train the above first preset model (i.e., the MLP model) and the second preset model (i.e., the XGBoost model) respectively. This training can be carried out for one or more training cycles. After the training is completed, use the data in the training sample matrix as the input value for prediction, and predict through the above MLP model and the above XGBoost model respectively to obtain the prediction results of the MLP model and the XGBoost model, that is, the first prediction results. Then, use the first prediction results and the data in the target vector value as the input value for training to train the secondary model. This training can be carried out for one or more training cycles. After the training is completed, use the first prediction results as the input value for correction, and the final water level forecast result is obtained after being corrected by the secondary model.

[0169] Of course, the above content is only a possible example of the overall process of fusion model training. The actual overall process of fusion model training can be different from Figure 4 the content shown and is not limited to Figure 4 the process shown.

[0170] Figure 5 The figure is a schematic flowchart of a water level prediction method provided by an embodiment of the present application. This method can be applied to the fusion model trained by the model training method based on water level prediction in the above embodiment. Please refer to Figure 5 , and this method may include:

[0171] S501. Collect and obtain water level prediction information, where the water level prediction information includes: water depth data within a preset time period and time information corresponding to the water depth data.

[0172] For the collection path, transmission method, storage method, etc. of the water level prediction information, reference can be made to the historical water level information in the above embodiment, which will not be elaborated here.

[0173] S502. Substitute the water level prediction information into the fusion model trained by using the model training method based on water level prediction in the above embodiment to obtain a water level prediction result.

[0174] After obtaining the water level prediction result, devices with computing and processing functions such as the above computer and server can also push the water level prediction result to multiple platform devices associated with water level prediction in real time in the form of text messages, etc. The specific push method, push target, etc. can be adjusted and determined according to the actual situation and are not limited here.

[0175] Figure 6 The figure is a schematic structural diagram of a model training device based on water level prediction provided by an embodiment of the present application. The model training device based on water level prediction can execute the model training method based on water level prediction above. This device can be integrated into devices with computing and processing functions such as the above computer and server, as Figure 6 shown, and this device includes:

[0176] A first collection module 610, configured to collect and obtain historical water level information, where the historical water level information includes: a plurality of water depth data and time information corresponding to each of the water depth data.

[0177] An acquisition module 620, configured to acquire a first base learner corresponding to a first preset model and a second base learner corresponding to a second preset model.

[0178] A generation module 630, configured to train the first base learner and the second base learner respectively according to the historical water level information, and generate a first prediction result according to the trained first base learner and the second base learner.

[0179] A fusion module 660, configured to construct a new secondary model based on the above first preset model and the above second preset model, and train the secondary model using the above first prediction result and the above historical water level information to obtain a fusion model, where the fusion model is used to predict the water level.

[0180] The model training method based on water level prediction provided by the embodiments of the present application includes: collecting and obtaining historical water level information, where the historical water level information includes: a plurality of water depth data and time information corresponding to each of the above water depth data. Obtaining a first base learner corresponding to the first preset model and a second base learner corresponding to the second preset model. Training the first base learner and the second base learner respectively according to the above historical water level information, and generating a first prediction result according to the trained first base learner and the second base learner. Constructing a new secondary model based on the above first preset model and the above second preset model, and training the secondary model using the above first prediction result and the above historical water level information to obtain a fusion model, where the fusion model is used to predict the water level. This method trains the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model respectively through the collected historical water level information, and trains the secondary model according to the prediction results of the first base learner and the second base learner combined with the above historical water level information, realizing stacking the secondary model with the first base learner and the second base learner to form a fusion model, where the fusion model is used for water level prediction. Among them, the first base learner and the second base learner are used to predict the water level according to the input information, and the secondary model is used to correct and optimize the water level prediction results of the first base learner and the second base learner, thereby reducing the implementation difficulty of the water level prediction scheme and improving the accuracy of the water level prediction result of the water level prediction scheme.

[0181] Optionally, the above first acquisition module 610 may specifically be configured to collect and obtain historical water level information and establish a training data set, where the training data set includes: a training sample matrix and a target value vector. The training sample matrix includes multiple groups of the above water depth data, and the target value vector includes multiple target values corresponding to each group of the above water depth data.

[0182] The above generation module 630 may specifically be configured to train the first base learner and the second base learner respectively through a preset fusion algorithm, the above training sample matrix, and the above target value vector to obtain the above first prediction result.

[0183] Optionally, the above-mentioned generation module 630 can specifically be used to divide the above-mentioned training sample matrix into at least two subsets of training sample matrices, and respectively determine subsets of target value vectors corresponding to each subset of the training sample matrices after division. Train the above-mentioned first base learner and the above-mentioned second base learner respectively through the above-mentioned preset fusion algorithm, the above-mentioned subsets of training sample matrices, and the subsets of target value vectors corresponding to each subset of the training sample matrices, and obtain the predicted values of the above-mentioned first base learner and the above-mentioned second base learner for each subset of the training sample matrices. Generate the above-mentioned first prediction result according to the above-mentioned predicted values.

[0184] Optionally, the above-mentioned fusion module 660 is specifically used to construct the above-mentioned secondary model based on the above-mentioned first preset model and the above-mentioned second preset model. Establish a first prediction result matrix according to the above-mentioned first prediction result corresponding to the above-mentioned first base learner and the first prediction result corresponding to the above-mentioned second base learner. Train the above-mentioned secondary model using the above-mentioned first prediction result matrix and the above-mentioned target value vector to obtain a fusion model.

[0185] Optionally, the above-mentioned generation module 630 is specifically used to respectively obtain the prediction results of each training cycle corresponding to the above-mentioned first base learner and the prediction results of each training cycle corresponding to the above-mentioned second base learner through the above-mentioned training sample matrix, the above-mentioned first base learner and the above-mentioned second base learner during training. Calculate and obtain the loss values of each training cycle of the above-mentioned first base learner and the loss values of each training cycle of the above-mentioned second base learner according to the above-mentioned prediction results, the preset loss algorithm, and the above-mentioned target value vector. Determine the above-mentioned first base learner corresponding to the training cycle with the lowest loss value as the trained above-mentioned first base learner, and determine the above-mentioned second base learner corresponding to the training cycle with the lowest loss value as the trained above-mentioned second base learner.

[0186] Optionally, the above-mentioned acquisition module 620 can also be used to determine the model hyperparameters corresponding to the above-mentioned first preset model according to the first preset algorithm, and determine the model hyperparameters corresponding to the above-mentioned second preset model according to the second preset algorithm. Determine the above-mentioned first preset model according to the above-mentioned model hyperparameters corresponding to the above-mentioned first preset model, and determine the above-mentioned second preset model according to the above-mentioned model hyperparameters corresponding to the above-mentioned second preset model.

[0187] Optionally, the above-mentioned first preset model can be an MLP model, and the above-mentioned second preset model can be an XGBoost model.

[0188] The above-mentioned device is used to execute the method provided in the foregoing embodiment, and its implementation principle and technical effects are similar, and will not be elaborated here.

[0189] Figure 7The structural schematic diagram of a water level prediction device provided by an embodiment of the present application. The water level prediction device can execute the above-mentioned water level prediction method, and the device can be integrated into devices with computing and processing functions such as the above-mentioned computer, server, etc. For example, Figure 7 As shown, the device includes:

[0190] A second acquisition module 710, configured to acquire water level prediction information, where the water level prediction information includes: water depth data within a preset time period, and time information corresponding to the water depth data.

[0191] A prediction module 720, configured to substitute the water level prediction information into a fusion model obtained by training using the model training method based on water level prediction in the above-mentioned embodiment to obtain a water level prediction result.

[0192] The above device is used to execute the method provided by the foregoing embodiment, and its implementation principle and technical effects are similar, and will not be elaborated here.

[0193] Figure 8 The structural schematic diagram of an electronic device provided by an embodiment of the present application. The electronic device can be a device with computing and processing functions such as the above-mentioned computer, server, etc. For example, Figure 8 As shown, the device 800 includes:

[0194] A processor 810, a storage medium 820, and a bus 830. The processor 810 is communicatively connected to the storage medium 820 through the bus 830.

[0195] Among them, the storage medium 820 stores machine-readable instructions executable by the processor 810. When the electronic device runs, the processor 810 executes the above-mentioned machine-readable instructions to execute the above-mentioned model training method based on water level prediction or water level prediction method.

[0196] It should be understood that Figure 8 The structure shown is only the structural schematic diagram of the electronic device, and the electronic device may further include more or fewer components than Figure 8 shown in, or have a different configuration from Figure 8 shown in. Figure 8 Each component shown in can be implemented by hardware, software, or a combination thereof.

[0197] An embodiment of the present application further provides a computer-readable storage medium. A computer program is stored in the computer-readable medium, and when the computer program is executed by a processor, it can implement the model training method based on water level prediction or water level prediction method described in the above method embodiments.

[0198] A computer-readable storage medium may be an electronic memory such as a flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium includes a non-transitory computer-readable storage medium. The computer-readable storage medium has a storage space for program code that executes any of the method steps in the above-described methods. This program code may be read from or written to one or more computer program products. The program code may be compressed, for example, in a suitable form.

[0199] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions, and operations of an apparatus, a method, and a computer program product according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the module, the program segment, or the part of code includes one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

[0200] In addition, in each embodiment of the present application, the various functional modules may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0201] If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0202] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application. Any equivalent structural transformation made by using the content of the specification and drawings of the present application under the inventive concept of the present application, or any direct / indirect application in other related technical fields is included in the patent protection scope of the present application.

Claims

1. A model training method based on water level forecast, characterized in that: include: Collect and obtain historical water level information, the historical water level information including: a plurality of water depth data and time information corresponding to each of the water depth data; Obtain a first base learner corresponding to the first preset model and a second base learner corresponding to the second preset model; The first base learner and the second base learner are trained respectively according to the historical water level information, and a first prediction result is generated according to the trained first base learner and the second base learner; A new secondary model is constructed based on the first preset model and the second preset model, and the first prediction result and the historical water level information are used to train the secondary model to obtain a fusion model, and the fusion model is used to predict the water level.

2. The method according to claim 1, characterized in that The collecting and obtaining of historical water level information includes: Collect and obtain historical water level information and establish a training data set, wherein the training data set includes: a training sample matrix and a target value vector, wherein the training sample matrix includes multiple groups of the water depth data, and the target value vector includes multiple target values ​​corresponding to each group of the water depth data; The step of training the first base learner and the second base learner respectively according to the historical water level information, and generating a first prediction result according to the trained first base learner and the second base learner includes: The first base learner and the second base learner are trained respectively by using a preset fusion algorithm, the training sample matrix, and the target value vector to obtain the first prediction result.

3. The method according to claim 2, characterized in that The step of respectively training the first base learner and the second base learner by using a preset fusion algorithm, the training sample matrix, and the target value vector to obtain the first prediction result includes: Dividing the training sample matrix into at least two folds of training sample matrix subsets, and determining target value vector subsets corresponding to each fold of the training sample matrix subset according to the divided training sample matrix subsets; The first basis learner and the second basis learner are respectively trained by the preset fusion algorithm, the training sample matrix subset, and the target value vector subset corresponding to each fold of the training sample matrix subset, and the prediction values ​​of the first basis learner and the second basis learner for each fold of the training sample matrix subset are obtained; The first prediction result is generated according to the prediction value.

4. The method according to any one of claims 1 to 3, characterized in that: The new secondary model is constructed based on the first preset model and the second preset model, and the first prediction result and the historical water level information are used to train the secondary model to obtain a fusion model, wherein the fusion model is used to predict the water level, including: Constructing the secondary model based on the first preset model and the second preset model; Establishing a first prediction result matrix according to the first prediction result corresponding to the first base learner and the first prediction result corresponding to the second base learner; The first prediction result matrix and the target value vector are used to train the secondary model to obtain a fusion model.

5. The method according to claim 1, characterized in that The collecting and obtaining of historical water level information includes: Collect and obtain historical water level information and establish a training data set, wherein the training data set includes: a training sample matrix and a target value vector, wherein the training sample matrix includes multiple groups of the water depth data, and the target value vector includes multiple target values ​​corresponding to each group of the water depth data; The training of the first base learner and the second base learner respectively according to the historical water level information comprises: Obtaining respectively a prediction result of each training cycle corresponding to the first base learner and a prediction result of each training cycle corresponding to the second base learner through the training sample matrix, the first base learner in training, and the second base learner; According to the prediction result, the preset loss algorithm, and the target value vector, respectively calculate and obtain the loss value of each training cycle of the first base learner and the loss value of each training cycle of the second base learner; The first base learner corresponding to the training cycle with the lowest loss value is determined as the first base learner after training, and the second base learner corresponding to the training cycle with the lowest loss value is determined as the second base learner after training.

6. The method according to any one of claims 1 to 3, characterized in that: Before obtaining the first base learner corresponding to the first preset model and the second base learner corresponding to the second preset model, the method further includes: Determine the model hyperparameters corresponding to the first preset model according to the first preset algorithm, and determine the model hyperparameters corresponding to the second preset model according to the second preset algorithm; The first preset model is determined according to the model hyperparameters corresponding to the first preset model, and the second preset model is determined according to the model hyperparameters corresponding to the second preset model.

7. The method according to any one of claims 1 to 3, characterized in that: The first preset model is a multi-layer perceptron MLP model, and the second preset model is a distributed gradient boosting library XGBoost model.

8. A water level forecasting method, characterized in that: include: Collecting and obtaining water level forecast information, the water level forecast information includes: water depth data within a preset time period, and time information corresponding to the water depth data; Substitute the water level forecast information into the fusion model trained and obtained by the method described in any one of claims 1 to 7 to obtain a water level forecast result.

9. A model training device based on water level forecast, characterized in that: include: A first acquisition module is used to acquire historical water level information, wherein the historical water level information includes: a plurality of water depth data and time information corresponding to each of the water depth data; An acquisition module, used to acquire a first base learner corresponding to the first preset model and a second base learner corresponding to the second preset model; A generating module, used for respectively training the first base learner and the second base learner according to the historical water level information, and generating a first prediction result according to the trained first base learner and the second base learner; A fusion module is used to construct a new secondary model based on the first preset model and the second preset model, and use the first prediction result and the historical water level information to train the secondary model to obtain a fusion model, and the fusion model is used to predict the water level.

10. A water level forecasting device, characterized in that: include: A second acquisition module is used to acquire water level forecast information, wherein the water level forecast information includes: water depth data within a preset time period, and time information corresponding to the water depth data; A forecast module is used to substitute the water level forecast information into a fusion model trained and obtained by the method described in any one of claims 1 to 7 to obtain a water level forecast result.

Citation Information

Patent Citations

  • Sea fog level intelligent forecasting method and system

    CN114280696A

  • Dynamic water level prediction method based on XGBoost machine learning model

    CN114912359A

  • Prediction method of raw water 2-MIB concentration prediction model based on ensemble learning

    CN117393068A