A cross-regional sewage data collaborative modeling method and system

CN122154849BActive Publication Date: 2026-10-09GUIZHOU PROVINCIAL ENVIRONMENTAL ENG EVALUATION CENT +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610637883.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-05-11
Publication Date
2026-10-09
Estimated Expiration
2046-05-11

AI Technical Summary

Technical Problem

不同区域的温度、工业与生活污水比例存在差异,直接对底层共享参数进行等权平均,会将上述环境混杂变量的特征耦合进全局底层共享参数中,导致全局底层共享参数偏离纯粹的生化降解机理特征

Benefits of technology

1、本方案通过因果干预模块在前向传播中引入随机掩码向量,并在反向传播中引入反事实正则化项,剥离温度、工业与生活污水比例等环境混杂变量的耦合影响,输出因果不变特征向量。中心服务器基于环境协变量分布的瓦瑟斯坦距离分配动态聚合权重更新全局底层共享参数,结合边缘节点固定全局底层共享参数仅微调顶层个性化预测参数的方式,使得全局底层共享参数限定于跨区域一致的因果特征,避免了环境混杂变量干扰引发的参数平均偏移,消除了跨区域协同建模中的负迁移现象。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122154849B_ABST
    Figure CN122154849B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of groundwater environment monitoring and pollution prevention and control, and discloses a cross-regional sewage data collaborative modeling method and system. A local water quality sequence is obtained, and a graph convolution network is used to encode the node space topological adjacency relationship in the water system basin into a water system topological space feature matrix. Based on the local water quality sequence and the feature matrix, a time series prediction network with a causal intervention module is used for forward propagation, a counterfactual regularization term is introduced through backward propagation, the coupling influence of temperature, industrial and domestic sewage proportion environmental mixed variables is stripped, and a causal invariant feature vector is output. A center server calculates the Wasserstein distance of the environmental covariant distribution of each node, allocates a dynamic aggregation weight according to the distance, updates the global bottom layer shared parameter and issues it. The present application decouples environmental mixed factors, eliminates the cross-regional collaborative modeling negative transfer phenomenon, and ensures the independent update of specific process parameters in each region.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of groundwater environment monitoring and pollution control technology, and discloses a cross-regional wastewater data collaborative modeling method and system. Background Technology

[0002] In the field of cross-regional wastewater treatment data modeling, existing technologies typically employ a standard federated learning architecture. Each regional wastewater treatment plant trains a deep learning model locally using local water quality sequences, and then uploads the model's underlying shared parameters to a central server. The central server performs an equal-weighted average calculation on the received underlying shared parameters from each region to obtain global underlying shared parameters, which are then distributed to each regional node to overwrite the local underlying parameters. During this training process, the local water quality sequences input by each region include environmental characteristics such as temperature and the ratio of industrial to domestic wastewater.

[0003] The aforementioned standard federated learning architecture uses an equal-weighted averaging method to update the global underlying shared parameters, which presents a technical problem that can lead to negative transfer of the model. Different regions have varying temperatures and proportions of industrial and domestic wastewater. Directly applying equal-weighted averaging to the underlying shared parameters couples the characteristics of these environmental confounding variables into the global underlying shared parameters, causing them to deviate from the purely biochemical degradation mechanism characteristics. After being distributed to nodes in specific regions, the heterogeneous environmental confounding variables carried in the global underlying shared parameters can interfere with the prediction process of specific local processes, leading to increased prediction errors for that specific process data in that region. Summary of the Invention

[0004] The purpose of this invention is to provide a cross-regional wastewater data collaborative modeling method and system, which can effectively solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A cross-regional wastewater data collaborative modeling method includes: obtaining the local water quality sequence of each edge node, and using a graph convolutional network to encode the spatial topological adjacency relationship of each wastewater treatment node in the same water system basin into a water system topological spatial feature matrix; Based on the local water quality sequence and the water system topology feature matrix, a time series prediction network with a causal intervention module is used for forward propagation. In the back propagation stage, a counterfactual regularization term is introduced to remove the coupling effect of environmental confounding variables such as temperature and the ratio of industrial and domestic sewage, and output a causal invariant feature vector. The network underlying shared parameters corresponding to the causal invariant feature vector are uploaded to the central server. The central server calculates the Wasserstein distance of the environmental covariate distribution of each node, assigns dynamic aggregation weights to the underlying shared parameters of each edge node based on the Wasserstein distance, and updates and distributes the global underlying shared parameters by weighted averaging. The globally shared parameters at each edge node are fixed and updated. The personalized prediction parameters at the top layer of the network are then fine-tuned using local causal invariant feature vectors and local specific process labels to generate a collaborative prediction model.

[0006] Preferably, the step of encoding the spatial topological adjacency relationship of each sewage treatment node in the same water system basin into a water system topological spatial feature matrix using a graph convolutional network includes: extracting the physical connection path of the pipeline network and the direction of water flow between upstream and downstream sewage treatment nodes in the same water system basin, and constructing a directed graph adjacency matrix; Obtain the geographic latitude and longitude coordinates and pipe diameter of each node in the directed graph adjacency matrix, calculate the spatial distance attenuation weight and pipe network flux weight between nodes, and multiply the spatial distance attenuation weight and the pipe network flux weight to obtain the composite edge weight matrix. Perform a Hadamard product between the composite edge weight matrix and the directed graph adjacency matrix to generate a weighted directed graph adjacency matrix; The weighted directed graph adjacency matrix is ​​input into a graph convolutional network to extract the spatial dependencies of the wastewater treatment nodes under the watershed topology and output the water system topology spatial feature matrix.

[0007] Preferably, the forward propagation through a temporal prediction network with a causal intervention module, and the introduction of a counterfactual regularization term in the back propagation stage, includes: connecting a causal intervention module after the feature extraction layer of the temporal prediction network, wherein the causal intervention module generates a random mask vector by sampling environmental confounding variables using a Gaussian distribution based on the reparameterization technique. The random mask vector is multiplied element-wise with the input features to obtain the feature representation after intervention; Construct a counterfactual data generator to replace the environmental confounding variable values ​​in the post-intervention feature representation with preset baseline values ​​to generate counterfactual feature representations; The mean squared error between the post-intervention feature representation and the counterfactual feature representation in the feature space is calculated, and the mean squared error is incorporated into the loss function as the counterfactual regularization term for backpropagation.

