Sewage treatment effect prediction method and system based on deep learning

By improving the space-time attention graph convolution model and hunting optimization algorithm, the problems of poor prediction effects and unstable optimization effects of traditional sewage treatment effect prediction methods when processing complex data are solved, and more accurate sewage treatment effect prediction and more efficient optimization effects are achieved.

CN119416066BActive Publication Date: 2025-03-18福建漳发生态科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510018754.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-07
Publication Date
2025-03-18
Estimated Expiration
2045-01-07

AI Technical Summary

Technical Problem

Traditional sewage treatment effect prediction methods are difficult to effectively process large-scale, space-time and dynamically changing multi-dimensional sewage treatment data, and cannot dig deep connections between complex spatial relationships and time-series data, resulting in poor prediction results. At the same time, when optimizing model hyperparameters, there are problems such as slow convergence speed, easy to fall into local optimization and large dependence on initial parameters.

Method used

The improved spatiotemporal attention graph convolution model is used to predict sewage treatment effect, and the key timing features and complex spatial relationships in the timing data are extracted through the gated time convolution module, the graph convolution module, the fast attention module and the masked multi-head attention module, and the attention mechanism is used for fusion. At the same time, the model hyperparameters are optimized using hunting optimization algorithms to explore parameter space to accelerate convergence and avoid local optimal solutions.

Benefits of technology

It improves the accuracy of sewage treatment effect prediction, can extract key features and relationships in complex data more effectively, improves optimization effect, improves convergence speed and avoids local optimal solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119416066B_ABST
    Figure CN119416066B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for predicting the effect of sewage treatment based on deep learning, and the method includes data collection, data preprocessing, construction of a treatment effect prediction model, hyperparameter optimization and sewage treatment effect prediction. The present invention relates to the technical field of sewage treatment data prediction, and specifically refers to a method and system for predicting the effect of sewage treatment based on deep learning. The present invention obtains the original data of sewage treatment through data collection; adopts a data preprocessing method of data cleaning, data labeling, data encoding, data normalization and data set segmentation; adopts an improved spatiotemporal attention graph convolution model to predict the effect of sewage treatment, which can effectively extract key time series features in time series data and complex spatial relationships involved in the sewage treatment process; adopts a hunting optimization algorithm to optimize the model hyperparameters, which can conduct targeted exploration of the parameter space when processing sewage treatment data with multiple variables and complex spatiotemporal characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of sewage treatment data prediction, and specifically to a sewage treatment effect prediction method and system based on deep learning. Background Art

[0002] Sewage treatment effect prediction refers to the use of technologies such as data analysis and machine learning to predict the treatment effect of the sewage treatment system based on real-time and historical data in the sewage treatment process. Through accurate effect prediction, potential problems and risks can be identified in advance, the sewage treatment process can be optimized, and treatment efficiency can be improved.

[0003] However, traditional sewage treatment effect prediction methods have the technical problem of being unable to explore complex spatial relationships and deep connections between time series data when dealing with large-scale, spatiotemporally complex and dynamically changing multi-dimensional sewage treatment data, resulting in poor prediction results; traditional sewage treatment effect prediction methods have the technical problem of being unable to effectively identify the importance of key features in complex data in large-scale and high-dimensional complex models when optimizing model hyperparameters, resulting in unstable or inefficient optimization results, and there are technical problems such as slow convergence, easy to fall into local optimality and heavy dependence on initial parameters. Summary of the invention

[0004] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a sewage treatment effect prediction method and system based on deep learning. The traditional sewage treatment effect prediction method has the technical problem that when processing large-scale, spatiotemporally complex and dynamically changing multi-dimensional sewage treatment data, it is unable to mine complex spatial relationships and deep connections between time series data, resulting in poor prediction effect. This solution creatively adopts an improved spatiotemporal attention graph convolution model to predict sewage treatment effects, which can effectively extract key time series features in time series data and complex spatial relationships involved in the sewage treatment process, and adopts an attention mechanism to integrate them for more accurate prediction; when the traditional sewage treatment effect prediction method has the problem of optimizing model hyperparameters, it is difficult to effectively identify the importance of key features in complex data in large-scale and high-dimensional complex models, resulting in unstable or inefficient optimization effects, and there are technical problems such as slow convergence speed, easy to fall into local optimality and high dependence on initial parameters. This solution creatively adopts a hunting optimization algorithm to optimize model hyperparameters. When processing multivariate sewage treatment data with complex spatiotemporal characteristics, the parameter space is explored in a targeted manner, which can accelerate the convergence process and avoid falling into local optimal solutions.

[0005] The technical solution adopted by the present invention is as follows: The sewage treatment effect prediction method based on deep learning provided by the present invention comprises the following steps:

[0006] Step S1: data collection;

[0007] Step S2: data preprocessing;

[0008] Step S3: constructing a treatment effect prediction model;

[0009] Step S4: hyperparameter optimization;

[0010] Step S5: Prediction of sewage treatment effect.

[0011] Furthermore, in step S1, the data collection is used to collect the original data required for predicting the sewage treatment effect, specifically, to obtain the sewage treatment original data set from the sewage treatment monitoring system through data collection;

[0012] The sewage treatment original data set specifically includes a historical treatment data set and a current treatment data set. The historical treatment data set and the current treatment data set specifically include water quality parameters, sewage flow parameters, sewage treatment equipment operation status parameters, external environmental parameters and sludge treatment parameters. The water quality parameters specifically include sewage chemical oxygen demand, sewage biochemical oxygen demand, sewage pH value, sewage chemical element content and sewage turbidity parameters. The sewage treatment equipment operation status parameters specifically include aeration equipment operation parameters, pump station operation parameters, sedimentation tank operation parameters, biological pool operation parameters and equipment dosage. The external environmental parameters specifically include ambient temperature and ambient humidity. The sludge treatment parameters specifically include sludge generation, sludge concentration and sludge dewatering effect parameters.

[0013] Furthermore, in step S2, the data preprocessing is used to preprocess the collected raw data, and specifically includes the following steps:

[0014] Step S21: data cleaning, which is used to clean the original data, specifically to remove missing values ​​and duplicate values ​​in the historical processing data set and the current processing data set to obtain a historical preliminary data set and a current preliminary data set;

[0015] Step S22: data labeling, used to label the historical preliminary data, specifically labeling the data in the historical preliminary data set as unqualified, qualified, good and excellent, and using them as data labels to obtain a historical labeled data set;

[0016] Step S23: data encoding, which is used to encode the data, specifically, using a one-hot encoding method to encode the historical marked data set and the current preliminary data set to obtain a historical encoded data set and a current encoded data set;

[0017] Step S24: data normalization, which is used to normalize the coded data, specifically, using the minimum-maximum method to normalize the historical coded data set and the current coded data set to obtain a historical normalized data set and a data set to be predicted;

[0018] Step S25: data set segmentation, which is used to segment the data set, specifically segmenting the historical normalized data set to obtain an effect prediction training set and an effect prediction test set;

[0019] Step S26: preprocessing, specifically obtaining an effect prediction training set and an effect prediction test set through the data cleaning, data labeling, data encoding, data normalization and data set segmentation, and obtaining a data set to be predicted through the data cleaning, data encoding and data normalization.

[0020] Further, in step S3, the treatment effect prediction model is constructed to construct a model required for sewage treatment effect prediction, specifically to construct an improved spatiotemporal attention graph convolution model, and the improved spatiotemporal attention graph convolution model specifically includes a gated time convolution module, a graph convolution module, a fast attention module, a masked multi-head attention module, a fusion module and an output module;

