A hierarchical SWAT agent modeling method and device based on machine learning
By constructing a hierarchical SWAT proxy model and using machine learning algorithms to train sub-basin and river process proxy models, the problems of poor versatility and heavy computing resource burden of existing SWAT proxy models are solved, and flexible calling and efficient computing are achieved.
Patent Information
- Application Number
- CN202411661248.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-11-20
AI Technical Summary
The existing SWAT agent model is too black-box, has poor versatility, cannot be flexibly called, and has a heavy burden on computing resources when performing multiple operations.
A hierarchical SWAT proxy model modeling method was adopted. By generating BMPs parameter combination samples and combining them with meteorological driving data, sub-basin and river process proxy models were constructed. Random forest and artificial neural networks were used for training, and a hierarchical SWAT proxy model was obtained in series.
It enhances the versatility and interpretability of the proxy model, reduces the burden of computing resources, improves model calling flexibility and computing speed, and maintains high simulation accuracy.
Smart Images

Figure CN119670917B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of watershed pollution control, and in particular to a hierarchical SWAT agent modeling method and device based on machine learning. Background Art
[0002] As the impact of human agricultural activities on natural water bodies continues to increase, agricultural non-point source pollution has become an important cause of the deterioration and eutrophication of surface water bodies such as rivers, lakes and reservoirs. In order to simulate the specific impact of non-point source pollution on water bodies, researchers developed the Soil and Water Assessment Tool (SWAT) model to simulate various processes in the watershed, such as runoff, infiltration, channel and reservoir routes, sedimentation and nutrient dynamics. The SWAT model has a watershed management measures simulation module that can simulate the impact of different measures on water bodies in the watershed. The SWAT model-based assessment of the impact of watershed best management practices (BMPs) on watershed hydrology and water quality is widely used in the field of watershed pollution control.
[0003] Many researchers have coupled the SWAT model with multi-objective algorithms to study optimal management action configurations for watersheds. When multiple management actions and management areas are considered simultaneously, a vast number of parameter combinations must be considered, often using Latin hypercube sampling. This often requires thousands of model runs, which can be computationally cumbersome. A widely used simplification approach is to create computationally inexpensive SWAT surrogate models. These models, when embedded in optimization algorithms, can significantly reduce computation time.
[0004] Current SWAT proxy models include regression models based on specific physical formulas and black-box models based on various statistical methods. With the development of various machine learning algorithms, a growing number of researchers have applied SWAT proxy models to multi-objective optimization, real-time prediction, and uncertainty analysis. These SWAT proxy models capture the relationship between the input and output of the SWAT model and can be used to reduce the computational burden when multiple operations are required. However, existing SWAT proxy models are too black-box and lack universal applicability. They can only be used for certain functions, and implementing additional functions often requires retraining the proxy model. Summary of the Invention
[0005] In a first aspect, an embodiment of the present invention provides a method for modeling a hierarchical SWAT agent model based on machine learning, the method comprising:
[0006] Generate BMPs parameter combination samples, and combine the BMPs parameter combination samples with meteorological driving data to generate the first sample required by the SWAT model;
[0007] The first sample is input into the SWAT model, and the SWAT model outputs sub-basin scale data and river section scale data;
[0008] The sub-basin scale data is used as the label corresponding to the first sample, and the second sample required by the river process proxy model is generated based on the sub-basin scale data, and the river section scale data is used as the label corresponding to the second sample;
[0009] The first sample and its corresponding label are used to train the first machine learning model to obtain a sub-basin proxy model; the second sample and its corresponding label are used to train the second machine learning model to obtain a river process proxy model;
[0010] The sub-basin proxy model and the river process proxy model are connected in series to obtain a hierarchical SWAT proxy model.
[0011] In some implementations of the first aspect, generating a BMPs parameter combination sample includes:
[0012] According to the set value range of BMPs parameters, the Latin hypercube sampling algorithm is used to generate BMPs parameter combination samples.
[0013] In some implementations of the first aspect, inputting the first sample into the SWAT model, and outputting the sub-basin scale data and the river section scale data from the SWAT model, includes:
[0014] The first sample is input into the SWAT model, and the SWAT model outputs the sub-basin scale time series and the river section scale time series;
[0015] The surface runoff depth, sediment load intensity, and total nitrogen load intensity of each sub-basin were extracted from the sub-basin scale time series as sub-basin scale data;
[0016] The daily flow, daily sediment load flux, and daily total nitrogen load flux of each river section are extracted from the river section scale time series as river section scale data.
[0017] In some implementations of the first aspect, the first machine learning model is a random forest (RF); and the first sample and its corresponding label are used to train the first machine learning model to obtain a sub-basin proxy model, including:
[0018] Divide the first sample and its corresponding label into a training set and a test set according to a preset ratio;
[0019] The grid search algorithm is used to determine the hyperparameters of the random forest, and the random forest is trained using the training set. The performance of the trained random forest model is evaluated using the test set. If the trained random forest passes the performance evaluation, it is used as the sub-basin proxy model.
[0020] In some implementations of the first aspect, the second machine learning model is an artificial neural network (ANN); and the second sample and its corresponding label are used to train the second machine learning model to obtain a river process proxy model, including:
[0021] Divide the second sample and its corresponding label into a training set and a test set according to a preset ratio;
[0022] The grid search algorithm is used to determine the hyperparameters of the artificial neural network, and the training set is used to train the artificial neural network. The test set is used to evaluate the performance of the trained artificial neural network. If the trained artificial neural network passes the performance evaluation, it will be used as a proxy model for the river process.
[0023] In some implementations of the first aspect, the sub-watershed proxy model includes a plurality of sub-watershed proxy units, each of which is independent of each other, and each sub-watershed proxy unit can independently simulate its corresponding sub-watershed.
[0024] In some implementations of the first aspect, the method further includes:
[0025] The out-of-sample validation data is used to compare the performance of the SWAT model and the hierarchical SWAT proxy model to verify the proxy performance of the hierarchical SWAT proxy model. When the proxy performance meets the preset conditions, the hierarchical SWAT proxy model is used to replace the SWAT model in the operation scenario that requires the SWAT model.
[0026] In a second aspect, an embodiment of the present invention provides a device for modeling a hierarchical SWAT agent model based on machine learning, the device comprising:
[0027] A generation module is used to generate a BMPs parameter combination sample and combine the BMPs parameter combination sample with meteorological driving data to generate the first sample required by the SWAT model;
[0028] a processing module, configured to input the first sample into the SWAT model, and the SWAT model outputs sub-basin scale data and river section scale data;
[0029] The generation module is further configured to use the sub-basin scale data as a label corresponding to the first sample, generate a second sample required by the river process proxy model based on the sub-basin scale data, and use the river section scale data as a label corresponding to the second sample;
[0030] A training module is configured to train a first machine learning model using the first sample and its corresponding label to obtain a sub-basin proxy model; and to train a second machine learning model using the second sample and its corresponding label to obtain a river process proxy model;
[0031] The concatenation module is used to concatenate the sub-basin proxy model with the river process proxy model to obtain a hierarchical SWAT proxy model.
[0032] In a third aspect, an embodiment of the present invention provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described above.
[0033] In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable a computer to execute the method described above.
[0034] In an embodiment of the present invention, a hierarchical SWAT proxy model can be constructed to proxy the SWAT model, so that the structure of the hierarchical SWAT proxy model is closer to the SWAT model, which is conducive to more flexible proxy model calling, enhances the versatility of the proxy model, eliminates the need to rebuild the proxy model for a certain function, and increases the interpretability of the proxy model.
[0035] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other features, advantages, and aspects of the embodiments of the present invention will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. The accompanying drawings are provided for a better understanding of the present invention and do not constitute a limitation of the present invention. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, among which:
[0037] Figure 1 A flowchart of a method for modeling a hierarchical SWAT agent model based on machine learning provided in an embodiment of the present invention;
[0038] Figure 2A schematic diagram of the simulation performance of a hierarchical SWAT proxy model provided by an embodiment of the present invention in years with different precipitation intensities;
[0039] Figure 3 A structural diagram of a hierarchical SWAT agent modeling device based on machine learning provided in an embodiment of the present invention;
[0040] Figure 4 The figure is a structural diagram of an exemplary electronic device capable of implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0041] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0042] In addition, the term "and / or" in this invention merely describes an association relationship between related objects, indicating that three possible relationships exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Furthermore, the character " / " in this invention generally indicates that the related objects are in an "or" relationship.
[0043] In order to solve the technical problems arising from the background technology, the embodiments of the present invention provide a modeling method, apparatus, device and storage medium for a hierarchical SWAT proxy model based on machine learning. Specifically, a BMPs parameter combination sample is generated, and the BMPs parameter combination sample is combined with meteorological driving data to generate a first sample required for the SWAT model; the first sample is input into the SWAT model, and the SWAT model outputs sub-basin scale data and river section scale data; the sub-basin scale data is used as the label corresponding to the first sample, and the second sample required for the river process proxy model is generated according to the sub-basin scale data, and the river section scale data is used as the label corresponding to the second sample; the first sample and its corresponding label are used to train the first machine learning model to obtain a sub-basin proxy model; the second sample and its corresponding label are used to train the second machine learning model to obtain a river process proxy model; the sub-basin proxy model and the river process proxy model are connected in series to obtain a hierarchical SWAT proxy model.
[0044] In this way, a hierarchical SWAT proxy model can be constructed to proxy the SWAT model, making the structure of the hierarchical SWAT proxy model closer to the SWAT model, which is conducive to more flexible proxy model calling, enhancing the versatility of the proxy model, eliminating the need to rebuild the proxy model for a certain function, and increasing the interpretability of the proxy model.
[0045] The following describes in detail a method, apparatus, device, and storage medium for modeling a hierarchical SWAT agent model based on machine learning provided by an embodiment of the present invention with reference to the accompanying drawings through specific embodiments.
[0046] Figure 1 A flowchart of a hierarchical SWAT agent modeling method based on machine learning is provided in an embodiment of the present invention, such as Figure 1 As shown, the hierarchical SWAT agent model modeling method 100 may include the following steps:
[0047] S110 , generating a BMPs parameter combination sample, and combining the BMPs parameter combination sample with meteorological driving data to generate a first sample required by the SWAT model.
[0048] In some embodiments, a Latin hypercube sampling algorithm can be used to generate a BMPs parameter combination sample based on the set BMPs parameter value range, and then the BMPs parameter combination sample can be combined with the meteorological driving data to generate the first sample required by the SWAT model, that is, the BMPs parameter combination sample and the meteorological driving data are used together as the input of the SWAT model.
[0049] S120: Input the first sample into the SWAT model, and the SWAT model outputs sub-basin scale data and river section scale data.
[0050] In some embodiments, the first sample can be input into the SWAT model, that is, the BMPs parameter combination sample and the meteorological driving data are input into the SWAT model together, and the SWAT model is simulated to output the sub-basin scale time series and the river section scale time series, and then the surface runoff depth, sediment load intensity, and total nitrogen load intensity of each sub-basin are extracted from the sub-basin scale time series as sub-basin scale data, and at the same time, the daily scale flow, daily scale sediment load flux, and daily scale total nitrogen load flux of each river section are extracted from the river section scale time series as river section scale data.
[0051] S130 , using the sub-basin scale data as a label corresponding to the first sample, generating a second sample required by the river process proxy model based on the sub-basin scale data, and using the river section scale data as a label corresponding to the second sample.
[0052] S140, use the first sample and its corresponding label to train the first machine learning model to obtain a sub-basin proxy model; use the second sample and its corresponding label to train the second machine learning model to obtain a river process proxy model.
[0053] In some embodiments, the first machine learning model may be a random forest. Accordingly, the first sample and its corresponding label may be divided into a training set and a test set according to a preset ratio (e.g., 7:3). A grid search algorithm may be used to determine hyperparameters of the random forest. The training set may be used to train the random forest, and the test set may be used to evaluate the performance of the trained random forest model. If the trained random forest passes the performance evaluation, it may be used as the sub-basin proxy model.
[0054] Specifically, a random forest model is trained and evaluated using BMP parameter combination samples and meteorological driving data as input, and sub-basin-scale data as output. This model comprises multiple independent sub-basin proxy units, each capable of independently simulating its corresponding sub-basin.
[0055] In some embodiments, the second machine learning model may be an artificial neural network. Accordingly, the second samples and their corresponding labels may be divided into a training set and a test set according to a preset ratio (e.g., 7:3). Hyperparameters of the artificial neural network may be determined using a grid search algorithm. The artificial neural network may be trained using the training set, and the performance of the trained artificial neural network may be evaluated using the test set. If the trained artificial neural network passes the performance evaluation, it may be used as a proxy model for the river process.
[0056] In other words, the sub-basin scale data is used as the input of the artificial neural network, and the river section scale data is used as the output of the artificial neural network. The artificial neural network is trained and its performance is evaluated to obtain the river process proxy model.
[0057] It is worth noting that the indicator used in the above performance evaluation can be the coefficient of determination R 2 , root mean square error RMSE.
[0058] S150, the sub-basin proxy model and the river process proxy model are connected in series to obtain a hierarchical SWAT proxy model.
[0059] The output of the sub-basin proxy model serves as the input to the river process proxy model, completing the data transfer between the two levels. Ultimately, the input of the hierarchical SWAT proxy model is a combination of BMP parameters and meteorological data for each sub-basin of the basin; the output is daily-scale flow, daily-scale sediment load flux, and daily-scale total nitrogen load flux for each river section in the basin.
[0060] To sum up, in the embodiment of the present invention, a hierarchical SWAT proxy model can be constructed to proxy the SWAT model, so that the structure of the hierarchical SWAT proxy model is closer to the SWAT model, which is conducive to more flexible proxy model calling, enhances the versatility of the proxy model, eliminates the need to rebuild the proxy model for a certain function, and increases the interpretability of the proxy model.
[0061] It should be noted that, in order to optimize the relevant calculations in the operation scenarios requiring the SWAT model, the hierarchical SWAT agent model modeling method 100 may further include:
[0062] The out-of-sample validation data is used to compare the performance of the SWAT model and the hierarchical SWAT proxy model to verify the proxy performance of the hierarchical SWAT proxy model. When the proxy performance meets the preset conditions, the hierarchical SWAT proxy model is used to replace the SWAT model in the operation scenario that requires the SWAT model.
[0063] The following describes in detail the hierarchical SWAT agent modeling method 100 provided by the embodiment of the present invention in conjunction with a specific embodiment, as shown below:
[0064] (1) Obtain the data required for modeling the hierarchical SWAT agent model:
[0065] The SWAT model has significant practical significance for the simulation of watershed hydrology and nutrients, and the design and planning of BMPs. However, due to the large number of parameters involved, it is extremely difficult to determine the configuration of the optimal management measures. Therefore, this embodiment specifically analyzes and studies the three BMP practices of vegetation buffer strips (FS), grassed waterways (GW), and fertilizer reduction measures (FRT) in the SWAT model. The meteorological driving data of this embodiment comes from multiple meteorological stations in Watershed A, which record daily meteorological data from 2003 to 2022 in detail; the hydrological and water quality data come from monitoring data from multiple hydrological stations in Watershed A. The SWAT model of this embodiment is constructed based on these data. The calibration and value range of the model parameters are determined according to relevant research literature and the SWAT user manual.
[0066] Here, Latin hypercube sampling is used to generate BMPs parameter combination samples based on the set BMPs parameter value range. There are 60 different BMPs parameter combination samples. Each parameter combination sample, combined with meteorological driving data, forms a total of approximately 4,356,000 data items, namely the first sample. The first sample is input into the SWAT model. The sub-basin scale time series and the river section scale time series are obtained by multiple operations on the SWAT model. The surface runoff depth, sediment load intensity, and total nitrogen load intensity of each sub-basin are then extracted from the sub-basin scale time series as sub-basin scale data. At the same time, the daily scale flow, daily scale sediment load flux, and daily scale total nitrogen load flux of each river section are extracted from the river section scale time series as river section scale data. The sub-basin scale data is used as the label corresponding to the first sample. The second sample required for the river process proxy model is generated based on the sub-basin scale data, and the river section scale data is used as the label corresponding to the second sample.
[0067] For example, the BMPs parameters and their value ranges used here can be shown in Table 1:
[0068] Table 1
[0069]
[0070] The superscript a represents a trigger parameter, 1 represents the implementation of waterway grassing measures, and 0 represents non-implementation; the superscript b represents the amount of fertilizer applied, which is calculated based on the original amount of fertilizer applied minus the amount of fertilizer reduction.
[0071] The data required for modeling the hierarchical SWAT agent model can be shown in Table 2:
[0072] Table 2
[0073]
[0074]
[0075] The superscript a indicates that the data is required to construct the sub-basin proxy model. Therefore, the meteorological driving data, BMPs parameters, and sub-basin scale data in Table 2 are the data required to construct the sub-basin proxy model. In other words, the combination of meteorological driving data and BMPs parameters constitutes the first sample input when constructing the sub-basin proxy model, and the sub-basin scale data is its corresponding label.
[0076] The superscript b indicates that the data is required to construct the river process proxy model. Therefore, the sub-basin scale data and river section scale data in Table 2 are the data required to construct the river process proxy model. In other words, the sub-basin scale data constitutes the second sample input when constructing the river process proxy model, and the river section scale data is its corresponding label.
[0077] (2) Train sub-basin proxy models and river process proxy models and evaluate model performance:
[0078] The first sample and its corresponding label are divided into a training set and a test set in a ratio of 7:3. The grid search algorithm is used to determine the hyperparameters of the random forest. The training set is used to train the random forest, and the test set is used to evaluate the performance of the trained random forest model. If the trained random forest passes the performance evaluation, it will be used as the sub-basin proxy model.
[0079] The second sample and its corresponding label are divided into training set and test set in the ratio of 7:3. The grid search algorithm is used to determine the hyperparameters of the artificial neural network. The training set is used to train the artificial neural network, and the test set is used to evaluate the performance of the trained artificial neural network. If the trained artificial neural network passes the performance evaluation, it will be used as a proxy model of the river process.
[0080] It is worth noting that the accuracy of model prediction and computational speed are evaluated by the commonly used evaluation indicators in machine learning (R 2 , RMSE) and training time.
[0081] Finally, the constructed sub-basin proxy model was connected in series with the channel process proxy model to obtain a hierarchical SWAT proxy model. The sub-basin proxy model performed well in simulating surface runoff depth, sediment load intensity, and total nitrogen load intensity in the sub-basin on both the training and test sets. The training time for a single sub-basin simulation unit was 10 seconds. In this example, there were 21 sub-basin units (model hyperparameters were set as follows: n_estimators = 10, max_depth = 6). The channel process proxy model performed well in simulating daily flow, daily sediment load flux, and daily total nitrogen load flux at the outlet of 21 sections across the entire basin on both the training and test sets. The training time for this module was 348 seconds (model hyperparameters were set as follows: input layer node number 63; hidden layer node numbers 126, 189, and 189, respectively; output layer node number 63; optimizer adam).
[0082] For example, the simulation performance of the sub-basin proxy model and the river process proxy model in their corresponding training set and test set can be shown in Table 3 and Table 4 respectively:
[0083] Table 3
[0084]
[0085]
[0086] Table 4
[0087]
[0088] (3) Use out-of-sample validation data to compare the performance of the SWAT model and the hierarchical SWAT agent model to verify the agent performance of the hierarchical SWAT agent model:
[0089] In order to verify the effectiveness of the present invention, the performance of the SWAT model and the hierarchical SWAT agent model were compared using data other than the data used to build the model. Figure 2 As shown, Figure 2 The simulation results in the middle are the simulation results at the outlet of the entire basin, and representative rainfall years were selected for comparison. 2016 was a wet year and 2021 was a dry year. Figure 2 It can be found that there is no significant difference in the performance of the proxy model in simulating different precipitation years, and the flow fitting effect is the best among the three simulations of flow, sediment, and total nitrogen. After comparing the results of multiple calculations, it is confirmed that the simulation results of the hierarchical SWAT proxy model are highly consistent with the simulation results of the SWAT model. This shows that the hierarchical SWAT proxy model constructed using machine learning methods can replace the SWAT model in the calculation scenarios that require the SWAT model. For example, it is feasible to use the hierarchical SWAT proxy model to assist the SWAT model in multi-objective optimization. The time of multiple calculations with the assistance of the proxy model is greatly reduced, as shown in Table 5.
[0090] Table 5
[0091]
[0092] All calculations were run on a personal computer equipped with a 13th Gen Intel(R) Core(TM) i5-13400F (2.50GHz) and 16GB of RAM. In comparison, the hierarchical SWAT agent model significantly reduced the time required for multiple simulations (98.3%) while also reducing the computational burden.
[0093] It is important to note that the hierarchical SWAT proxy model can independently call proxy models for each component to perform watershed simulation operations. In studies of optimal watershed BMP configuration, it can be coupled with multi-objective optimization algorithms to achieve rapid optimization simulation. It can also be flexibly called upon in other application scenarios that require multiple model operations.
[0094] In summary, according to the embodiments of the present invention, at least the following technical effects are achieved:
[0095] This paper uses machine learning algorithms to construct a hierarchical SWAT proxy model to approximate the SWAT model response output. This not only significantly reduces the computational burden of external model calls, but also shortens model simulation time while increasing the interpretability and call flexibility of the proxy model. This accelerates the computational speed of the multi-objective algorithm while maintaining a high level of simulation accuracy. The simulation results of the hierarchical SWAT proxy model under different rainfall conditions are highly consistent with the SWAT model simulation values.
[0096] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0097] The above is an introduction to a method embodiment. The following further illustrates the solution of the present invention through an apparatus embodiment.
[0098] Figure 3 A structural diagram of a hierarchical SWAT agent modeling device based on machine learning provided in an embodiment of the present invention, such as Figure 3 As shown, the hierarchical SWAT agent model modeling apparatus 300 may include:
[0099] The generating module 310 is used to generate a BMPs parameter combination sample, and combine the BMPs parameter combination sample with the meteorological driving data to generate the first sample required by the SWAT model.
[0100] The processing module 320 is used to input the first sample into the SWAT model, and the SWAT model outputs sub-basin scale data and river section scale data.
[0101] The generation module 310 is further configured to use the sub-basin scale data as the label corresponding to the first sample, generate the second sample required by the river process proxy model based on the sub-basin scale data, and use the river section scale data as the label corresponding to the second sample.
[0102] The training module 330 is used to train the first machine learning model using the first sample and its corresponding label to obtain a sub-basin proxy model; and to train the second machine learning model using the second sample and its corresponding label to obtain a river process proxy model.
[0103] The concatenation module 340 is used to concatenate the sub-basin proxy model and the river process proxy model to obtain a hierarchical SWAT proxy model.
[0104] It is understandable that Figure 3 Each module / unit in the hierarchical SWAT agent model modeling apparatus 300 has the function of realizing Figure 1 The functions of the various steps in the hierarchical SWAT agent modeling method 100 shown and their ability to achieve corresponding technical effects are not described here for the sake of brevity.
[0105] Figure 4 4 is a block diagram of an exemplary electronic device capable of implementing embodiments of the present invention. Electronic device 400 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 400 may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the invention described and / or claimed herein.
[0106] like Figure 4 As shown, the electronic device 400 may include a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. Various programs and data required for the operation of the electronic device 400 may also be stored in the RAM 403. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0107] Multiple components in the electronic device 400 are connected to the I / O interface 405, including an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a magnetic disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0108] The computing unit 401 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as method 100. For example, in some embodiments, the method 100 can be implemented as a computer program product, including a computer program tangibly embodied in a computer-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 400 via the ROM 402 and / or the communication unit 409. When the computer program is loaded into the RAM 403 and executed by the computing unit 401, one or more steps of the method 100 described above can be performed. Alternatively, in other embodiments, the computing unit 401 can be configured to perform the method 100 in any other appropriate manner (e.g., by means of firmware).
[0109] The various embodiments described above in the present invention can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0110] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0111] In the context of the present invention, computer-readable media can be tangible media that can contain or store a program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable media can be a computer-readable signal medium or a computer-readable storage medium. Computer-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. More specific examples of computer-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0112] It should be noted that the present invention also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute method 100 and achieve the corresponding technical effect achieved by executing the method in an embodiment of the present invention. For the sake of brevity, they will not be repeated here.
[0113] In addition, the present invention also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the method 100 is implemented.
[0114] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present invention can be achieved. The present invention is not limited here.
[0115] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A hierarchical SWAT agent modeling method based on machine learning, characterized in that: The method comprises: generating a BMPs parameter combination sample, and combining the BMPs parameter combination sample with meteorological driving data to generate a first sample required by the SWAT model; Inputting the first sample into the SWAT model, and having the SWAT model output sub-basin scale data and river section scale data; Using the sub-basin scale data as the label corresponding to the first sample, generating a second sample required by the river process proxy model based on the sub-basin scale data, and using the river section scale data as the label corresponding to the second sample; Using the first sample and its corresponding label to train a first machine learning model to obtain a sub-basin proxy model; using the second sample and its corresponding label to train a second machine learning model to obtain a river process proxy model; The sub-basin proxy model and the river process proxy model are connected in series to obtain a hierarchical SWAT proxy model.
2. The method according to claim 1, characterized in that Generating a BMPs parameter combination sample includes: According to the set value range of BMPs parameters, the Latin hypercube sampling algorithm is used to generate BMPs parameter combination samples.
3. The method according to claim 1, characterized in that The step of inputting the first sample into the SWAT model and having the SWAT model output sub-basin scale data and river section scale data includes: Inputting the first sample into the SWAT model, and having the SWAT model output a sub-basin scale time series and a river section scale time series; Extracting the surface runoff depth, sediment load intensity, and total nitrogen load intensity of each sub-basin from the sub-basin scale time series as sub-basin scale data; The daily flow rate, daily sediment load flux, and daily total nitrogen load flux of each river section are extracted from the river section scale time series as river section scale data.
4. The method according to claim 1, wherein The first machine learning model is a random forest; and the first sample and its corresponding label are used to train the first machine learning model to obtain a sub-basin proxy model, including: Dividing the first samples and their corresponding labels into a training set and a test set according to a preset ratio; A grid search algorithm is used to determine the hyperparameters of the random forest, and the random forest is trained using the training set. The performance of the trained random forest model is evaluated using the test set. If the trained random forest passes the performance evaluation, it is used as the sub-basin proxy model.
5. The method according to claim 1, characterized in that The second machine learning model is an artificial neural network; the second sample and its corresponding label are used to train the second machine learning model to obtain a river process proxy model, including: Dividing the second samples and their corresponding labels into a training set and a test set according to a preset ratio; A grid search algorithm is used to determine the hyperparameters of the artificial neural network, and the training set is used to train the artificial neural network. The performance of the trained artificial neural network is evaluated using the test set. If the trained artificial neural network passes the performance evaluation, it is used as a river process proxy model.
6. The method according to claim 1, wherein The sub-basin proxy model includes a plurality of sub-basin proxy units, each of which is independent of each other and can independently simulate its corresponding sub-basin.
7. The method according to any one of claims 1 to 6, characterized in that The method further comprises: The performance of the SWAT model and the hierarchical SWAT agent model is compared using out-of-sample validation data to verify the agent performance of the hierarchical SWAT agent model. When the agent performance meets the preset conditions, the hierarchical SWAT agent model is used to replace the SWAT model to participate in the computing scenario that requires the SWAT model.
8. A hierarchical SWAT agent modeling device based on machine learning, characterized in that: The device comprises: A generation module is used to generate a BMPs parameter combination sample, and combine the BMPs parameter combination sample with meteorological driving data to generate a first sample required by the SWAT model; a processing module, configured to input the first sample into the SWAT model, and have the SWAT model output sub-basin scale data and river section scale data; The generating module is further configured to use the sub-basin scale data as a label corresponding to the first sample, generate a second sample required by the river process proxy model based on the sub-basin scale data, and use the river section scale data as a label corresponding to the second sample; a training module, configured to train a first machine learning model using the first sample and its corresponding label to obtain a sub-basin proxy model; and to train a second machine learning model using the second sample and its corresponding label to obtain a river process proxy model; The series connection module is used to connect the sub-basin proxy model and the river process proxy model in series to obtain a hierarchical SWAT proxy model.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Watershed hydrological model design method based on storage capacity curve and TOPMODEL
CN102034003A
Global sensitivity analysis method and system based on machine learning proxy modeling
CN117556219A