[0008] Preferably, the central server calculates the Wasserstein distance of the distribution of environmental covariates of each node, and assigns dynamic aggregation weights to the underlying shared parameters of each edge node based on the Wasserstein distance, including: the central server receiving the environmental covariate statistical moments uploaded by each edge node, wherein the environmental covariate statistical moments include the mean temperature, the mean proportion of industrial wastewater and the mean proportion of domestic wastewater; Based on the environmental covariate statistical moments, the Wasserstein matrix between any two edge nodes is calculated using the optimal transmission algorithm. The column vectors corresponding to each edge node in the Wasserstein matrix are subjected to negative exponent operation, and the operation result is normalized to the interval [0,1] to generate the dynamic aggregation weights corresponding to each edge node. The underlying shared parameters are weighted and summed based on the dynamic aggregation weights.

[0009] Preferably, the step of fine-tuning the personalized prediction parameters of the top layer of the network using local causal invariant feature vectors and local specific process labels includes: freezing the global bottom-level shared parameters received from the central server at each edge node, and locking the gradient backpropagation path of the causal invariant feature vectors. The local causal invariant feature vector is input into the personalized prediction parameters of the top layer of the network, which consists of a fully connected layer and an attention mechanism layer. Using the dissolved oxygen variation sequence and sludge concentration variation sequence in the aeration tank contained in the local specific process label as monitoring signals, the smoothed L1 loss between the prediction sequence and the monitoring signals is calculated. Based on the smooth L1 loss, gradient updates are performed only on the weight parameters in the fully connected layer and the attention mechanism layer.

[0010] Preferably, the forward propagation based on the local water quality sequence and the water system topology feature matrix through a time-series prediction network with a causal intervention module includes: inputting the local water quality sequence into a long short-term memory network and extracting the hidden state vector in the time dimension; The hidden state vector and the water system topology feature matrix are concatenated along the channel dimension to generate a spatiotemporal fusion feature tensor. The spatiotemporal fusion feature tensor is input into the causal intervention module, and an independent random mask vector is applied to each channel of the spatiotemporal fusion feature tensor to obtain the post-intervention feature representation. The post-intervention feature representation is then flattened and linearly mapped sequentially to output the causal invariant feature vector.

[0011] Preferably, the calculation of spatial distance attenuation weight and pipeline flux weight between nodes includes: obtaining the geographical length of the pipeline network and pipeline flow monitoring data between each sewage treatment node; Substitute the geographical length into the Gaussian kernel function to calculate the spatial distance attenuation weight; Extract the maximum and minimum flow values ​​from the pipeline flow monitoring data, divide the difference between the current flow value and the minimum flow value by the difference between the maximum and minimum flow values, add a constant bias term to the division result, and generate the pipeline flow weight. The spatial distance attenuation weight and the pipeline flux weight are input into a multiplier to perform element-wise multiplication, and the composite edge weight matrix is ​​output.

[0012] Preferably, the step of calculating the Wasserstein matrix between any two edge nodes using the optimal transmission algorithm based on the environmental covariate statistical moments includes: converting the environmental covariate statistical moments of each edge node into a discrete probability distribution vector; Construct a square matrix containing the number of all edge nodes as the transmission cost matrix, where the elements of the transmission cost matrix are the Euclidean distance between any two discrete probability distribution vectors; Using the transmission cost matrix and the discrete probability distribution vector as input, the Sinkhorn iterative algorithm is called to solve for the optimal transmission planning matrix; The sum of the elements in each column of the optimal transmission planning matrix is ​​filled into the corresponding positions to generate the Wasserstein matrix.

[0013] Preferably, the step of inputting the local causal invariant feature vector into the personalized prediction parameters of the top layer of the network, which consists of a fully connected layer and an attention mechanism layer, includes: inputting the local causal invariant feature vector into the fully connected layer and mapping the vector dimension to the preset query matrix, key matrix and value matrix dimensions; Perform matrix multiplication on the query matrix and the transposed key matrix to obtain the attention score matrix; Divide the attention score matrix by the square root of the key matrix dimension and input it into the Softmax classifier to perform a normalization operation; Multiply the normalized attention score matrix by the value matrix to output the attention-weighted feature vector; The attention-weighted feature vector is added to the initial mapping vector output by the fully connected layer as a residual, and then input into the smooth L1 loss calculation process.

[0014] A cross-regional wastewater data collaborative modeling system includes: a water system topology encoder, used to obtain the local water quality sequence of each edge node, and to use a graph convolutional network to encode the spatial topological adjacency relationship of each wastewater treatment node in the same water system basin into a water system topology spatial feature matrix; A causal feature extractor is used to perform forward propagation through a time-series prediction network with a causal intervention module based on the local water quality sequence and the water system topology feature matrix. In the back propagation stage, a counterfactual regularization term is introduced to remove the coupling effect of environmental confounding variables such as temperature and the ratio of industrial and domestic sewage, and output a causal invariant feature vector. A dynamic weight aggregator is used to upload the network underlying shared parameters corresponding to the causal invariant feature vector to the central server. The central server calculates the Wasserstein distance of the distribution of environmental covariates of each node, assigns dynamic aggregation weights to the underlying shared parameters of each edge node according to the Wasserstein distance, and updates and distributes the global underlying shared parameters by weighted averaging. A personalized fine-tuner is used to fix the updated global bottom-level shared parameters at each edge node, and fine-tune the personalized prediction parameters of the top layer of the network using local causal invariant feature vectors and local specific process labels to generate a collaborative prediction model.