[0021] The treatment effect prediction model is constructed, specifically comprising the following steps:

[0022] Step S31: constructing a gated time convolution module, wherein the gated time convolution module is used to perform a convolution operation on the input data and extract time-related features in the data. The steps of constructing the gated time convolution module include:

[0023] Step S311: constructing a temporal convolution submodule, specifically constructing two identical temporal convolution submodules using extended causal convolution operations, wherein the extended causal convolution operation uses the following formula:

[0024] ;

[0025] In the formula, represents the output of the temporal convolution submodule, represents the convolution kernel operation function, represents the input function of the temporal convolution submodule, t represents the time step, K represents the length of the convolution kernel, k represents the convolution kernel index, and d represents the delay step;

[0026] Step S312: Design a gating mechanism to add a gating mechanism to the time convolution submodule. The formula used is as follows:

[0027] ;

[0028] In the formula, represents the output of the gated temporal convolution module, represents the hyperbolic tangent function, represents the sigmoid activation function, represents the output of the first temporal convolution submodule, represents the output of the second temporal convolution submodule, Represents the output of the first time convolution submodule The weight matrix for linear transformation, Represents the output of the second temporal convolution submodule The weight matrix for linear transformation, Represents the output used to adjust the first temporal convolution submodule The bias term of the linear transformation, Represents the output used to adjust the second temporal convolution submodule The bias term of the linear transformation, Represents element-by-element multiplication operation;

[0029] Step S313: constructing a gated time convolution module, specifically, constructing a gated time convolution module by constructing the time convolution submodule and designing the gating mechanism, to obtain a gated time convolution module;

[0030] Step S32: constructing a graph convolution module, the graph convolution module is used to perform a graph convolution operation on the output of the gated time convolution module and extract spatial correlation features in the data. The steps of constructing the graph convolution module include:

[0031] Step S321: Calculate the adaptive adjacency matrix using the following formula:

[0032] ;

[0033] In the formula, represents the adaptive adjacency matrix, represents the softmax function, represents the ReLU activation function, is a randomly initialized learnable parameter representing the embedding vector of the source node, is a randomly initialized learnable parameter, represents the embedding vector of the target node, and T represents the transposition operation;

[0034] Step S322: Calculate the output of the graph convolution module. The formula used is as follows:

[0035] ;

[0036] In the formula, represents the output of the graph convolution module, L represents the total number of convolutional layers, represents the forward transfer matrix of the lth layer, represents the backward transfer matrix of the lth layer, represents the adaptive adjacency matrix of the lth layer, represents the forward transformation weight matrix of the lth layer, represents the weight matrix of the backward transformation of the lth layer, represents the transformation weight matrix of the lth layer based on the adjacency matrix, Represents the input of the graph convolution module;

[0037] Step S323: constructing a graph convolution module, specifically, constructing a graph convolution module by calculating the adaptive adjacency matrix and calculating the output of the graph convolution module to obtain a graph convolution module;

[0038] Step S33: constructing a fast attention module, the fast attention module is used to process the output of the gated temporal convolution module based on the fast attention mechanism, the steps of constructing the fast attention module include:

[0039] Step S331: Generate orthogonal random features, the steps include:

[0040] Step S3311: Generate random features using the following formula:

[0041] ;

[0042] In the formula, represents a random feature mapping function based on Gaussian distribution, represents the i-th feature of the input of the fast attention module, represents the jth feature of the input of the fast attention module, represents the query transformation weight matrix, represents the key transformation weight matrix, represents the i-th query vector, represents the j-th key vector;

[0043] Step S3312: orthogonalizing the random features, specifically using a Schmidt orthogonalization method to make the generated random features orthogonal to each other;

[0044] Step S332: construct an approximate similarity matrix, the formula used is as follows:

[0045] ;

[0046] In the formula, represents the approximate similarity matrix, represents the orthogonal random feature matrix calculation function, Qu represents the query matrix, Ke represents the key matrix, and dim represents the dimension of the orthogonal random feature;

[0047] Step S333, calculate the output of the fast attention module, the formula used is as follows:

[0048] ;

[0049] Where Va represents the value matrix, represents the input of the fast attention module, represents the value transformation weight matrix, represents the output of the fast attention module;

[0050] Step S334: constructing a fast attention module, specifically, constructing a fast attention module by generating orthogonal random features, constructing an approximate similarity matrix, and calculating the output of the fast attention module to obtain a fast attention module;

[0051] Step S34: constructing a masked multi-head attention module, wherein the masked multi-head attention module is used to process the output of the graph convolution module based on the masked multi-head attention mechanism. The steps of constructing the masked multi-head attention module include:

[0052] Step S341: Calculate the query, key and value of each header using the following formula:

[0053] ;

[0054] In the formula, represents the query of the a-th head of the masked multi-head attention module, represents the key for masking the a-th head of the multi-head attention module, represents the value of the a-th head of the masked multi-head attention module, represents the input of the masked multi-head attention module, represents the query transformation weight matrix of the a-th head of the masked multi-head attention module, represents the key transformation weight matrix of the a-th head of the masked multi-head attention module, Represents the value transformation weight matrix of the a-th head of the masked multi-head attention module;

[0055] Step S342: construct a masked attention score matrix using the following formula:

[0056] ;

[0057] Where Ma represents the masked attention score matrix, Mk represents the masking matrix, represents the element in row a and column b of the masked attention score matrix, represents the element in the ath row and bth column of the masking matrix, represents the key for masking the b-th head of the multi-head attention module, Represents the dimension of the key of the masked multi-head attention module;

[0058] Step S343: Calculate the output of the masked multi-head attention module. The formula used is as follows:

[0059] ;

[0060] In the formula, represents the output of the a-th head of the masked multi-head attention module, A represents the total number of heads, represents the value of the b-th head of the masked multi-head attention module, represents the output of the masked multi-head attention module, represents the concatenation function, represents the output of the first head of the masked multi-head attention module, represents the output of the second head of the masked multi-head attention module, represents the output of the Ath head of the masked multi-head attention module;

[0061] Step S344: constructing a masked multi-head attention module, specifically, constructing a masked multi-head attention module by calculating the query, key and value of each head, constructing a masked attention score matrix and calculating the output of the masked multi-head attention module to obtain a masked multi-head attention module;

[0062] Step S35: construct a fusion module for fusing the outputs of the fast attention module and the masked multi-head attention module to achieve the fusion of time-related features and space-related features. The formula used is as follows:

[0063] ;

[0064] In the formula, represents the query of the fusion module, represents the key of the fusion module, Represents the value of the fusion module, represents the query transformation weight matrix of the fusion module, represents the key transformation weight matrix of the fusion module, represents the value transformation weight matrix of the fusion module, represents the output of the fusion module, The dimension of the key representing the fusion module;

[0065] Step S36: construct an output module for calculating the model output, specifically using a softmax classifier as the output module, taking the output of the last hidden layer as the input of the output module, and calculating the output of the model. The hidden layer is specifically composed of the gated time convolution module, the graph convolution module, the fast attention module, the masked multi-head attention module and the fusion module. The hidden layer formula and the output module formula are expressed as follows:

[0066] ;

