A dual-path pollution transmission simulation method in karst areas
Patent Information
- Application Number
- CN202610882674.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-18
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2046-06-18
AI Technical Summary
[0005]为解决“双路径”污染贡献难以量化、非线性机制表征不足等技术难题,本发明的目的在于提供一种喀斯特地区双路径污染传输模拟方法
[0053] The beneficial effects of this invention: The PINN (Physical Information Neural Network) model constructed by the method of this invention realizes the effect of runoff processes on river pollutants I in karst regions. MnThe simulation of TN and TP concentrations showed excellent performance in both the training and validation phases. Both the training and validation loss curves decreased smoothly, eventually reaching a low point and stabilizing, indicating good model convergence. This invention focuses on the response mechanisms of stormwater runoff and baseflow, as well as the pulse-like changes in pollutant concentrations, revealing the dual differentiated pollution transport mechanism of karst binary hydrological processes (stormwater runoff and baseflow), deepening the theoretical understanding of the coupling between hydrological processes and pollution migration in karst regions. The constructed model framework and analytical tools provide new insights into clarifying pollutant migration mechanisms in similar areas and offer a scientific methodological foundation and decision support for constructing a surface-subsurface coordinated prevention and control technology system.
Smart Images

Figure CN122414002B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of pollutant migration research technology, specifically relating to a dual-pathway pollution transport simulation method in karst regions. Background Technology
[0002] Karst regions possess a complex dual structure of surface and subsurface layers, and the hydrological processes driving pollutant migration exhibit significant nonlinearity and spatiotemporal heterogeneity. In recent years, research on pollution transport mechanisms in karst regions has developed various techniques, including indoor and outdoor simulation experiments, isotope tracing, hydrological models (such as SWAT and HSPF), and data-driven methods (such as XGBoost and LSTM), achieving significant progress in pollution source apportionment, migration process characterization, and pollution load simulation.
[0003] However, the existing technologies still have the following shortcomings: (1) Scale limitations of traditional experimental and tracing methods: Although indoor and outdoor simulation experiments and isotope technology can finely characterize the pollution transport mechanism at a small scale, they are difficult to promote and apply in large-scale watersheds due to the strong spatiotemporal heterogeneity of karst areas, and are also costly and have limited representativeness. (2) Insufficient applicability of hydrological models in complex karst underlying surfaces: When classic hydrological models such as SWAT and HSPF are applied to karst watersheds with fracture development and rainfall-driven significant time delay characteristics, there is a lack of mechanism, making it difficult to accurately describe the dual-path (such as storm flow and baseflow) pollution transport process. At the same time, the model has many parameters and is difficult to calibrate, resulting in limited simulation accuracy and generalization ability. (3) Lack of physical interpretability of data-driven models: Although pure data-driven methods such as XGBoost and LSTM can fit complex nonlinear relationships, their "black box" characteristics make the models lack physical interpretability, making it difficult to reveal the internal dynamic process of pollution transport, which limits their credibility in mechanism cognition and engineering decision-making. (4) Insufficient consideration of the time-delay characteristics and nonlinear mechanisms driven by hydrology: Existing studies generally ignore the complex interaction and contribution differences between storm flow and baseflow in the runoff process in karst areas, and lack hybrid modeling methods that can simultaneously characterize physical laws and data features.
[0004] In summary, there is an urgent need to develop a pollution transport modeling method that can integrate hydrophysical mechanisms, efficiently utilize observational data, and is applicable to complex karst underlying surface conditions. Summary of the Invention
[0005] To address the technical challenges of quantifying the contribution of "dual-path" pollution and the inadequacy of characterizing nonlinear mechanisms, this invention aims to provide a method for simulating dual-path pollution transport in karst regions.
[0006] The objective of this invention is achieved by including the following steps:
[0007] Step 1: Data Preparation and Preprocessing: Obtain input features and output targets. Input features include runoff, stormwater runoff variation, baseflow variation, water temperature, O2, and pH. Output targets include I... Mn (Permanganate index), TN (total nitrogen), TP (total phosphorus), split the data into training and validation sets, convert them into PyTorch tensors, and create a data loader;
[0008] Step 2, Model Architecture Design: The neural network structure consists of three sub-networks and one interaction network.
[0009] Subnetwork 1: Inputs are runoff, water temperature, O2, and pH; output is... , , ;
[0010] Subnetwork 2: Input is the change in base current, output is , , ;
[0011] Subnetwork 3: Input is the change in rainstorm flow, output is , , ;
[0012] Interactive network: The input is all features, and the output is 9 parameters, i.e. ~ This is used to fine-tune the above parameters;
[0013] During forward propagation, the outputs of the three sub-networks are combined and the output of the interaction network is added. Then, the parameters are limited to a predetermined range by parameter range constraints.
[0014] This invention constructs a recursive concentration model based on incremental runoff components as follows, and combines input parameters and other input features to calculate I using this physical equation. Mn TN, TP;
[0015] ;
[0016] In the equation:
[0017] Characterizing pollutant I Mn exist and The parameter that varies between days has a value range of 0-1.
[0018] Characterizing pollutant I Mn exist and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L.
[0019] Characterizing pollutant I Mn exist and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L.
[0020] Characterizing pollutant TN and The parameter that varies between days has a value range of 0-1.
[0021] Characterizing pollutant TN and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L.
[0022] Characterizing pollutant TN and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L.
[0023] Characterizing pollutant TP in and The parameter that varies between days has a value range of 0-1.
[0024] Characterizing pollutant TP in and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L.
[0025] Characterizing pollutant TP in and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L.
[0026] Indicates the first Daily Pollutant I Mn Concentration, in mg / L;
[0027] Indicates the first Daily pollutant TN concentration, in mg / L;
[0028] Indicates the first Daily pollutant TP concentration, in mg / L;
[0029] Indicates the first Daily Pollutant I Mn Concentration, in mg / L;
[0030] Indicates the first Daily pollutant TN concentration, in mg / L;
[0031] Indicates the first Daily pollutant TP concentration, in mg / L;
[0032] Indicates the first Daily runoff, in m³ 3 / s; Indicates the first Daily runoff, in m³ 3 / s;
[0033] represent Daily torrential rain flow, m 3 / s;
[0034] represent Daily base flow, m 3 / s;
[0035] represent Daily torrential rain flow, m 3 / s;
[0036] represent Daily base flow, m 3 / s;
[0037] = + ;
[0038] = + ;
[0039] The parameters of the above equations are affected by relevant factors, and the main influence relationships are as follows: (1) Describing the parameters of pollutant degradation , , The parameters will change dynamically with runoff and river water chemistry characteristics (pH, O2, water temperature). Runoff describes its physical and dynamic influence on the parameters, while river water chemistry characteristics (pH, O2, water temperature) describe its chemical influence on the parameters. (2) Parameters describing the baseflow migration of pollutants , , , will change dynamically with the change in baseflow. (3) Describes the parameters of pollutant stormwater migration. , , The parameters will change dynamically with the amount of rainwater flow; this invention has developed a neural network model (PINN) that integrates the above physical equations to solve them, so as to dynamically characterize the dynamic change mechanism of pollutant migration parameters.
[0040] Step 3, Model Training: The training process includes data loss and constraint loss to ensure... , , All values are between [0,1]. The optimizer uses Adam (adaptive moment estimation) and has a learning rate schedule (ReduceLROnPlateau).
[0041] In the training loop, dynamic parameters are calculated for each batch, and then the output is calculated through the physical equations. Data loss and constraint loss are calculated, backpropagation is performed, and the weights are updated.
[0042] Use an early stopping strategy to stop training when the verification loss no longer decreases within a specified number of rounds.
[0043] Step 4: Validation and Result Storage: Evaluate the model on the validation set and calculate the error (R²) between the predicted and actual values. 2 (and MAPE, etc.), save the verification results, including input features, actual output, predicted output, error and dynamic parameter values; generate visualization charts, including training history iteration charts, model simulation effect charts, pollutant concentration change charts during base current transport, and pollutant concentration change charts during storm flow transport.
[0044] Preferably, step two, fine-tuning the interactive network, specifically involves inputting all input factors—namely, runoff, water temperature, O2, pH, baseflow change, and stormwater flow change—into a fully connected interactive network. This network contains two hidden layers, each with 128 neurons, uses the Tanh activation function, and outputs nine parameters. ~ Fine-tuning values: Add the fine-tuning values to the corresponding parameters of the three sub-network outputs to obtain the adjusted nine parameter values.
[0045] Preferably, step two, which restricts the parameters to a predetermined range after parameter range constraints, specifically involves: for parameters with predetermined boundaries... Through formula Map it to that range, where Representative parameters Original value, and Represent The upper and lower limits of the value range, Represents a sigmoid function; for positive parameters without boundary constraints, this is achieved through the Softplus function. Ensure that it is a positive number, where For smaller positive values (e.g., 1×10) −8 ).
[0046] Preferably, step three, model training, specifically involves:
[0047] Multiple sets of input factors from each training batch are input into the neural network, and forward propagation yields the corresponding nine dynamic parameters.
[0048] Substitute the dynamic parameters into the physical equation described in step two to calculate the predicted output for each sample in this batch.
[0049] Calculate the predicted output ( ) and measured output ( The mean square error between the two is used as the data loss. ;
[0050] Calculate parameter constraint loss (N is the sample size);
[0051] The total loss is obtained by weighting the data loss and constraint loss together. , where λ is the preset constraint weight;
[0052] Backpropagation is performed based on the total loss to calculate the gradients of the parameters of each layer of the network, and the optimizer is used to update the weights of the neural network.
[0053] The beneficial effects of this invention: The PINN (Physical Information Neural Network) model constructed by the method of this invention realizes the effect of runoff processes on river pollutants I in karst regions. MnThe simulation of TN and TP concentrations showed excellent performance in both the training and validation phases. Both the training and validation loss curves decreased smoothly, eventually reaching a low point and stabilizing, indicating good model convergence. This invention focuses on the response mechanisms of stormwater runoff and baseflow, as well as the pulse-like changes in pollutant concentrations, revealing the dual differentiated pollution transport mechanism of karst binary hydrological processes (stormwater runoff and baseflow), deepening the theoretical understanding of the coupling between hydrological processes and pollution migration in karst regions. The constructed model framework and analytical tools provide new insights into clarifying pollutant migration mechanisms in similar areas and offer a scientific methodological foundation and decision support for constructing a surface-subsurface coordinated prevention and control technology system. Attached Figure Description
[0054] Figure 1 This is a schematic flowchart of the method of the present invention;
[0055] Figure 2 This is a training history iteration diagram of the PINN model for the runoff process in Example 1;
[0056] Figure 3 The image shows the simulation results of the runoff process using the PINN model in Example 1.
[0057] Figure 4 This is a graph showing the change in pollutant concentration during the base current transport process based on the PINN model in Example 1.
[0058] Figure 5 This is a graph showing the change in pollutant concentration during the storm flow transport process based on the PINN model in Example 1. Detailed Implementation
[0059] The present invention will be further described below with reference to the embodiments and accompanying drawings, but this does not limit the present invention in any way. Any changes or substitutions made based on the teachings of the present invention shall fall within the protection scope of the present invention.
[0060] Example 1
[0061] This embodiment uses a specific watershed as an example, as shown in the attached document. Figure 1 The dual-path pollution transport simulation method for karst regions shown in this embodiment includes the following steps:
[0062] Step 1: Data Preparation and Preprocessing: Load data from multiple Excel files, obtain input features and output targets. Input features include runoff, stormwater runoff variation, baseflow variation, water temperature, O2, and pH value. Output targets include I... Mn The data is divided into training and validation sets (80% training, 20% validation) using TN and TP, and then converted into PyTorch tensors to create a data loader.
[0063] Step 2, Model Architecture Design: The neural network structure consists of three sub-networks and one interaction network.
[0064] Subnetwork 1: Inputs are runoff, water temperature, O2, and pH; output is... , , ;
[0065] Subnetwork 2: Input is the change in base current, output is , , ;
[0066] Subnetwork 3: Input is the change in rainstorm flow, output is , , ;
[0067] Interactive network: The input is all features, and the output is 9 parameters, i.e. ~ This is used to fine-tune the above parameters; the interactive network fine-tuning specifically involves: adjusting all input factors ( , , , , , , The input network consists of two fully connected hidden layers (128 neurons each, with Tanh activation function) and an output layer (9 neurons), which outputs 9 fine-tuning values. The fine-tuning values are added to the corresponding parameters of the three sub-network outputs to obtain the adjusted nine parameter values.
[0068] During forward propagation, the outputs of the three sub-networks are combined and the output of the interaction network is added. Then, the parameters are constrained within a predetermined range by parameter range constraints, specifically for parameters with predetermined boundaries. , , , , , , ), using Sigmoid mapping Map it to that range, where Representative parameters ( Original value, and Represent The upper and lower limits of the value range, Represents an S-shaped function; for positive parameters (k6, k9) without boundary constraints (no boundaries defined), the Softplus function is used. Ensure that it is a positive number and its value is stable, where A smaller positive value (1×10 in this embodiment) −8 ).
[0069] Using the combined input parameters and other input characteristics, calculate I using the following physical equations. Mn TN, TP;
[0070] ;
[0071] In the equation:
[0072] Characterizing pollutant I Mn exist and The parameter that varies between days has a value range of 0-1.
[0073] Characterizing pollutant I Mn exist and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L.
[0074] Characterizing pollutant I Mn exist and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L.
[0075] Characterizing pollutant TN and The parameter that varies between days has a value range of 0-1.
[0076] Characterizing pollutant TN and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L.
[0077] Characterizing pollutant TN and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L.
[0078] Characterizing pollutant TP in and The parameter that varies between days has a value range of 0-1.
[0079] Characterizing pollutant TP in and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L.
[0080] Characterizing pollutant TP in and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L.
[0081] Indicates the first Daily Pollutant I Mn Concentration, in mg / L;
[0082] Indicates the first Daily pollutant TN concentration, in mg / L;
[0083] Indicates the first Daily pollutant TP concentration, in mg / L;
[0084] Indicates the first Daily Pollutant I Mn Concentration, in mg / L;
[0085] Indicates the first Daily pollutant TN concentration, in mg / L;
[0086] Indicates the first Daily pollutant TP concentration, in mg / L;
[0087] Indicates the first Daily runoff, in m³ 3 / s; Indicates the first Daily runoff, in m³ 3 / s;
[0088] represent Daily torrential rain flow, m 3 / s;
[0089] represent Daily base flow, m 3 / s;
[0090] represent Daily torrential rain flow, m 3 / s;
[0091] represent Daily base flow, m 3 / s;
[0092] = + ;
[0093] = + ;
[0094] Step 3, Model Training: The training process includes data loss and constraint loss to ensure... , , All values are between [0.1,1]. The optimizer uses Adam and has a learning rate scheduler (ReduceLROnPlateau).
[0095] In the training loop, dynamic parameters are calculated for each batch, and then the output is calculated through the physical equations. Data loss and constraint loss are calculated, backpropagation is performed, and the weights are updated.
[0096] Use an early stopping strategy to stop training when the verification loss no longer decreases within a specified number of rounds.
[0097] Specifically, model training involves:
[0098] Multiple sets of input factors from each training batch are input into the neural network, and forward propagation yields the corresponding nine dynamic parameters.
[0099] Substitute the dynamic parameters into the physical equation described in step two to calculate the predicted output for each sample in this batch.
[0100] Calculate the predicted output ( ) and measured output ( The mean square error between the two is used as the data loss. ;
[0101] Calculate parameter constraint loss (N is the sample size);
[0102] The total loss is obtained by weighting the data loss and constraint loss together. Where λ is the preset constraint weight (in this case) =0.1);
[0103] Backpropagation is performed based on the total loss to calculate the gradients of the parameters of each layer of the network, and the optimizer is used to update the weights of the neural network.
[0104] Step 4: Validation and Result Storage: Evaluate the model on the validation set and calculate the error (R²) between the predicted and actual values. 2 (Similar to MAPE, etc.), the validation results are saved as an Excel file, including input features, true output, predicted output, error, and dynamic parameter values; visualization charts are generated, including training history iteration charts ( Figure 2 ), model simulation effect diagram ( Figure 3 ), Pollutant concentration change during base current transport () Figure 4 ), Pollutant concentration changes during rainstorm transport process () Figure 5 During the validation period, the model tested I. Mn R in simulated concentrations of TN and TP 2 The values were 0.75, 0.60, and 0.62, respectively, and the MAPE values were 15.42%, 5.03%, and 18.62%, respectively.
[0105] After implementing the method of the present invention, it was shown that the storm flow and baseflow paths respectively explained the transmission path I. Mn The changes in concentration were approximately 97.52% and 2.48%, respectively. The storm surge and baseflow pathways explained approximately 30.00% and 70.00% of the changes in TN concentration along the transport pathway, respectively, and approximately 81.82% and 19.18% of the changes in TP concentration along the transport pathway, respectively. The baseflow change showed high sensitivity to TN pollutant concentration (0.8655), while the storm surge change showed lower sensitivity to I... Mn The sensitivity of the river TP is relatively high, at 0.8457 and 0.0425 respectively. See details. Figure 4 and Figure 5 .
[0106] In summary, both stormwater runoff and baseflow exhibit simultaneous increases in pollutant concentration with increases in flow rate. This study confirms that baseflow is also a significant pollutant transport pathway, indicating that pollutants are stored and transported within groundwater systems (pipelines, fissures). It reveals the high vulnerability of karst groundwater, suggesting that pollution has penetrated deep into and accumulated within aquifers, potentially forming a vast "pollutant reservoir" that can be continuously released into water bodies. Stormwater runoff represents concentrated transport through rapid infiltration channels (pipeline flow) such as surface scour, sinkholes, funnels, and underground rivers; its concentration increase reflects the rapid scouring effect on surface and shallow subsurface pollutants. Baseflow represents dispersed flow through small fissures and matrix; its concentration increase reflects the continuous leaching and release process from the rock matrix and the vast underground network.
[0107] Traditional models often assume that baseflow concentration is stable or independent of flow rate. This study reconstructs the dynamic nonlinear response of runoff processes to pollutant migration, demonstrating the crucial importance of developing or employing coupled models capable of simulating the positive correlation between groundwater flow rate and concentration. The results of this study offer differentiated considerations for water quality model construction and water environment management; in model construction, particulate / adsorbed pollutants (I...) must be considered. Mn Two different source-sink processes and migration parameters were established for phosphorus and dissolved pollutants (nitrate nitrogen) to simulate the transport pathways of fast surface flow and slow underground flow, respectively.
Claims
1. A method for simulating dual-pathway pollution transport in karst regions, characterized in that... Includes the following steps: Step 1: Data Preparation and Preprocessing: Obtain input features and output targets. Input features include runoff, stormwater runoff variation, baseflow variation, water temperature, O2, and pH. Output targets include I... Mn TN, TP, I Mn The permanganate index is TN, total nitrogen is TP, and total phosphorus is TP. The data is split into training and validation sets and converted into PyTorch tensors to create a data loader. Step 2, Model Architecture Design: The neural network structure consists of three sub-networks and one interaction network. Subnetwork 1: Inputs are runoff, water temperature, O2, and pH; output is... , , ; Subnetwork 2: Input is the change in base current, output is , , ; Subnetwork 3: Input is the change in rainstorm flow, output is , , ; Interactive network: The input is all features, and the output is 9 parameters, i.e. ~ This is used to fine-tune the above parameters; The fine-tuning of the interactive network involves inputting all input factors—runoff, water temperature, O2, pH, baseflow variation, and stormwater variation—into a fully connected interactive network. This network contains two hidden layers, each with 128 neurons, using the Tanh activation function, and outputs nine parameters. ~ Fine-tuning value; The fine-tuning values are added to the corresponding parameters of the three sub-network outputs to obtain the adjusted nine parameter values. During forward propagation, the outputs of the three sub-networks are combined and the output of the interaction network is added. Then, the parameters are limited to a predetermined range by parameter range constraints. Using the combined input parameters and other input characteristics, calculate I using the following physical equations. Mn TN, TP; ; In the equation: Characterizing pollutant I Mn exist and The parameter varies between days, and its value ranges from 0 to 1. Characterizing pollutant I Mn exist and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L. Characterizing pollutant I Mn exist and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L. Characterizing pollutant TN and The parameter varies between days, and its value ranges from 0 to 1. Characterizing pollutant TN and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L. Characterizing pollutant TN and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L. Characterizing pollutant TP in and The parameter varies between days, and its value ranges from 0 to 1. Characterizing pollutant TP in and The concentration of pollutants along the baseflow pathway due to changes in baseflow over time is expressed in mg / L. Characterizing pollutant TP in and The concentration of pollutants in rainstorm flow caused by changes in rainstorm flow between days is expressed in mg / L. Indicates the first Daily Pollutant I Mn Concentration, in mg / L; Indicates the first Daily pollutant TN concentration, in mg / L; Indicates the first Daily pollutant TP concentration, in mg / L; Indicates the first Daily Pollutant I Mn Concentration, in mg / L; Indicates the first Daily pollutant TN concentration, in mg / L; Indicates the first Daily pollutant TP concentration, in mg / L; Indicates the first Daily runoff, in m³ 3 / s; Indicates the first Daily runoff, in m³ 3 / s; represent Daily torrential rain flow, m 3 / s; represent Daily base flow, m 3 / s; represent Daily torrential rain flow, m 3 / s; represent Daily base flow, m 3 / s; = + ; = + ; Step 3, Model Training: The training process includes data loss and constraint loss to ensure... , , All values are between [0,1], and the optimizer uses Adam with learning rate scheduling; In the training loop, dynamic parameters are calculated for each batch, and then the output is calculated through the physical equations. Data loss and constraint loss are calculated, backpropagation is performed, and the weights are updated. Use an early stopping strategy to stop training when the verification loss no longer decreases within a specified number of rounds. Step 4, Validation and Result Saving: Evaluate the model on the validation set, calculate the error between the predicted and actual values, and save the validation results, including the input features, actual output, predicted output, error, and dynamic parameter values; generate visualization charts, including training history iteration charts, model simulation effect charts, pollutant concentration change charts during base current transport, and pollutant concentration change charts during storm flow transport.
2. The method for simulating dual-path pollution transport in karst areas according to claim 1, characterized in that... Step two involves limiting the parameters to a predetermined range after setting parameter range constraints. Specifically, this means that for parameters with predetermined boundaries... Through formula Map it to that range, where Representative parameters Original value, and Represent The upper and lower limits of the value range, Represents a sigmoid function; for positive parameters without boundary constraints, this is achieved through the Softplus function. Make sure it is a positive number.
3. The method for simulating dual-path pollution transport in karst areas according to claim 1, characterized in that... Step three, model training, specifically involves: Multiple sets of input factors from each training batch are input into the neural network, and forward propagation yields the corresponding nine dynamic parameters. Substitute the dynamic parameters into the physical equation described in step two to calculate the predicted output for each sample in this batch. Calculate the predicted output Compared with the measured output The mean square error between them is used as data loss. ; Calculate parameter constraint loss N is the sample size; The total loss is obtained by weighting the data loss and constraint loss. , where λ is the preset constraint weight; Backpropagation is performed based on the total loss to calculate the gradients of the parameters of each layer of the network, and the optimizer is used to update the weights of the neural network.