[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This scheme introduces a random mask vector in the forward propagation and a counterfactual regularization term in the backpropagation through a causal intervention module. This removes the coupling effects of environmental confounding variables such as temperature and the ratio of industrial to domestic sewage, outputting a causal-invariant feature vector. The central server dynamically aggregates weights based on the Wasserstein distance of the environmental covariate distribution to update the global underlying shared parameters. Combined with the edge nodes fixing the global underlying shared parameters and only fine-tuning the top-level personalized prediction parameters, the global underlying shared parameters are limited to consistent causal characteristics across regions. This avoids parameter average shifts caused by environmental confounding variables and eliminates negative migration in cross-regional collaborative modeling.

[0016] 2. A directed graph is constructed by extracting the physical connection paths and flow directions of the pipe network. A composite edge weight matrix is ​​calculated by combining geographical latitude and longitude with pipe diameter, ensuring that the encoding of the water system topology feature matrix aligns with the actual physical transmission patterns of the sewage pipe network. The Wasserstein matrix is ​​calculated using environmental covariate statistical moments combined with an optimal transmission algorithm, generating dynamic aggregate weights. The gradient backpropagation path is locked by freezing the global bottom-level shared parameters, and the smoothing loss is calculated using dissolved oxygen in the aeration tank and sludge concentration as monitoring signals, updating only the top-level parameters. This ensures independent updates of specific process parameters in each region, maintaining the local model's adaptation to specific processes. Attached Figure Description

[0017] Figure 1 This is an overall flowchart of the present invention; Figure 2 This is a flowchart illustrating the generation process of the water system topology spatial feature matrix in this invention. Figure 3 This is a flowchart of the causal intervention and counterfactual regularization process of the present invention; Figure 4 This is a flowchart of the dynamic aggregation weight calculation process of the present invention; Figure 5 This is a flowchart of the personalized prediction parameter fine-tuning process of the present invention; Figure 6 This is a diagram of the cross-regional wastewater data collaborative modeling system architecture of the present invention. Detailed Implementation

[0018] Please refer to the attached document. Figure 1 This embodiment provides a tributary of the Huai River Basin containing eight wastewater treatment edge nodes. Each edge node is deployed in the local industrial control system of the corresponding wastewater treatment plant and has the ability to collect local water quality data, train models and infer. The central server is deployed on the basin-level water management and control platform and is connected to each edge node through an encrypted communication link. The communication process uses an asymmetric encryption algorithm to encrypt the transmitted parameters and data to ensure the security and privacy of cross-regional data transmission.

[0019] Each edge node collects local water quality sequences at the inlet using locally deployed online water quality monitoring sensor arrays. These sequences include water quality indicators such as influent chemical oxygen demand (COD) concentration, ammonia nitrogen concentration, total phosphorus concentration, pH value, and instantaneous influent flow rate. The sampling interval for each indicator is uniformly set to 15 minutes, with a single sample time window of 7 consecutive days, corresponding to a time step of 672. The tensor dimension of a single sample is [672, 5], where 672 is the time step dimension and 5 is the water quality indicator dimension. Each edge node performs preprocessing operations on the collected local water quality sequences, including outlier removal and normalization. Outlier removal uses a 3x3 matrix. The criteria are as follows: for each water quality indicator, calculate its mean and standard deviation within a sliding window. The sliding window is centered on the current time step, taking two time steps forward and two time steps backward, for a total length of five time steps. If the indicator value at the current time step exceeds the range of mean ± three times the standard deviation, it is judged as an outlier and replaced with the mean within the sliding window. The normalization process uses the min-max normalization method to map the values ​​of each indicator to the interval [0,1], eliminating the influence of the difference in the dimensions of different indicators on the subsequent feature extraction process.

[0020] Wastewater treatment nodes within the same watershed are connected by a wastewater pipeline network, forming a spatial topological adjacency relationship between upstream and downstream nodes. This adjacency relationship reflects the physical impact of the effluent quality of upstream nodes on the influent quality of downstream nodes. In this embodiment, the pipeline connection relationships of each wastewater treatment node within the watershed are extracted, and an undirected graph adjacency matrix is ​​constructed. The dimension of the adjacency matrix is... Where N is the total number of wastewater treatment nodes in the watershed, in this embodiment The value is 8, the th in the adjacency matrix. Line 1 When the element of a column is 1, it indicates that the first element is the first element. The node and the first There are direct physical connections between the nodes, with a value of 0 indicating no direct physical connection. The constructed adjacency matrix is ​​input into a two-layer graph convolutional network, which extracts the spatial dependencies of each node within the watershed topology. The output dimension is... The water system topology spatial feature matrix is ​​given by d, where d is the dimension of the spatial features, which is set to 64 in this embodiment.

[0021] Based on the preprocessed local water quality sequence and the generated water system topology feature matrix, a time-series prediction network with a causal intervention module is used for forward propagation. The preprocessed local water quality sequence is input into the feature extraction layer of the time-series prediction network. This layer employs a long short-term memory (LSTM) network structure to extract the hidden state vectors in the time dimension of the time-series data. The dimension of the hidden state vectors is consistent with the feature dimension of the water system topology feature matrix. The hidden state vectors and the water system topology feature matrix are concatenated along the channel dimension to generate a spatiotemporal fusion feature tensor. This tensor simultaneously contains the temporal dependence of local water quality and the spatial topological features between nodes within the watershed. The spatiotemporal fusion feature tensor is then input into the causal intervention module. During forward propagation, the causal intervention module applies a random mask operation to the feature channels related to environmental confounding variables in the input features. These environmental confounding variables include influent temperature, the proportion of industrial wastewater, and the proportion of domestic wastewater.

[0022] In the backpropagation phase, a counterfactual regularization term is constructed. This term constrains the model to learn feature representations unrelated to environmental confounding variables. The counterfactual regularization term is then weighted and summed with the main loss function of the prediction task to obtain the total loss function. Backpropagation and parameter updates are performed based on this total loss function, separating the coupling effects of environmental confounding variables such as temperature and the ratio of industrial to domestic wastewater. The final output dimension is... The causal invariant eigenvectors, where The dimension of the causal invariant feature is set to 128 in this embodiment.

[0023] The causal invariant feature vector is extracted from the underlying shared parameters of the time-series prediction network. These underlying shared parameters include the weight parameters of the graph convolutional network, the weight parameters of the long short-term memory network, and the linear mapping parameters of the causal intervention module. These parameters are general parameters related to the biochemical degradation mechanism of wastewater in the watershed and can be shared among the edge nodes. Each edge node uploads the trained underlying shared parameters, along with the statistical moments of local environmental covariates, to the central server via an encrypted communication link. The statistical moments of the environmental covariates include the average influent temperature, the average proportion of industrial wastewater, and the average proportion of domestic wastewater within the local monitoring period.

[0024] After receiving the parameters and statistical moment data uploaded by all edge nodes, the central server calculates the Wasserstein distance between any two edge nodes in terms of their environmental covariate distributions. The Wasserstein distance quantifies the degree of difference in the environmental covariate distributions between two nodes; a smaller distance indicates that the environmental distributions of the two nodes are more similar. Based on the calculated Wasserstein distance, the central server assigns dynamic aggregation weights to the underlying shared parameters of each edge node, with the sum of all dynamic aggregation weights being 1. The central server then performs a weighted average calculation on the underlying shared parameters uploaded by all edge nodes according to the dynamic aggregation weights, updating the global underlying shared parameters. These global underlying shared parameters are then distributed to all edge nodes within the watershed via an encrypted communication link.

[0025] After receiving the globally shared parameters from the central server, each edge node fixes the values ​​of these parameters and locks the gradient backpropagation path for the corresponding parameters. During subsequent fine-tuning training, the values ​​of these globally shared parameters remain unchanged. The causal invariant feature vectors extracted during local training are input into the top-level structure of the network. This top-level structure includes fully connected layers and an output layer, corresponding to the personalized prediction parameters at the top level of the network. Specific process labels corresponding to the local wastewater treatment process are used as monitoring signals. These labels include time-series sequences of dissolved oxygen concentration in the aeration tank and activated sludge concentration. The loss value between the model's output prediction sequence and the monitoring signal is calculated. Based on this loss value, gradient updates are performed only on the personalized prediction parameters at the top level of the network, while the underlying shared parameters remain fixed. After completing a preset number of fine-tuning training rounds, a collaborative prediction model adapted to the local wastewater treatment process is generated. This collaborative prediction model can be used for predicting local influent water quality changes and optimizing biochemical treatment process parameters.

[0026] In this embodiment, the core parameters of the local water quality sequence of each edge node are shown in the following table: Table 1. Core parameters of local water quality sequence for each edge node.

[0027] This table is used to clarify the basic parameters of the local water quality sequence input by each edge node in this embodiment. The uniform sampling interval and time window length ensure the dimensionality consistency of the input data of each node, providing a unified data foundation for subsequent cross-node feature fusion and parameter aggregation. The standardized preprocessing operation eliminates the dimensional differences and outlier interference in the data acquisition process of different nodes.

[0028] In this embodiment, a graph convolutional network is used to encode the spatial topological relationships of wastewater treatment nodes within the watershed. A time-series prediction network with a causal intervention module is used to extract causal invariant feature vectors decoupled from environmental confounding variables. Based on the Wasserstein distance distribution difference of environmental covariates, dynamic aggregation weights are assigned to update the global bottom-level shared parameters. Finally, a collaborative prediction model adapted to the local process is generated by fixing the bottom-level parameters and fine-tuning the top-level personalized parameters, thus avoiding the parameter offset problem caused by the coupling of environmental confounding variables during the global parameter update process.

[0029] In a preferred embodiment, the spatial topological adjacency relationship encoding process for wastewater treatment nodes within the same watershed involves extracting the physical connection paths of the pipe network and the water flow direction between upstream and downstream wastewater treatment nodes within the same watershed, and constructing a directed graph adjacency matrix. Specifically, wastewater within the watershed flows along a fixed water flow direction in the pipe network. The effluent from upstream nodes enters the downstream pipe network, directly affecting the influent quality of downstream nodes. Conversely, the effluent from downstream nodes does not affect the influent quality of upstream nodes. Therefore, a directed graph structure is used to model this physical phenomenon. (Directed graph adjacency matrix) The dimension is [N,N], where The total number of wastewater treatment nodes within the watershed, and the elements in the matrix. The rule for determining the value is: when there exists a value from the first... The node points to the first The physical connection path of the sewage pipe network at each node, with the water flow direction from the first node... The flow from the node to the first When there are nodes, The value is 1; in other cases The value is 0.

[0030] Obtain the geographic latitude and longitude coordinates and pipe diameter of each node in the directed graph adjacency matrix, and calculate the spatial distance attenuation weight and pipe flux weight between nodes. Using the UTM projected coordinate system, the geographic latitude and longitude coordinates of each node are converted to Cartesian coordinates to eliminate the influence of spherical latitude and longitude coordinates on distance calculation, ensuring the accuracy of geographic distance calculation between nodes. The spatial distance attenuation weight is calculated using a Gaussian kernel function, and the corresponding expression is:

[0031] in, For the first The node and the first Spatial distance decay weight between nodes For the first The transformed Cartesian coordinate vectors of the geographic latitude and longitude coordinates of each node For the first The transformed Cartesian coordinate vectors of the geographic latitude and longitude coordinates of each node For L2 norm operations, The bandwidth parameter of the Gaussian kernel function is set to the maximum geographical distance between nodes within the watershed in this embodiment. The spatial distance attenuation weight is used to characterize the attenuation effect of geographical distance between nodes on water quality. The greater the geographical distance between two nodes, the lower the impact of the upstream node's effluent on the downstream node's influent water quality, and the smaller the corresponding spatial distance attenuation weight value.

[0032] Pipeline flow weights are calculated based on pipeline segment flow monitoring data, and the corresponding expression is:

[0033] in, For the first The node and the first The pipeline flux weight between nodes connecting the pipeline network This represents the current flow rate monitoring value for the corresponding pipe segment. This represents the maximum flow rate of the corresponding pipe section during the monitoring period. This represents the minimum flow rate of the corresponding pipe section during the monitoring period. This is a constant bias term, set to 0.01 in this embodiment, to avoid a weight value of 0 when the pipe flow rate is 0. The pipe network flux weight is used to characterize the weight of the influence of the pipe network's water conveyance capacity on water quality transmission. The larger the actual flow rate of the pipe segment, the more sewage is transmitted from the upstream node to the downstream node per unit time, and the higher the degree of influence of the upstream node's water quality on the downstream node, the larger the corresponding pipe network flux weight value.

[0034] The spatial distance attenuation weight and the pipeline flux weight are input into a multiplier to perform element-wise multiplication, outputting a composite edge weight matrix, the corresponding expression of which is:

[0035] in, The first edge in the composite edge weight matrix Line 1 The element of the column corresponds to the first... The node points to the first The composite weight value of the connecting edges of each node. This is an element-wise multiplication operation. Composite edge weight matrix. The dimension is [N,N], which is consistent with the dimension of the adjacency matrix of the directed graph.

[0036] Perform a Hadamard product between the composite edge weight matrix and the directed graph adjacency matrix to generate a weighted directed graph adjacency matrix, the corresponding expression of which is:

[0037] in, For a weighted directed graph adjacency matrix, It is the adjacency matrix of a directed graph. The Hadamard product operation involves performing element-wise multiplication on corresponding elements of two matrices. Through the Hadamard product operation, only the composite weights of edges with actual physical connections are retained, while the weights of edges without physical connections remain at 0. This ensures that the adjacency matrix of the weighted directed graph perfectly reflects the actual physical connections and transmission patterns of the watershed's pipeline network.

[0038] The weighted directed graph adjacency matrix is ​​input into a graph convolutional network to extract the spatial dependencies of wastewater treatment nodes within the watershed topology, outputting a water system topological spatial feature matrix. The expression corresponding to the layer propagation rule of the graph convolutional network is:

[0039] in, For graph convolutional networks The input feature matrix of the layer, For the first The output feature matrix of the layer, For a weighted directed graph with added self-connections, It is the identity matrix. for The degree matrix, the elements on the diagonal of the degree matrix. , For graph convolutional networks The trainable weight matrix of the layer, For non-linear activation functions, the ReLU activation function is used in this embodiment.

[0040] In this embodiment, please refer to the appendix. Figure 2 The graph convolutional network is set to two layers, with the first layer taking the feature matrix as input. The initial feature vectors for each node include basic attribute features such as the node's designed processing capacity, average daily water volume processed, and pipe diameter. The dimension of the first layer's output features is set to 128, and the dimension of the second layer's output features is set to 64. The final output of the second layer... This is a water system topology spatial feature matrix with dimensions [N, 64]. Each row vector in the matrix corresponds to the spatial feature representation of a sewage treatment node under the watershed topology.

[0041] In this embodiment, the calculation results of the pipeline connection parameters and composite edge weights of each sewage treatment node in the watershed are shown in the table below: Table 2. Calculation of Pipeline Connection Parameters and Composite Edge Weights for Each Wastewater Treatment Node in the Basin

[0042] This table is used to display the calculation results of the core parameters and composite edge weights of the connecting pipe segments of each upstream and downstream node in the watershed in this embodiment. By combining the spatial distance attenuation weight and the pipeline flux weight, the degree of influence of different pipe segments on water quality transmission is quantitatively characterized, providing a numerical basis for the construction of the weighted directed graph adjacency matrix and ensuring the accuracy of the water system topology spatial feature encoding.

[0043] In this embodiment, a directed graph adjacency matrix is ​​constructed to accurately represent the unidirectional physical law of sewage transmission in the watershed. A composite edge weight matrix is ​​calculated by combining geographical distance and pipeline flow to generate a weighted directed graph adjacency matrix that fits the actual physical transmission characteristics. Then, the water system topology spatial feature matrix is ​​extracted by a graph convolutional network, which realizes the accurate encoding of the spatial topology adjacency relationship of each sewage treatment node in the watershed, and provides a reliable spatial feature foundation for the subsequent extraction of spatiotemporal fusion features.

[0044] In another preferred embodiment, for the forward propagation and causal feature extraction processes of the temporal prediction network, the local water quality sequence is input into a Long Short-Term Memory (LSTM) network to extract the hidden state vector in the time dimension. The LTM network includes input gates, forget gates, cell states, and output gates to capture long-term temporal dependencies in the local water quality sequence, solving the gradient vanishing problem inherent in traditional recurrent neural networks. In this embodiment, the input to the LTM network is the preprocessed local water quality sequence, and the input tensor dimension is... ,in For training batch size, For time step, The water quality index dimension is used; the Long Short-Term Memory network is set to two layers, with a hidden layer dimension of 64, consistent with the feature dimension of the water system topology feature matrix. After concatenating the output hidden state vectors at each time step, the resulting structure has a dimension of [missing value]. The time-hidden state matrix.

[0045] The hidden state vector and the water system topology feature matrix are concatenated along the channel dimension to generate a spatiotemporal fusion feature tensor. Specifically, for the water system topology feature vector corresponding to the current edge node, it is copied and expanded along the time step dimension to obtain a tensor with dimension [missing information]. The spatial feature extension matrix is ​​such that the spatial feature vectors corresponding to each time step are completely identical, representing the constant influence of watershed topology on water quality characteristics across all time steps. The temporal hidden state matrix and the spatial feature extension matrix are concatenated along the channel dimension, resulting in a spatiotemporal fusion feature tensor with dimension [missing information]. The first 64 channels are hidden features in the time dimension, and the last 64 channels are topological features in the spatial dimension. The spatiotemporal fusion feature tensor simultaneously integrates the temporal variation pattern of local water quality and the spatial influence relationship between nodes in the basin.

[0046] Please refer to the attached document. Figure 3 A causal intervention module is connected after the feature extraction layer of the temporal prediction network. This module uses a reparameterization technique to sample environmental confounding variables using a Gaussian distribution to generate a random mask vector. The expression corresponding to the reparameterization sampling is:

[0047] in, For the first The element values ​​of the random mask vector corresponding to each feature channel. It follows a Gaussian distribution. For the first The mean of the Gaussian distribution corresponding to each feature channel is fixed at 1 in this embodiment. For the first The standard deviation of the Gaussian distribution corresponding to each feature channel is set to 0.1 in this embodiment. Random mask vector. The dimension of the vector is consistent with the channel dimension of the spatiotemporal fusion feature tensor, i.e., the dimension is

[128] . Each element in the vector corresponds to the mask coefficient of a feature channel. The application of the reparameterization technique makes the sampling process of the random mask vector differentiable in the forward propagation, ensuring the normal backpropagation of the gradient in the backward propagation process.

[0048] The random mask vector is multiplied element-wise with the input features to obtain the post-intervention feature representation, and the corresponding expression is:

[0049] in, For the post-intervention feature representation, the dimension is consistent with the spatiotemporal fusion feature tensor, which is... , The spatiotemporal fusion feature tensor of the causal intervention module is used as input. The Hadamard product operation involves performing element-wise multiplication of each element in the random mask vector with the feature values ​​of all time steps of the corresponding channel in the spatiotemporal fusion feature tensor. This operation enables independent intervention in each feature channel, with the intervention strength for different feature channels determined by the corresponding element values ​​of the random mask vector.

[0050] A counterfactual data generator is constructed to replace the values ​​of environmental confounding variables in the post-intervention feature representation with preset baseline values, generating counterfactual feature representations. The counterfactual data generator is used to construct counterfactual scenarios where the environmental confounding variables are set to the baseline values. In these scenarios, the feature representations output by the model should be consistent with the feature representations in the real scenario, thereby constraining the model to learn causally invariant features unrelated to the environmental confounding variables. In this embodiment, the preset baseline values ​​are the average values ​​of the environmental confounding variables across the entire watershed, including the average influent temperature, the average proportion of industrial wastewater, and the average proportion of domestic wastewater. The values ​​of the feature channels corresponding to these three environmental confounding variables in the post-intervention feature representation are all replaced with their corresponding watershed average values, while the values ​​of the remaining feature channels remain unchanged, generating counterfactual feature representations. The dimensions of the counterfactual features are completely consistent with the features after intervention, which is... .

[0051] The mean squared error of the post-intervention feature representation and the counterfactual feature representation in the feature space is calculated. This mean squared error is then incorporated as a counterfactual regularization term into the loss function for backpropagation. The expression for the counterfactual regularization term is as follows:

[0052] in, For counterfactual regularization, For time step, This represents the total number of feature channels. The first feature representation after intervention The time step, the first The characteristic values ​​of each channel, The first in the counterfactual feature representation The time step, the first The feature values ​​of each channel. The smaller the value of the counterfactual regularization term, the smaller the difference between the feature representation after intervention and the counterfactual feature representation. The less sensitive the feature representation learned by the model is to changes in the values ​​of environmental confounding variables, and the stronger the causal invariance of the feature.

[0053] Incorporating the counterfactual regularization term into the total loss function, the corresponding expression is:

[0054] in, For the total loss function, The main loss function for the prediction task is the mean squared error loss for the water quality prediction task in this embodiment. The regularization coefficient is set to 0.5 in this embodiment to balance the weights of the main loss function and the counterfactual regularization term. During the backpropagation phase, the gradient of the network parameters is calculated based on the total loss function, and gradient descent updates are performed. The constraint of the counterfactual regularization term forces the model to remove the coupling effects of environmental confounding variables during feature extraction.

[0055] The post-intervention feature representation is then flattened and linearly mapped sequentially to output a causal-invariant feature vector. The dimension is... The features after intervention are flattened and transformed into dimensions. The one-dimensional feature vector is then input into the linear mapping layer. The weight parameters of the linear mapping layer are shared parameters of the bottom layer of the network. The output dimension of the linear mapping layer is set to 128, and the final output is a causal invariant feature vector with dimension

[128] . The causal invariant feature vector removes the coupling effects of environmental confounding variables such as temperature and the ratio of industrial and domestic sewage, and retains only the cross-regional stable causal features related to the biochemical degradation mechanism of sewage.

[0056] In this embodiment, the core operating parameters of the causal intervention module are shown in the table below: Table 3 Core Operating Parameters of the Causal Intervention Module

[0057] This table clarifies the core operating parameters and corresponding functions of the causal intervention module in this embodiment. The unified parameter settings ensure the reproducibility of the causal intervention operation. By combining reparameterized sampling and counterfactual regularization, the coupling effects of environmental confounding variables are effectively removed, providing a standardized parameter basis for the extraction of causal invariant feature vectors.

[0058] In this embodiment, the time-dependent features of local water quality sequences are extracted through a long short-term memory network, and a spatiotemporal fusion feature tensor is generated by combining the topological features of the water system. A causal intervention module is constructed based on the reparameterization technique to apply random intervention to the feature channels. A counterfactual feature representation is constructed through a counterfactual data generator, and the counterfactual regularization term is incorporated into the loss function to perform backpropagation. Finally, the causal invariant feature vector that is stripped of the coupling effect of environmental confounding variables is output, ensuring that the features learned by the model are cross-regional stable causal features, rather than false correlation features related to a specific environment.

[0059] In yet another preferred embodiment, please refer to the appendix. Figure 4For the parameter dynamic aggregation process of the central server, the central server receives the environmental covariate statistical moments uploaded by each edge node. The environmental covariate statistical moments include the mean temperature, the mean industrial wastewater ratio, and the mean domestic wastewater ratio. Specifically, during the local training period, each edge node calculates the first-order statistical moments, i.e. the mean, of the three types of environmental covariate data collected, namely influent temperature, industrial wastewater influent ratio, and domestic wastewater influent ratio, and generates an environmental covariate statistical moment vector of dimension [3]. This vector, along with the network's underlying shared parameters, is encrypted and uploaded to the central server. The central server concatenates the environmental covariate statistical moment vectors uploaded by all edge nodes to generate an environmental covariate statistical matrix of dimension [N,3], where N is the total number of edge nodes in the watershed.

[0060] The statistical moments of environmental covariates at each edge node are converted into discrete probability distribution vectors. For each column of data in the environmental covariate statistical matrix (i.e., the mean of all nodes for each type of environmental covariate), min-max normalization is performed to map the values ​​to the interval [0,1]. Then, the normalized three-dimensional vector corresponding to each node is normalized again, ensuring the sum of all elements in the vector is 1, thus obtaining the discrete probability distribution vector for each node. ,in Number the nodes, discrete probability distribution vector The dimension is [3], which is used to characterize the distribution characteristics of the environmental covariates of the node.

[0061] Construct a square matrix containing the number of all edge nodes as the transmission cost matrix. The elements of the transmission cost matrix are the Euclidean distance between any two discrete probability distribution vectors, and the corresponding expression is:

[0062] in, Transmission cost matrix Middle Line 1 The element of the column corresponds to the first... The node and the first The transmission cost between nodes For the first The discrete probability distribution vector of each node. For the first The discrete probability distribution vector of each node. This involves L2 norm operations. The transmission cost matrix. The dimension is [N,N]. The larger the value of the element in the matrix, the greater the difference in the distribution of environmental covariates between the two nodes.

[0063] Using the transmission cost matrix and discrete probability distribution vector as input, the Sinkhorn iterative algorithm is called to solve for the optimal transmission planning matrix. The expression corresponding to the update rule of the Sinkhorn iteration is:

[0064] in, and For the Sinkhorn iteration The dual variable of the wheel, and In this embodiment, the marginal probability vectors of the source and target distributions are given. and All are vectors of dimension [N] consisting of all 1s divided by N. It is the Gibbs kernel matrix. This is the regularization parameter, which is set to 0.1 in this embodiment. for The transpose of the matrix is ​​used, and division is performed element-wise. The Sinkhorn iteration terminates when the number of iterations reaches a preset maximum of 1000, or when the change in the dual variable is less than a preset threshold. After the iteration is complete, the optimal transport planning matrix T is calculated as follows: ,in This is an operation for generating diagonal matrices.

[0065] By filling the sum of the elements in each column of the optimal transport planning matrix into the corresponding positions, the Wasserstein matrix is ​​generated. The expression for the Wasserstein distance between two nodes is:

[0066] in, For the first The node and the first The Wasserstein distance between the nth nodes, i.e., the distance in the Wasserstein matrix at the nth node. Line 1 Column elements, This represents the element at the corresponding position in the optimal transmission planning matrix. This refers to the element at the corresponding position in the transmission cost matrix. The Wasserstein distance is used to quantify the degree of difference between the distributions of environmental covariates of two nodes. Compared with metrics such as KL divergence and JS divergence, the Wasserstein distance can still provide meaningful gradient information when the distributions do not overlap, making it suitable for the quantification scenario of cross-node environmental distribution differences in this embodiment.

[0067] Perform negative exponentiation on the column vectors corresponding to each edge node in the Wasserstein matrix, normalize the result to the interval [0,1], and generate the dynamic aggregation weights for each edge node. The corresponding expression is:

[0068] in, For the first The dynamic aggregate weights corresponding to each edge node. This represents the total number of edge nodes. For the first The node and the first Wasserstein distance between nodes For the first The average Wasserstein distance between each node and all other nodes. Using negative exponential calculation, nodes with smaller average Wasserstein distances—that is, nodes whose environmental distribution is closer to the average distribution across the entire watershed—have higher dynamic aggregation weights; conversely, nodes with larger average Wasserstein distances have lower dynamic aggregation weights. The sum of the dynamic aggregation weights of all nodes is 1, satisfying the weighting requirements for weighted average calculation.

[0069] The underlying shared parameters are weighted and summed based on the dynamic aggregation weights to update the global underlying shared parameters. The corresponding expression is:

[0070] in, For the updated global underlying shared parameters, For the first Dynamic aggregation weights of edge nodes For the first Local underlying shared parameters uploaded by each edge node This involves element-wise multiplication of parameters and weights. Through this weighted averaging, nodes whose environmental distribution is closer to the overall watershed have a greater impact of their local parameters on the global parameters; conversely, nodes with more diverse environmental distributions have a smaller impact of their local parameters on the global parameters. This avoids excessive influence of parameters coupled with mixed variables from different environments on the global parameters and prevents global parameter shifts. After updating the globally shared underlying parameters, the central server distributes these parameters to all edge nodes within the watershed via an encrypted communication link.

[0071] Each edge node uses the updated global bottom-level shared parameters and fine-tunes the personalized prediction parameters of the top layer of the network using local causal invariant feature vectors and local specific process labels. At each edge node, the global bottom-level shared parameters received from the central server are frozen, and the gradient backpropagation path of the causal invariant feature vector is locked. That is, during the backpropagation process of fine-tuning training, the gradient only propagates to the top layer of the network structure and does not propagate to the bottom-level shared parameters. The values ​​of the bottom-level shared parameters remain completely unchanged during the fine-tuning process, ensuring the stability of the global causal invariant features.

[0072] Please refer to the attached document. Figure 5 The local causal invariant feature vector is input into the personalized prediction parameters of the top layer of the network, which consists of a fully connected layer and an attention mechanism layer. The local causal invariant feature vector of dimension

[128] is input into the fully connected layer, which contains three linear mapping branches that map the vector dimension to a preset query matrix. Key matrix AND-value matrix In this embodiment, the dimension is... All dimensions are set to 64, therefore the output of the fully connected layer is... The matrix dimensions are all [1, 64]. The matrix dimension is [1, 64]. The query matrix and the transposed key matrix are multiplied to obtain the attention score matrix. The attention score matrix is ​​divided by the square root of the key matrix dimension and input into the Softmax classifier for normalization. The normalized attention score matrix is ​​multiplied by the value matrix to output the attention-weighted feature vector. The attention-weighted feature vector is added to the initial mapping vector output by the fully connected layer as a residual, and then input into the smooth L1 loss calculation process.

[0073] The dissolved oxygen variation sequence and sludge concentration variation sequence in the aeration tank contained in the local specific process label are used as monitoring signals. The smoothed L1 loss between the predicted sequence and the monitoring signal is calculated. The calculation rule for the smoothed L1 loss is: when the absolute error between the predicted value and the true value is less than 1, the loss value is 0.5 multiplied by the square of the error; when the absolute error is greater than or equal to 1, the loss value is the absolute error minus 0.5. In this embodiment, the model output is the predicted dissolved oxygen concentration sequence and the predicted activated sludge concentration sequence for the next 24 hours. The sequence length is 96, corresponding to a 15-minute sampling interval. The predicted sequence and the locally collected true monitoring signal sequence are input into the smoothed L1 loss function to calculate the loss value for fine-tuning training. Based on this loss value, only the weight parameters in the fully connected layer and the attention mechanism layer are updated with gradients, while the shared parameters at the bottom layer remain frozen. After completing a preset number of rounds of fine-tuning training, a collaborative prediction model adapted to the local wastewater treatment process is generated.

[0074] In this embodiment, the calculation results of the statistical moments of the environmental covariates and the dynamic aggregation weights of each edge node are shown in the table below: Table 4. Calculation results of statistical moments and dynamic aggregation weights of environmental covariates for each edge node.

[0075] This table is used to display the environmental covariate statistical moments, average Wasserstein distance, and final dynamic aggregation weights of each edge node in this embodiment. Through the quantitative calculation of Wasserstein distance, dynamic weight allocation based on environmental distribution differences is realized. The closer the environmental distribution of a node is to the whole watershed, the higher its corresponding dynamic aggregation weight. This ensures that the update of the global underlying shared parameters is consistent with the biochemical degradation mechanism characteristics common to the whole watershed and avoids interference from mixed variables from different environments.

[0076] In this embodiment, please refer to the appendix. Figure 6 By converting the statistical moments of environmental covariates into discrete probability distribution vectors, and combining the Sinkhorn iterative algorithm to solve for the optimal transport planning matrix, the Wasserstein matrix that quantifies the environmental distribution differences between nodes is calculated. Dynamic aggregation weights are generated based on the average Wasserstein distance to complete the weighted average update of the global bottom-level shared parameters. The global bottom-level shared parameters are frozen at the edge nodes. Through a top-level structure with an attention mechanism, fine-tuning training with smooth L1 loss is performed using local process labels as supervision signals. Only the top-level personalized prediction parameters are updated. While ensuring the stability of global causal features, the model is accurately adapted to local specific processes, and collaborative modeling of cross-regional wastewater data is completed.

Claims

1. A cross-regional wastewater data collaborative modeling method, characterized in that, include: The local water quality sequence of each edge node is obtained. The local water quality sequence includes the influent chemical oxygen demand concentration, ammonia nitrogen concentration, total phosphorus concentration, pH value, and instantaneous influent flow rate. The sampling interval of the local water quality sequence is uniformly set to 15 minutes. The time window length of a single sample is 7 consecutive days, the corresponding time step of a single sample is 672, and the tensor dimension of a single sample is [672,5], where 672 is the time step dimension and 5 is the water quality index dimension. The spatial topological adjacency relationship of each sewage treatment node in the same water system basin is encoded into a water system topological spatial feature matrix using a graph convolutional network. This includes: extracting the physical connection path of the pipeline network and the direction of water flow between upstream and downstream sewage treatment nodes in the same water system basin, and constructing a directed graph adjacency matrix. Obtain the geographic latitude and longitude coordinates and pipe diameter of each node in the directed graph adjacency matrix, calculate the spatial distance attenuation weight and pipe network flux weight between nodes, and multiply the spatial distance attenuation weight and the pipe network flux weight to obtain the composite edge weight matrix. The composite edge weight matrix and the directed graph adjacency matrix are multiplied by a Hadamard product to generate a weighted directed graph adjacency matrix. The weighted directed graph adjacency matrix is ​​input into a graph convolutional network to extract the spatial dependencies of the wastewater treatment nodes under the watershed topology and output the water system topology spatial feature matrix. Based on the local water quality sequence and the water system topology feature matrix, a time series prediction network with a causal intervention module is used for forward propagation. In the back propagation stage, a counterfactual regularization term is introduced to remove the coupling effect of environmental confounding variables such as temperature and the ratio of industrial and domestic sewage, and output a causal invariant feature vector. The network underlying shared parameters corresponding to the causal invariant feature vector are uploaded to the central server. The central server calculates the Wasserstein distance of the environmental covariate distribution of each node, assigns dynamic aggregation weights to the underlying shared parameters of each edge node based on the Wasserstein distance, and updates and distributes the global underlying shared parameters by weighted averaging. The globally shared parameters at each edge node are fixed and updated. The personalized prediction parameters at the top layer of the network are then fine-tuned using local causal invariant feature vectors and local specific process labels to generate a collaborative prediction model.

2. The method according to claim 1, characterized in that, The forward propagation of the time series prediction network with a causal intervention module and the introduction of a counterfactual regularization term in the back propagation stage include: connecting the causal intervention module after the feature extraction layer of the time series prediction network. The causal intervention module generates a random mask vector by sampling the environmental confounding variables using a Gaussian distribution based on the reparameterization technique. The random mask vector is multiplied element-wise with the input features to obtain the feature representation after intervention; Construct a counterfactual data generator to replace the environmental confounding variable values ​​in the post-intervention feature representation with preset baseline values ​​to generate counterfactual feature representations; The mean squared error between the post-intervention feature representation and the counterfactual feature representation in the feature space is calculated, and the mean squared error is incorporated into the loss function as the counterfactual regularization term for backpropagation.

3. The method according to claim 1, characterized in that, The central server calculates the Wasserstein distance of the distribution of environmental covariates of each node, and assigns dynamic aggregation weights to the underlying shared parameters of each edge node based on the Wasserstein distance. This includes: the central server receiving the environmental covariate statistical moments uploaded by each edge node, wherein the environmental covariate statistical moments include the mean temperature, the mean proportion of industrial wastewater, and the mean proportion of domestic wastewater. Based on the environmental covariate statistical moments, the Wasserstein matrix between any two edge nodes is calculated using the optimal transmission algorithm. The column vectors corresponding to each edge node in the Wasserstein matrix are subjected to negative exponent operation, and the operation result is normalized to the interval [0,1] to generate the dynamic aggregation weights corresponding to each edge node. The underlying shared parameters are weighted and summed based on the dynamic aggregation weights.

4. The method according to claim 1, characterized in that, The method of fine-tuning the personalized prediction parameters of the top layer of the network using local causal invariant feature vectors and local specific process labels includes: freezing the global bottom-level shared parameters received from the central server at each edge node and locking the gradient backpropagation path of the causal invariant feature vectors. The local causal invariant feature vector is input into the personalized prediction parameters of the top layer of the network, which consists of a fully connected layer and an attention mechanism layer. Using the dissolved oxygen variation sequence and sludge concentration variation sequence in the aeration tank contained in the local specific process label as monitoring signals, the smoothed L1 loss between the prediction sequence and the monitoring signals is calculated. Based on the smooth L1 loss, gradient updates are performed only on the weight parameters in the fully connected layer and the attention mechanism layer.

5. The method according to claim 2, characterized in that, The forward propagation based on the local water quality sequence and the water system topology feature matrix, through a time-series prediction network with a causal intervention module, includes: inputting the local water quality sequence into a long short-term memory network and extracting the hidden state vector in the time dimension; The hidden state vector and the water system topology feature matrix are concatenated along the channel dimension to generate a spatiotemporal fusion feature tensor. The spatiotemporal fusion feature tensor is input into the causal intervention module, and an independent random mask vector is applied to each channel of the spatiotemporal fusion feature tensor to obtain the post-intervention feature representation. The post-intervention feature representation is then flattened and linearly mapped sequentially to output the causal invariant feature vector.

6. The method according to claim 1, characterized in that, The calculation of spatial distance attenuation weight and pipeline flux weight between nodes includes: obtaining the geographical length of the pipeline network and pipeline flow monitoring data between each sewage treatment node; Substitute the geographic length into the Gaussian kernel function to calculate the spatial distance attenuation weight; Extract the maximum and minimum flow values ​​from the pipeline flow monitoring data, divide the difference between the current flow value and the minimum flow value by the difference between the maximum and minimum flow values, add a constant bias term to the division result, and generate the pipeline flow weight. The spatial distance attenuation weight and the pipeline flux weight are input into a multiplier to perform element-wise multiplication, and the composite edge weight matrix is ​​output.

7. The method according to claim 3, characterized in that, The step of calculating the Wasserstein matrix between any two edge nodes based on the environmental covariate statistical moments using the optimal transmission algorithm includes: converting the environmental covariate statistical moments of each edge node into a discrete probability distribution vector; Construct a square matrix containing the number of all edge nodes as the transmission cost matrix, where the elements of the transmission cost matrix are the Euclidean distance between any two discrete probability distribution vectors; Using the transmission cost matrix and the discrete probability distribution vector as input, the Sinkhorn iterative algorithm is called to solve for the optimal transmission planning matrix; The sum of the elements in each column of the optimal transmission planning matrix is ​​filled into the corresponding positions to generate the Wasserstein matrix.

8. The method according to claim 4, characterized in that, The step of inputting the local causal invariant feature vector into the personalized prediction parameters of the top layer of the network, which consists of a fully connected layer and an attention mechanism layer, includes: inputting the local causal invariant feature vector into the fully connected layer and mapping the vector dimension to the preset query matrix, key matrix and value matrix dimensions; Perform matrix multiplication on the query matrix and the transposed key matrix to obtain the attention score matrix; Divide the attention score matrix by the square root of the key matrix dimension and input it into the Softmax classifier to perform a normalization operation; Multiply the normalized attention score matrix by the value matrix to output the attention weighted feature vector; The attention-weighted feature vector is added to the initial mapping vector output by the fully connected layer as a residual, and then input into the smooth L1 loss calculation process.

9. A cross-regional wastewater data collaborative modeling system, characterized in that, A cross-regional wastewater data collaborative modeling method according to any one of claims 1-8 includes: a water system topology encoder, used to obtain the local water quality sequence of each edge node, and to encode the spatial topological adjacency relationship of each wastewater treatment node in the same water system basin into a water system topology spatial feature matrix using a graph convolutional network. A causal feature extractor is used to perform forward propagation through a time-series prediction network with a causal intervention module based on the local water quality sequence and the water system topology feature matrix. In the back propagation stage, a counterfactual regularization term is introduced to remove the coupling effect of environmental confounding variables such as temperature and the ratio of industrial and domestic sewage, and output a causal invariant feature vector. A dynamic weight aggregator is used to upload the network underlying shared parameters corresponding to the causal invariant feature vector to the central server. The central server calculates the Wasserstein distance of the distribution of environmental covariates of each node, assigns dynamic aggregation weights to the underlying shared parameters of each edge node according to the Wasserstein distance, and updates and distributes the global underlying shared parameters by weighted averaging. A personalized fine-tuner is used to fix the updated global bottom-level shared parameters at each edge node, and fine-tune the personalized prediction parameters of the top layer of the network using local causal invariant feature vectors and local specific process labels to generate a collaborative prediction model.

Citation Information

Patent Citations

  • Monitoring scarce point water quality prediction and early warning method based on liquid diagram neural network

    CN120355032A

  • Space-time joint modeling system and method for watershed water quality prediction

    CN120373544A