[0067] In the formula, represents the output of the qth hidden layer, represents the output of the q-1th hidden layer, Represents the fusion module operation function, represents the fast attention module operation function, represents the gated temporal convolution module operation function, represents the masked multi-head attention module operation function, Represents the graph convolution module operation function, represents the prediction results of the improved spatiotemporal attention graph convolution model, represents the output weights of the improved spatiotemporal attention graph convolution model, represents the output bias term of the improved spatiotemporal attention graph convolution model, represents the output of the Qth hidden layer, where Q represents the total number of hidden layers;

[0068] Step S37: construct and train the model, specifically, construct an improved spatiotemporal attention graph convolution model by constructing the gated temporal convolution module, constructing the graph convolution module, constructing the fast attention module, constructing the masked multi-head attention module, constructing the fusion module and constructing the output module, train the model based on the effect prediction training set, verify the model performance based on the effect prediction test set, select the cross entropy loss function as the model loss function, obtain the improved spatiotemporal attention graph convolution model, and use it as the processing effect prediction model.

[0069] Further, in step S4, the hyperparameter optimization is used to optimize the model hyperparameters of the treatment effect prediction model, specifically, using a hunting optimization algorithm to perform hyperparameter optimization on the treatment effect prediction model to obtain an optimized treatment effect prediction model;

[0070] The hyperparameter optimization specifically includes the following steps:

[0071] Step S41: Initialization, the steps include:

[0072] Step S411: Initialize the search space, specifically construct a hunter unit set and initialize the hunter unit position matrix. The hunter unit is used to represent the hyperparameter combination of the processing effect prediction model to be selected. The initial hunter unit position matrix is ​​expressed as follows:

[0073] ;

[0074] In the formula, represents the initial hunter unit position matrix, represents the position of the mth hunter unit in the nth dimension, represents the position of the Mth hunter unit in the Nth dimension, represents the position of the first hunter unit, represents the position of the second hunter unit, Represents the position of the Mth hunter unit, M represents the total number of hunter units, and N represents the total number of dimensions contained in the hunter unit;

[0075] Step S412: determining the iteration stop condition, specifically selecting reaching the maximum number of iterations and the fitness reaching a threshold as the iteration termination condition;

[0076] Step S413: determine the fitness, specifically, using the hyperparameter combination of the candidate treatment effect prediction model represented by the hunter unit, and obtaining the accuracy of the treatment effect prediction model as the fitness of the hunter unit. The fitness vector is expressed as follows:

[0077] ;

[0078] In the formula, F represents the fitness vector, represents the fitness of the first hunter unit, represents the fitness of the second hunter unit, represents the fitness of the Mth hunter unit, represents the model accuracy calculation function obtained based on the corresponding candidate treatment effect prediction model hyperparameter combination represented by the hunter unit;

[0079] Step S42: updating the location, the steps include:

[0080] Step S421: Calculate the hunting radius using the following formula:

[0081] ;

[0082] In the formula, R represents the hunting radius, lt represents the current number of iterations, represents the maximum number of iterations, Represents a random number in the range [0,1];

[0083] Step S422: Calculate hunting control parameters using the following formula:

[0084] ;

[0085] In the formula, represents the hunting control parameters, represents a hyperbolic function, represents the fitness of the mth hunter unit, Represents the fitness of the global best position;

[0086] Step S423: Calculate the hunger degree change parameter, using the following formula:

[0087] ;

[0088] In the formula, represents the hunger degree change parameter, Hc represents the hunger degree change control parameter, Represents a random number in the range [0,1]. Represents a random number in the range [0,1]. Represents the fitness of the global worst position, UB represents the upper limit of the search space, and LB represents the lower limit of the search space;

[0089] Step S424: Update the hunger level, the formula used is as follows:

[0090] ;

[0091] In the formula, Represents the updated hunger level of the mth hunter unit, Indicates the hunger degree of the mth hunter unit before the update;

[0092] Step S425: Update the hunger weight, the formula used is as follows:

[0093] ;

[0094] In the formula, represents the optimal hunger weight of the mth hunter unit, represents the relative hunger weight of the mth hunter unit, Represents the updated sum of hunger of all hunter units. Represents a random number in the range [0,1]. Represents a random number in the range [0,1]. represents a random number in the range [0,1], Ch represents the cooperative hunting threshold;

[0095] Step S426: The hunter unit position is updated, and the formula used is as follows:

[0096] ;

[0097] In the formula, represents the position of the mth hunter unit at the lt+1th iteration, represents the position of the mth hunter unit at the ltth iteration, Rn represents a random number that conforms to the normal distribution in the range [0,1], Represents a random number in the range [0,1]. represents the global optimal position at the ltth iteration, Represents a random number in the range [0,1];

[0098] Step S43: updating the global optimal position, specifically selecting the position of the hunter unit with the best fitness as the global optimal position;

[0099] Step S44: iterative updating, specifically, continuously iteratively updating until the iteration stop condition is reached;

[0100] Step S45: performing hyperparameter optimization, specifically, optimizing the hyperparameters of the processing effect prediction model through the initialization, the update position, the global optimal position update and the iterative update to obtain an optimized processing effect prediction model.

[0101] Furthermore, in step S5, the sewage treatment effect prediction is specifically to use the data set to be predicted as the input of the optimized treatment effect prediction model to predict the sewage treatment effect, obtain sewage treatment effect level reference data, and based on the sewage treatment effect level reference data, comprehensively consider and estimate the sewage treatment effect.

[0102] The sewage treatment effect prediction system based on deep learning provided by the present invention includes a data acquisition module, a data preprocessing module, a treatment effect prediction model construction module, a hyperparameter optimization module and a sewage treatment effect prediction module;

[0103] The data acquisition module is used for data acquisition, and obtains the original sewage treatment data set through data acquisition, and sends the original sewage treatment data set to the data preprocessing module;

[0104] The data preprocessing module is used for data preprocessing, and obtains a data set to be predicted, an effect prediction training set and an effect prediction test set through data preprocessing, and sends the data set to be predicted to the sewage treatment effect prediction module, and sends the effect prediction training set and the effect prediction test set to the treatment effect prediction model construction module;

[0105] The processing effect prediction model construction module is used to construct a processing effect prediction model, obtain the processing effect prediction model by constructing an improved spatiotemporal attention graph convolution model, and send the processing effect prediction model to the hyperparameter optimization module;

[0106] The hyperparameter optimization module is used to perform hyperparameter optimization, and obtain an optimized treatment effect prediction model by using a hunting optimization algorithm to perform hyperparameter optimization, and send the optimized treatment effect prediction model to the sewage treatment effect prediction module;

[0107] The sewage treatment effect prediction module is used for sewage treatment effect prediction. It predicts the sewage treatment effect by using an optimized treatment effect prediction model to obtain sewage treatment effect grade reference data.

[0108] The beneficial effects achieved by the present invention using the above scheme are as follows:

[0109] (1) Traditional sewage treatment effect prediction methods have the technical problem of being unable to explore complex spatial relationships and deep connections between time series data when dealing with large-scale, spatiotemporally complex and dynamically changing multi-dimensional sewage treatment data, resulting in poor prediction results. This scheme creatively adopts an improved spatiotemporal attention graph convolution model to predict sewage treatment effects. It can effectively extract the key time series features in the time series data and the complex spatial relationships involved in the sewage treatment process, and use the attention mechanism to integrate them for more accurate predictions.

[0110] (2) When optimizing model hyperparameters, traditional sewage treatment effect prediction methods are difficult to effectively identify the importance of key features in complex data in large-scale and high-dimensional complex models, resulting in unstable or inefficient optimization effects. In addition, there are technical problems such as slow convergence, easy to fall into local optimal solutions, and high dependence on initial parameters. This solution creatively uses a hunting optimization algorithm to optimize model hyperparameters. When processing sewage treatment data with multivariate and complex spatiotemporal characteristics, it conducts targeted exploration of the parameter space, which can accelerate the convergence process and avoid falling into local optimal solutions. BRIEF DESCRIPTION OF THE DRAWINGS

[0111] Figure 1 A schematic diagram of the process of the sewage treatment effect prediction method based on deep learning provided by the present invention;

[0112] Figure 2 A schematic diagram of a module of a sewage treatment effect prediction system based on deep learning provided by the present invention;

[0113] Figure 3 This is a schematic diagram of the process of data preprocessing in step S2;

[0114] Figure 4A schematic diagram of the process of constructing a treatment effect prediction model in step S3;

[0115] Figure 5 Schematic diagram of the process of hyperparameter optimization in step S4.

[0116] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION

[0117] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0118] In the description of the present invention, it should be understood that terms such as “upper”, “lower”, “front”, “back”, “left”, “right”, “top”, “bottom”, “inside” and “outside” indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as limiting the present invention.

[0119] Example 1, see Figure 1 The technical solution adopted by the present invention is as follows: The sewage treatment effect prediction method based on deep learning provided by the present invention comprises the following steps:

[0120] Step S1: data collection;

[0121] Step S2: data preprocessing;

[0122] Step S3: constructing a treatment effect prediction model;

[0123] Step S4: hyperparameter optimization;

[0124] Step S5: Prediction of sewage treatment effect.

[0125] Example 2, see Figure 1 and Figure 2 In step S1, the data collection is used to collect the original data required for predicting the sewage treatment effect, specifically, to obtain the original sewage treatment data set from the sewage treatment monitoring system through data collection;

[0126] The sewage treatment original data set specifically includes a historical treatment data set and a current treatment data set. The historical treatment data set and the current treatment data set specifically include water quality parameters, sewage flow parameters, sewage treatment equipment operation status parameters, external environmental parameters and sludge treatment parameters. The water quality parameters specifically include sewage chemical oxygen demand, sewage biochemical oxygen demand, sewage pH value, sewage chemical element content and sewage turbidity parameters. The sewage treatment equipment operation status parameters specifically include aeration equipment operation parameters, pump station operation parameters, sedimentation tank operation parameters, biological pool operation parameters and equipment dosage. The external environmental parameters specifically include ambient temperature and ambient humidity. The sludge treatment parameters specifically include sludge generation, sludge concentration and sludge dewatering effect parameters.

[0127] Example 3, see Figure 1 , Figure 2 and Figure 3 This embodiment is based on the above embodiment. In step S2, the data preprocessing is used to preprocess the collected raw data, and specifically includes the following steps:

[0128] Step S21: data cleaning, which is used to clean the original data, specifically to remove missing values ​​and duplicate values ​​in the historical processing data set and the current processing data set to obtain a historical preliminary data set and a current preliminary data set;

[0129] Step S22: data labeling, used to label the historical preliminary data, specifically labeling the data in the historical preliminary data set as unqualified, qualified, good and excellent, and using them as data labels to obtain a historical labeled data set;

[0130] Step S23: data encoding, which is used to encode the data, specifically, using a one-hot encoding method to encode the historical marked data set and the current preliminary data set to obtain a historical encoded data set and a current encoded data set;

[0131] Step S24: data normalization, which is used to normalize the coded data, specifically, using the minimum-maximum method to normalize the historical coded data set and the current coded data set to obtain a historical normalized data set and a data set to be predicted;

[0132] Step S25: data set segmentation, which is used to segment the data set, specifically segmenting the historical normalized data set to obtain an effect prediction training set and an effect prediction test set;

[0133] Step S26: preprocessing, specifically obtaining an effect prediction training set and an effect prediction test set through the data cleaning, data labeling, data encoding, data normalization and data set segmentation, and obtaining a data set to be predicted through the data cleaning, data encoding and data normalization.

[0134] Example 4, see Figure 1 , Figure 2 and Figure 4 , This embodiment is based on the above embodiment. In step S3, the treatment effect prediction model is constructed to construct a model required for sewage treatment effect prediction, specifically to construct an improved spatiotemporal attention graph convolution model. The improved spatiotemporal attention graph convolution model specifically includes a gated time convolution module, a graph convolution module, a fast attention module, a masked multi-head attention module, a fusion module and an output module;

[0135] The treatment effect prediction model is constructed, specifically comprising the following steps:

[0136] Step S31: constructing a gated time convolution module, wherein the gated time convolution module is used to perform a convolution operation on the input data and extract time-related features in the data. The steps of constructing the gated time convolution module include:

[0137] Step S311: constructing a temporal convolution submodule, specifically constructing two identical temporal convolution submodules using extended causal convolution operations, wherein the extended causal convolution operation uses the following formula:

[0138] ;

[0139] In the formula, represents the output of the temporal convolution submodule, represents the convolution kernel operation function, represents the input function of the temporal convolution submodule, t represents the time step, K represents the length of the convolution kernel, k represents the convolution kernel index, and d represents the delay step;

[0140] Step S312: Design a gating mechanism to add a gating mechanism to the time convolution submodule. The formula used is as follows:

[0141] ;

[0142] In the formula, represents the output of the gated temporal convolution module, represents the hyperbolic tangent function, represents the sigmoid activation function, represents the output of the first temporal convolution submodule, represents the output of the second temporal convolution submodule, Represents the output of the first time convolution submodule The weight matrix for linear transformation, Represents the output of the second temporal convolution submodule The weight matrix for linear transformation, Represents the output used to adjust the first temporal convolution submodule The bias term of the linear transformation, Represents the output used to adjust the second temporal convolution submodule The bias term of the linear transformation, Represents element-by-element multiplication operation;

[0143] Step S313: constructing a gated time convolution module, specifically, constructing a gated time convolution module by constructing the time convolution submodule and designing the gating mechanism, to obtain a gated time convolution module;

[0144] Step S32: constructing a graph convolution module, wherein the graph convolution module is used to perform a graph convolution operation on the output of the gated time convolution module and extract spatially related features in the data. The steps of constructing the graph convolution module include:

[0145] Step S321: Calculate the adaptive adjacency matrix using the following formula:

[0146] ;

[0147] In the formula, represents the adaptive adjacency matrix, represents the softmax function, represents the ReLU activation function, is a randomly initialized learnable parameter representing the embedding vector of the source node, is a randomly initialized learnable parameter, represents the embedding vector of the target node, and T represents the transposition operation;

[0148] Step S322: Calculate the output of the graph convolution module. The formula used is as follows:

[0149] ;

[0150] In the formula, represents the output of the graph convolution module, L represents the total number of convolutional layers, represents the forward transfer matrix of the lth layer, represents the backward transfer matrix of the lth layer, represents the adaptive adjacency matrix of the lth layer, represents the forward transformation weight matrix of the lth layer, represents the weight matrix of the backward transformation of the lth layer, represents the transformation weight matrix of the lth layer based on the adjacency matrix, Represents the input of the graph convolution module;

[0151] Step S323: constructing a graph convolution module, specifically, constructing a graph convolution module by calculating the adaptive adjacency matrix and calculating the output of the graph convolution module to obtain a graph convolution module;

[0152] Step S33: constructing a fast attention module, the fast attention module is used to process the output of the gated temporal convolution module based on the fast attention mechanism, the steps of constructing the fast attention module include:

[0153] Step S331: Generate orthogonal random features, the steps include:

[0154] Step S3311: Generate random features using the following formula:

[0155] ;

[0156] In the formula, represents a random feature mapping function based on Gaussian distribution, represents the i-th feature of the input of the fast attention module, represents the jth feature of the input of the fast attention module, represents the query transformation weight matrix, represents the key transformation weight matrix, represents the i-th query vector, represents the j-th key vector;

[0157] Step S3312: orthogonalizing the random features, specifically using a Schmidt orthogonalization method to make the generated random features orthogonal to each other;

[0158] Step S332: construct an approximate similarity matrix, the formula used is as follows:

[0159] ;

[0160] In the formula, represents the approximate similarity matrix, represents the orthogonal random feature matrix calculation function, Qu represents the query matrix, Ke represents the key matrix, and dim represents the dimension of the orthogonal random feature;

[0161] Step S333, calculate the output of the fast attention module, the formula used is as follows:

[0162] ;

[0163] Where Va represents the value matrix, represents the input of the fast attention module, represents the value transformation weight matrix, represents the output of the fast attention module;

[0164] Step S334: constructing a fast attention module, specifically, constructing a fast attention module by generating orthogonal random features, constructing an approximate similarity matrix, and calculating the output of the fast attention module to obtain a fast attention module;

[0165] Step S34: constructing a masked multi-head attention module, wherein the masked multi-head attention module is used to process the output of the graph convolution module based on the masked multi-head attention mechanism. The steps of constructing the masked multi-head attention module include:

[0166] Step S341: Calculate the query, key and value of each header using the following formula:

[0167] ;

[0168] In the formula, represents the query of the a-th head of the masked multi-head attention module, represents the key for masking the a-th head of the multi-head attention module, represents the value of the a-th head of the masked multi-head attention module, represents the input of the masked multi-head attention module, represents the query transformation weight matrix of the a-th head of the masked multi-head attention module, represents the key transformation weight matrix of the a-th head of the masked multi-head attention module, Represents the value transformation weight matrix of the a-th head of the masked multi-head attention module;

[0169] Step S342: construct a masked attention score matrix using the following formula:

[0170] ;

[0171] Where Ma represents the masked attention score matrix, Mk represents the masking matrix, represents the element in row a and column b of the masked attention score matrix, represents the element in the ath row and bth column of the masking matrix, represents the key for masking the b-th head of the multi-head attention module, Represents the dimension of the key of the masked multi-head attention module;

[0172] Step S343: Calculate the output of the masked multi-head attention module. The formula used is as follows:

[0173] ;

[0174] In the formula, represents the output of the a-th head of the masked multi-head attention module, A represents the total number of heads, represents the value of the b-th head of the masked multi-head attention module, represents the output of the masked multi-head attention module, represents the concatenation function, represents the output of the first head of the masked multi-head attention module, represents the output of the second head of the masked multi-head attention module, represents the output of the Ath head of the masked multi-head attention module;

[0175] Step S344: constructing a masked multi-head attention module, specifically, constructing a masked multi-head attention module by calculating the query, key and value of each head, constructing a masked attention score matrix and calculating the output of the masked multi-head attention module to obtain a masked multi-head attention module;

[0176] Step S35: construct a fusion module for fusing the outputs of the fast attention module and the masked multi-head attention module to achieve the fusion of time-related features and space-related features. The formula used is as follows:

[0177] ;

[0178] In the formula, represents the query of the fusion module, represents the key of the fusion module, Represents the value of the fusion module, represents the query transformation weight matrix of the fusion module, represents the key transformation weight matrix of the fusion module, represents the value transformation weight matrix of the fusion module, represents the output of the fusion module, The dimension of the key representing the fusion module;

[0179] Step S36: construct an output module for calculating the model output, specifically using a softmax classifier as the output module, taking the output of the last hidden layer as the input of the output module, and calculating the output of the model. The hidden layer is specifically composed of the gated time convolution module, the graph convolution module, the fast attention module, the masked multi-head attention module and the fusion module. The hidden layer formula and the output module formula are expressed as follows:

[0180] ;

[0181] In the formula, represents the output of the qth hidden layer, represents the output of the q-1th hidden layer, Represents the fusion module operation function, represents the fast attention module operation function, represents the gated temporal convolution module operation function, represents the masked multi-head attention module operation function, Represents the graph convolution module operation function, represents the prediction results of the improved spatiotemporal attention graph convolution model, represents the output weights of the improved spatiotemporal attention graph convolution model, represents the output bias term of the improved spatiotemporal attention graph convolution model, represents the output of the Qth hidden layer, where Q represents the total number of hidden layers;

[0182] Step S37: construct and train the model, specifically, construct an improved spatiotemporal attention graph convolution model by constructing the gated temporal convolution module, constructing the graph convolution module, constructing the fast attention module, constructing the masked multi-head attention module, constructing the fusion module and constructing the output module, train the model based on the effect prediction training set, verify the model performance based on the effect prediction test set, select the cross entropy loss function as the model loss function, obtain the improved spatiotemporal attention graph convolution model, and use it as the processing effect prediction model.

[0183] By performing the above operations, the traditional sewage treatment effect prediction method has the technical problem of being unable to explore the complex spatial relationships and deep connections between time series data when dealing with large-scale, spatiotemporally complex and dynamically changing multi-dimensional sewage treatment data, resulting in poor prediction results. This scheme creatively adopts an improved spatiotemporal attention graph convolution model to predict sewage treatment effects. It can effectively extract the key time series features in the time series data and the complex spatial relationships involved in the sewage treatment process, and use the attention mechanism to integrate them for more accurate predictions.

[0184] Example 5, see Figure 1 , Figure 2 and Figure 5 This embodiment is based on the above embodiment. In step S4, the hyperparameter optimization is used to optimize the model hyperparameters of the processing effect prediction model. Specifically, the hunting optimization algorithm is used to optimize the hyperparameters of the processing effect prediction model to obtain the optimized processing effect prediction model. The model hyperparameters specifically include the number of graph convolution layers, node feature dimensions, convolution kernel size of the time convolution submodule, gating mechanism parameters, the number of orthogonal random features, the dimension of random feature mapping, the number of attention heads, the threshold of the masking mechanism, the learning rate and the batch size;

[0185] The hyperparameter optimization specifically includes the following steps:

[0186] Step S41: Initialization, the steps include:

[0187] Step S411: Initialize the search space, specifically construct a hunter unit set and initialize the hunter unit position matrix. The hunter unit is used to represent the hyperparameter combination of the processing effect prediction model to be selected. The initial hunter unit position matrix is ​​expressed as follows:

[0188] ;

[0189] In the formula, represents the initial hunter unit position matrix, represents the position of the mth hunter unit in the nth dimension, represents the position of the Mth hunter unit in the Nth dimension, represents the position of the first hunter unit, represents the position of the second hunter unit, Represents the position of the Mth hunter unit, M represents the total number of hunter units, and N represents the total number of dimensions contained in the hunter unit;

[0190] Step S412: determining the iteration stop condition, specifically selecting reaching the maximum number of iterations and the fitness reaching a threshold as the iteration termination condition;

[0191] Step S413: determine the fitness, specifically, using the hyperparameter combination of the candidate treatment effect prediction model represented by the hunter unit, and obtaining the accuracy of the treatment effect prediction model as the fitness of the hunter unit. The fitness vector is expressed as follows:

[0192] ;

[0193] In the formula, F represents the fitness vector, represents the fitness of the first hunter unit, represents the fitness of the second hunter unit, represents the fitness of the Mth hunter unit, represents the model accuracy calculation function obtained based on the corresponding candidate treatment effect prediction model hyperparameter combination represented by the hunter unit;

[0194] Step S42: updating the location, the steps include:

[0195] Step S421: Calculate the hunting radius using the following formula:

[0196] ;

[0197] In the formula, R represents the hunting radius, lt represents the current number of iterations, represents the maximum number of iterations, Represents a random number in the range [0,1];

[0198] Step S422: Calculate hunting control parameters using the following formula:

[0199] ;

[0200] In the formula, represents the hunting control parameters, represents a hyperbolic function, represents the fitness of the mth hunter unit, Represents the fitness of the global best position;

[0201] Step S423: Calculate the hunger degree change parameter, using the following formula:

[0202] ;

[0203] In the formula, represents the hunger degree change parameter, Hc represents the hunger degree change control parameter, Represents a random number in the range [0,1]. Represents a random number in the range [0,1]. Represents the fitness of the global worst position, UB represents the upper limit of the search space, and LB represents the lower limit of the search space;

[0204] Step S424: Update the hunger level, the formula used is as follows:

[0205] ;

[0206] In the formula, Represents the updated hunger level of the mth hunter unit, Indicates the hunger degree of the mth hunter unit before the update;

[0207] Step S425: Update the hunger weight, the formula used is as follows:

[0208] ;

[0209] In the formula, represents the optimal hunger weight of the mth hunter unit, represents the relative hunger weight of the mth hunter unit, Represents the updated sum of hunger of all hunter units. Represents a random number in the range [0,1]. Represents a random number in the range [0,1]. represents a random number in the range [0,1], Ch represents the cooperative hunting threshold;

[0210] Step S426: The hunter unit position is updated, and the formula used is as follows:

[0211] ;

[0212] In the formula, represents the position of the mth hunter unit at the lt+1th iteration, represents the position of the mth hunter unit at the ltth iteration, Rn represents a random number that conforms to the normal distribution in the range [0,1], Represents a random number in the range [0,1]. represents the global optimal position at the ltth iteration, Represents a random number in the range [0,1];

[0213] Step S43: updating the global optimal position, specifically selecting the position of the hunter unit with the best fitness as the global optimal position;

[0214] Step S44: iterative updating, specifically, continuously iteratively updating until the iteration stop condition is reached;

[0215] Step S45: performing hyperparameter optimization, specifically, optimizing the hyperparameters of the processing effect prediction model through the initialization, the update position, the global optimal position update and the iterative update to obtain an optimized processing effect prediction model.

[0216] By performing the above operations, for the traditional sewage treatment effect prediction method, when there are optimization model hyperparameters, it is difficult to effectively identify the importance of key features in complex data in large-scale and high-dimensional complex models, resulting in unstable or inefficient optimization effects, and there are technical problems such as slow convergence speed, easy to fall into local optimality and high dependence on initial parameters. This solution creatively uses the hunting optimization algorithm to optimize the model hyperparameters. When processing sewage treatment data with multivariate and complex spatiotemporal characteristics, it conducts targeted exploration of the parameter space, which can accelerate the convergence process and avoid falling into local optimal solutions.

[0217] Example 6, see Figure 1 and Figure 2 This embodiment is based on the above embodiment. In step S5, the sewage treatment effect prediction is specifically to use the data set to be predicted as the input of the optimized treatment effect prediction model to predict the sewage treatment effect, obtain sewage treatment effect level reference data, and based on the sewage treatment effect level reference data, comprehensively consider and estimate the sewage treatment effect.

[0218] Embodiment 7, see Figure 1 and Figure 2 , this embodiment is based on the above embodiment, and the sewage treatment effect prediction system based on deep learning provided by the present invention includes a data acquisition module, a data preprocessing module, a treatment effect prediction model construction module, a hyperparameter optimization module and a sewage treatment effect prediction module;

[0219] The data acquisition module is used for data acquisition, and obtains the original sewage treatment data set through data acquisition, and sends the original sewage treatment data set to the data preprocessing module;

[0220] The data preprocessing module is used for data preprocessing, and obtains a data set to be predicted, an effect prediction training set and an effect prediction test set through data preprocessing, and sends the data set to be predicted to the sewage treatment effect prediction module, and sends the effect prediction training set and the effect prediction test set to the treatment effect prediction model construction module;

[0221] The processing effect prediction model construction module is used to construct a processing effect prediction model, obtain the processing effect prediction model by constructing an improved spatiotemporal attention graph convolution model, and send the processing effect prediction model to the hyperparameter optimization module;

[0222] The hyperparameter optimization module is used to perform hyperparameter optimization, and obtain an optimized treatment effect prediction model by using a hunting optimization algorithm to perform hyperparameter optimization, and send the optimized treatment effect prediction model to the sewage treatment effect prediction module;

[0223] The sewage treatment effect prediction module is used for sewage treatment effect prediction. It predicts the sewage treatment effect by using an optimized treatment effect prediction model to obtain sewage treatment effect grade reference data.

[0224] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0225] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.

[0226] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.

Claims

1. A sewage treatment effect prediction method based on deep learning, characterized by: The method comprises the following steps: Step S1: data collection, through which an original sewage treatment data set is obtained, wherein the original sewage treatment data set specifically includes a historical treatment data set and a current treatment data set; Step S2: Data preprocessing, preprocessing the collected original sewage treatment data to obtain a data set to be predicted, an effect prediction training set, and an effect prediction test set; Step S3: constructing a processing effect prediction model, specifically constructing an improved spatiotemporal attention graph convolution model to obtain a processing effect prediction model; Step S4: hyperparameter optimization, specifically using a hunting optimization algorithm to optimize the hyperparameters to obtain an optimized processing effect prediction model; Step S5: predicting the sewage treatment effect, specifically using the optimized treatment effect prediction model to predict the sewage treatment effect and obtain reference data of the sewage treatment effect level; In step S3, the treatment effect prediction model is constructed to construct the model required for sewage treatment effect prediction, specifically to construct an improved spatiotemporal attention graph convolution model, and the improved spatiotemporal attention graph convolution model specifically includes a gated time convolution module, a graph convolution module, a fast attention module, a masked multi-head attention module, a fusion module and an output module; The masked multi-head attention module is used to process the output of the graph convolution module based on the masked multi-head attention mechanism, and construct the masked multi-head attention module, the steps comprising: Step S341: Calculate the query, key and value of each header using the following formula: ; In the formula, represents the query of the a-th head of the masked multi-head attention module, represents the key for masking the a-th head of the multi-head attention module, represents the value of the a-th head of the masked multi-head attention module, represents the input of the masked multi-head attention module, represents the query transformation weight matrix of the a-th head of the masked multi-head attention module, represents the key transformation weight matrix of the a-th head of the masked multi-head attention module, Represents the value transformation weight matrix of the a-th head of the masked multi-head attention module; Step S342: construct a masked attention score matrix using the following formula: ; Where Ma represents the masked attention score matrix, Mk represents the masking matrix, represents the element in row a and column b of the masked attention score matrix, represents the element in the ath row and bth column of the masking matrix, represents the key for masking the b-th head of the multi-head attention module, Represents the dimension of the key of the masked multi-head attention module; Step S343: Calculate the output of the masked multi-head attention module. The formula used is as follows: ; In the formula, represents the output of the a-th head of the masked multi-head attention module, A represents the total number of heads, represents the value of the b-th head of the masked multi-head attention module, represents the output of the masked multi-head attention module, represents the concatenation function, represents the output of the first head of the masked multi-head attention module, represents the output of the second head of the masked multi-head attention module, represents the output of the Ath head of the masked multi-head attention module; Step S344: constructing a masked multi-head attention module, specifically by calculating the query, key and value of each head, constructing the masked attention score matrix and calculating the output of the masked multi-head attention module, to obtain a masked multi-head attention module.

2. The method for predicting sewage treatment effect based on deep learning according to claim 1, characterized in that: The treatment effect prediction model is constructed, specifically comprising the following steps: Step S31: constructing a gated time convolution module, wherein the gated time convolution module is used to perform a convolution operation on the input data and extract time-related features in the data. The steps of constructing the gated time convolution module include: Step S311: constructing a temporal convolution submodule, specifically constructing two identical temporal convolution submodules using extended causal convolution operations, wherein the extended causal convolution operation uses the following formula: ; In the formula, represents the output of the temporal convolution submodule, represents the convolution kernel operation function, represents the input function of the temporal convolution submodule, t represents the time step, K represents the length of the convolution kernel, k represents the convolution kernel index, and d represents the delay step; Step S312: Design a gating mechanism to add a gating mechanism to the time convolution submodule. The formula used is as follows: ; In the formula, represents the output of the gated temporal convolution module, represents the hyperbolic tangent function, represents the sigmoid activation function, represents the output of the first temporal convolution submodule, represents the output of the second temporal convolution submodule, Represents the output of the first time convolution submodule The weight matrix for linear transformation, Represents the output of the second temporal convolution submodule The weight matrix for linear transformation, Represents the output used to adjust the first temporal convolution submodule The bias term of the linear transformation, Represents the output used to adjust the second temporal convolution submodule The bias term of the linear transformation, Represents element-by-element multiplication operation; Step S313: constructing a gated time convolution module, specifically, constructing a gated time convolution module by constructing the time convolution submodule and designing the gating mechanism, to obtain a gated time convolution module; Step S32: constructing a graph convolution module, the graph convolution module is used to perform a graph convolution operation on the output of the gated time convolution module and extract spatial correlation features in the data. The steps of constructing the graph convolution module include: Step S321: Calculate the adaptive adjacency matrix using the following formula: ; In the formula, represents the adaptive adjacency matrix, represents the softmax function, represents the ReLU activation function, represents the randomly initialized learnable parameters of the source node embedding vector, represents the randomly initialized learnable parameters of the target node embedding vector, and T represents the transposition operation; Step S322: Calculate the output of the graph convolution module. The formula used is as follows: ; In the formula, represents the output of the graph convolution module, L represents the total number of convolutional layers, represents the forward transfer matrix of the lth layer, represents the backward transfer matrix of the lth layer, represents the adaptive adjacency matrix of the lth layer, represents the weight matrix of the forward transformation of the lth layer, represents the weight matrix of the backward transformation of the lth layer, represents the transformation weight matrix of the lth layer based on the adjacency matrix, Represents the input of the graph convolution module; Step S323: constructing a graph convolution module, specifically, constructing a graph convolution module by calculating the adaptive adjacency matrix and calculating the output of the graph convolution module to obtain a graph convolution module; Step S33: constructing a fast attention module, the fast attention module is used to process the output of the gated temporal convolution module based on the fast attention mechanism, the steps of constructing the fast attention module include: Step S331: Generate orthogonal random features, the steps include: Step S3311: Generate random features using the following formula: ; In the formula, represents a random feature mapping function based on Gaussian distribution, represents the i-th feature of the input of the fast attention module, represents the jth feature of the input of the fast attention module, represents the query transformation weight matrix, represents the key transformation weight matrix, represents the i-th query vector, represents the j-th key vector; Step S3312: orthogonalizing the random features, specifically using the Schmidt orthogonalization method to make the generated random features orthogonal to each other; Step S332: construct an approximate similarity matrix, the formula used is as follows: ; In the formula, represents the approximate similarity matrix, represents the orthogonal random feature matrix calculation function, Qu represents the query matrix, Ke represents the key matrix, and dim represents the dimension of the orthogonal random feature; Step S333, calculate the output of the fast attention module, the formula used is as follows: ; Where Va represents the value matrix, represents the input of the fast attention module, represents the value transformation weight matrix, represents the output of the fast attention module; Step S334: constructing a fast attention module, specifically, constructing a fast attention module by generating orthogonal random features, constructing an approximate similarity matrix, and calculating the output of the fast attention module to obtain a fast attention module; Step S34: construct a masked multi-head attention module; Step S35: construct a fusion module for fusing the outputs of the fast attention module and the masked multi-head attention module to achieve the fusion of time-related features and space-related features. The formula used is as follows: ; In the formula, represents the query of the fusion module, represents the key of the fusion module, Represents the value of the fusion module, represents the query transformation weight matrix of the fusion module, represents the key transformation weight matrix of the fusion module, represents the value transformation weight matrix of the fusion module, represents the output of the fusion module, The dimension of the key representing the fusion module; Step S36: construct an output module for calculating the model output, specifically using a softmax classifier as the output module, taking the output of the last hidden layer as the input of the output module, and calculating the output of the model. The hidden layer is specifically composed of the gated time convolution module, the graph convolution module, the fast attention module, the masked multi-head attention module and the fusion module. The hidden layer formula and the output module formula are expressed as follows: ; In the formula, represents the output of the qth hidden layer, represents the output of the q-1th hidden layer, Represents the fusion module operation function, represents the fast attention module operation function, represents the gated temporal convolution module operation function, represents the masked multi-head attention module operation function, Represents the graph convolution module operation function, represents the prediction results of the improved spatiotemporal attention graph convolution model, represents the output weights of the improved spatiotemporal attention graph convolution model, represents the output bias term of the improved spatiotemporal attention graph convolution model, represents the output of the Qth hidden layer, where Q represents the total number of hidden layers; Step S37: construct and train the model, specifically, construct an improved spatiotemporal attention graph convolution model by constructing the gated temporal convolution module, constructing the graph convolution module, constructing the fast attention module, constructing the masked multi-head attention module, constructing the fusion module and constructing the output module, train the model based on the effect prediction training set, verify the model performance based on the effect prediction test set, select the cross entropy loss function as the model loss function, obtain the improved spatiotemporal attention graph convolution model, and use it as the processing effect prediction model.

3. The method for predicting sewage treatment effect based on deep learning according to claim 1, characterized in that: In step S4, the hyperparameter optimization is used to optimize the model hyperparameters of the treatment effect prediction model, specifically, using a hunting optimization algorithm to optimize the hyperparameters of the treatment effect prediction model to obtain an optimized treatment effect prediction model; The hyperparameter optimization specifically includes the following steps: Step S41: Initialization, the steps include: Step S411: Initialize the search space, specifically construct a hunter unit set and initialize the hunter unit position matrix. The hunter unit is used to represent the hyperparameter combination of the processing effect prediction model to be selected. The initial hunter unit position matrix is ​​expressed as follows: ; In the formula, represents the initial hunter unit position matrix, represents the position of the mth hunter unit in the nth dimension, represents the position of the Mth hunter unit in the Nth dimension, represents the position of the first hunter unit, represents the position of the second hunter unit, Represents the position of the Mth hunter unit, M represents the total number of hunter units, and N represents the total number of dimensions contained in the hunter unit; Step S412: determining the iteration stop condition, specifically selecting reaching the maximum number of iterations and the fitness reaching a threshold as the iteration termination condition; Step S413: determine the fitness, specifically, using the hyperparameter combination of the candidate treatment effect prediction model represented by the hunter unit, and obtaining the accuracy of the treatment effect prediction model as the fitness of the hunter unit. The fitness vector is expressed as follows: ; In the formula, F represents the fitness vector, represents the fitness of the first hunter unit, represents the fitness of the second hunter unit, represents the fitness of the Mth hunter unit, represents the model accuracy calculation function obtained based on the corresponding candidate treatment effect prediction model hyperparameter combination represented by the hunter unit; Step S42: updating the location, the steps include: Step S421: Calculate the hunting radius using the following formula: ; In the formula, R represents the hunting radius, lt represents the current number of iterations, represents the maximum number of iterations, Represents a random number in the range [0,1]; Step S422: Calculate hunting control parameters using the following formula: ; In the formula, represents the hunting control parameters, represents a hyperbolic function, represents the fitness of the mth hunter unit, Represents the fitness of the global best position; Step S423: Calculate the hunger degree change parameter, using the following formula: ; In the formula, represents the hunger degree change parameter, Hc represents the hunger degree change control parameter, Represents a random number in the range [0,1]. Represents a random number in the range [0,1]. Represents the fitness of the global worst position, UB represents the upper limit of the search space, and LB represents the lower limit of the search space; Step S424: Update the hunger level, the formula used is as follows: ; In the formula, Represents the updated hunger level of the mth hunter unit, Indicates the hunger degree of the mth hunter unit before the update; Step S425: Update the hunger weight, the formula used is as follows: ; In the formula, represents the optimal hunger weight of the mth hunter unit, represents the relative hunger weight of the mth hunter unit, Represents the updated sum of hunger of all hunter units. Represents a random number in the range [0,1]. Represents a random number in the range [0,1]. represents a random number in the range [0,1], Ch represents the cooperative hunting threshold; Step S426: The hunter unit position is updated, and the formula used is as follows: ; In the formula, represents the position of the mth hunter unit at the lt+1th iteration, represents the position of the mth hunter unit at the ltth iteration, Rn represents a random number that conforms to the normal distribution in the range [0,1], Represents a random number in the range [0,1]. represents the global optimal position at the ltth iteration, Represents a random number in the range [0,1]; Step S43: updating the global optimal position, specifically selecting the position of the hunter unit with the best fitness as the global optimal position; Step S44: iterative updating, specifically, continuously iteratively updating until the iteration stop condition is reached; Step S45: performing hyperparameter optimization, specifically, optimizing the hyperparameters of the processing effect prediction model through the initialization, the update position, the global optimal position update and the iterative update to obtain an optimized processing effect prediction model.

4. The method for predicting sewage treatment effect based on deep learning according to claim 1, characterized in that: In step S1, the data collection is used to collect the original data required for predicting the sewage treatment effect, specifically, to obtain the sewage treatment original data set from the sewage treatment monitoring system through data collection; The sewage treatment original data set specifically includes a historical treatment data set and a current treatment data set. The historical treatment data set and the current treatment data set specifically include water quality parameters, sewage flow parameters, sewage treatment equipment operation status parameters, external environmental parameters and sludge treatment parameters. The water quality parameters specifically include sewage chemical oxygen demand, sewage biochemical oxygen demand, sewage pH value, sewage chemical element content and sewage turbidity parameters. The sewage treatment equipment operation status parameters specifically include aeration equipment operation parameters, pump station operation parameters, sedimentation tank operation parameters, biological pool operation parameters and equipment dosage. The external environmental parameters specifically include ambient temperature and ambient humidity. The sludge treatment parameters specifically include sludge generation, sludge concentration and sludge dewatering effect parameters.

5. The method for predicting sewage treatment effect based on deep learning according to claim 1, characterized in that: In step S2, the data preprocessing is used to preprocess the collected raw data, and specifically includes the following steps: Step S21: data cleaning, which is used to clean the original data, specifically to remove missing values ​​and duplicate values ​​in the historical processing data set and the current processing data set to obtain a historical preliminary data set and a current preliminary data set; Step S22: data labeling, used to label the historical preliminary data, specifically labeling the data in the historical preliminary data set as unqualified, qualified, good and excellent, and using them as data labels to obtain a historical labeled data set; Step S23: data encoding, which is used to encode the data, specifically, using a one-hot encoding method to encode the historical marked data set and the current preliminary data set to obtain a historical encoded data set and a current encoded data set; Step S24: data normalization, which is used to normalize the coded data, specifically, using the minimum-maximum method to normalize the historical coded data set and the current coded data set to obtain a historical normalized data set and a data set to be predicted; Step S25: data set segmentation, which is used to segment the data set, specifically segmenting the historical normalized data set to obtain an effect prediction training set and an effect prediction test set; Step S26: preprocessing, specifically obtaining an effect prediction training set and an effect prediction test set through the data cleaning, data labeling, data encoding, data normalization and data set segmentation, and obtaining a data set to be predicted through the data cleaning, data encoding and data normalization.

6. The method for predicting sewage treatment effect based on deep learning according to claim 1, characterized in that: In step S5, the sewage treatment effect prediction is specifically to use the data set to be predicted as the input of the optimized treatment effect prediction model to predict the sewage treatment effect, obtain sewage treatment effect level reference data, and based on the sewage treatment effect level reference data, comprehensively consider and estimate the sewage treatment effect.

7. A sewage treatment effect prediction system based on deep learning, used to implement the sewage treatment effect prediction method based on deep learning as described in any one of claims 1 to 6, characterized in that: It includes a data acquisition module, a data preprocessing module, a treatment effect prediction model building module, a hyperparameter optimization module and a sewage treatment effect prediction module.

8. The sewage treatment effect prediction system based on deep learning according to claim 7 is characterized in that: The data acquisition module is used for data acquisition, and obtains the original sewage treatment data set through data acquisition, and sends the original sewage treatment data set to the data preprocessing module; The data preprocessing module is used for data preprocessing, and obtains a data set to be predicted, an effect prediction training set and an effect prediction test set through data preprocessing, and sends the data set to be predicted to the sewage treatment effect prediction module, and sends the effect prediction training set and the effect prediction test set to the treatment effect prediction model construction module; The processing effect prediction model construction module is used to construct a processing effect prediction model, obtain the processing effect prediction model by constructing an improved spatiotemporal attention graph convolution model, and send the processing effect prediction model to the hyperparameter optimization module; The hyperparameter optimization module is used to perform hyperparameter optimization, and obtain an optimized treatment effect prediction model by using a hunting optimization algorithm to perform hyperparameter optimization, and send the optimized treatment effect prediction model to the sewage treatment effect prediction module; The sewage treatment effect prediction module is used for sewage treatment effect prediction. It predicts the sewage treatment effect by using an optimized treatment effect prediction model to obtain sewage treatment effect grade reference data.

Citation Information

Patent Citations

  • Neural network model knowledge distillation method and system based on automatic gradient mixing

    CN115019085A

  • Basin multi-site water quality space-time prediction method based on space-time diagram convolutional network

    CN118940886A