Method, device, equipment and medium for generating virtual samples for soft measurement of sewage treatment
By combining multi-objective optimization functions and generative adversarial networks, high-quality virtual samples are generated, which solves the technical bottleneck of virtual sample generation in sewage treatment and improves the adaptability and prediction accuracy of the model.
Patent Information
- Application Number
- CN202510788607.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-13
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2045-06-13
AI Technical Summary
The existing technology in sewage treatment has the problem that the virtual sample generation method is limited by the prior distribution assumption of the statistical interpolation method, resulting in the model being too tight and the distribution offset, lacking the ability to characterize the nonlinear characteristics of complex dynamic systems, unstable generative adversarial network training, and lack of process mechanism knowledge embedding, resulting in key parameter prediction deviation and control strategy optimization failure.
The initialization population is generated through a multi-objective optimization function, adversarial training is performed using a generative adversarial network, the generator input data is optimized by combining coverage indicators and discretization indicators, and a multi-layer perceptron network is constructed to achieve high-quality virtual sample generation of sewage treatment parameter datasets.
It improves the accuracy and consistency of virtual samples, solves the technical bottlenecks of gradient vanishing and mode collapse in generative adversarial networks, and enhances the adaptability and predictive ability of soft measurement models.
Smart Images

Figure CN120296431B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of soft measurement, and in particular to a method, device, equipment and medium for generating soft measurement virtual samples for sewage treatment. Background Art
[0002] In industrial production processes, especially in complex scenarios like sewage treatment, we need to accurately predict key parameters such as chemical oxygen demand (COD) and biochemical oxygen demand (BOD5). However, in practice, data for these parameters is often very limited and difficult to obtain, leading to insufficient samples for model training.
[0003] Existing virtual sample generation technologies face systemic technical bottlenecks in industrial intelligent applications. Methodologically, they are limited by the prior distribution assumptions of statistical interpolation methods, leading to a vicious cycle of over-tightening models and distribution bias in low-entropy industrial data scenarios, and lack the ability to effectively represent the nonlinear characteristics of complex dynamic systems. Industrial adaptability suffers from insufficient decoupling of multi-physics coupling and a lack of embedded process mechanism knowledge, leading to increased prediction bias for key parameters and inefficient knowledge distillation. Regarding algorithmic architecture, generative adversarial networks (GANs) have further developed into a mainstream data-driven paradigm. Their basic architecture captures the underlying distributional characteristics of data through deep nonlinear mapping, but suffers from poor adversarial training stability and inadequate representation of industrial data uncertainty, which often hinders their applicability in industrial scenarios. At the engineering application level, the lack of causal modeling and the consistency gap in digital twins increase the risk of control strategy optimization failure and result in insufficient dynamic simulation fidelity. These shortcomings constitute the underlying technical barriers to industrial intelligentization, necessitating the development of a new generation of GANs that integrate mechanism modeling, nonlinear dynamic analysis, and multimodal knowledge embedding to achieve breakthrough improvements. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a method for generating virtual samples of sewage treatment soft measurement, optimize the sewage treatment parameter dataset through a multi-objective optimization function, obtain an initialized population, and solve the technical bottlenecks of gradient vanishing and mode collapse of the generative adversarial network by guiding the information sharing architecture, thereby ensuring the intrinsic structure consistency of the virtual samples and the sewage treatment parameter dataset, and improving the accuracy of the virtual samples.
[0005] In a first aspect, an embodiment of the present invention provides a method for generating virtual samples for soft measurement of sewage treatment, comprising:
[0006] Acquire a sewage treatment parameter data set; wherein the sewage treatment parameter data set includes sewage treatment process parameters and at least one sewage treatment result parameter;
[0007] Based on a multi-objective optimization function, an initial input data set of a generative adversarial network generator is optimized to generate an initialized population; wherein the multi-objective optimization function includes a coverage index function and a discretization index function;
[0008] The initialized population is input into the generator of the generative adversarial network, and the initial virtual samples and sewage treatment parameter data set output by the generator of the generative adversarial network are input into the discriminator of the generative adversarial network for adversarial training to obtain the virtual samples output by the generator after reaching a stable state as the virtual samples corresponding to the sewage treatment parameter data set; wherein, the adversarial training refers to multi-task joint training implemented for each of the sewage treatment result parameters.
[0009] In a preferred embodiment of the present invention, the multi-objective optimization function includes a coverage index function and a discretization index function; based on the multi-objective optimization function, the initial input data of the generative adversarial network generator is optimized to generate an initialization population, including:
[0010] Create an initial set of input data that follows a normal distribution;
[0011] According to the covering index function and the discretization index function, the covering index and the discretization index corresponding to each parent individual in the initial input data set are calculated;
[0012] The parent individuals are screened according to the coverage index and discretization index corresponding to each parent individual to obtain the parent population;
[0013] Generate the offspring population corresponding to the parent population based on the simulated binary crossover operator;
[0014] According to the covering index function and the discretization index function, the covering index and the discretization index corresponding to each offspring individual in the offspring population are calculated;
[0015] When the coverage index corresponding to each offspring individual meets the coverage threshold and the discretization index meets the discrete threshold, a preset number of individuals are selected from the parent population and the offspring population as the initialization population based on the Pareto dominance relationship.
[0016] In a preferred embodiment of the present invention, the above-mentioned generation of a child population corresponding to a parent population based on a simulated binary crossover operator includes:
[0017] Obtain two parent individuals from the parent population in sequence according to the preset order;
[0018] Input the parent individuals into the simulated binary crossover operator to obtain two offspring individuals until all parent individuals are traversed;
[0019] The obtained offspring individuals are composed of the offspring population.
[0020] In a preferred embodiment of the present invention, the above-mentioned sewage treatment parameter data set includes sewage treatment process parameters and sewage treatment result parameters, and the number of sewage treatment result parameters is at least one.
[0021] In a preferred embodiment of the present invention, the above-mentioned initialization population is input into the generator of the generative adversarial network, and the initial virtual samples and sewage treatment parameter dataset output by the generator of the generative adversarial network are input into the discriminator of the generative adversarial network to perform adversarial training, including:
[0022] For each sewage treatment result parameter, establish a training subtask as the subtask corresponding to the sewage treatment result parameter;
[0023] For each subtask, generate the parameter mask of the generator in the subtask;
[0024] For each subtask, perform element-wise multiplication based on the preset initialized base network and parameter mask to construct the subnetwork corresponding to the generator of the generative adversarial network in the subtask;
[0025] For each subtask, prune the parameter mask of the generator of the generative adversarial network in the subtask according to the preset pruning rate to obtain the pruned parameter mask of the generator in the subtask;
[0026] For each subtask, when the sharing rate of the pruned parameter mask of the generator of the GAN in the subtask is less than or equal to the sharing rate threshold, the pruned parameter mask of the generator in the subtask is input into the generator of the GAN in the subtask, and the generator of the GAN in the subtask is updated to obtain the updated generator of the GAN in the subtask;
[0027] For each subtask, the initialized population is input into the updated generator of the generative adversarial network corresponding to the sewage treatment result parameters, and the initial virtual samples, sewage treatment process parameters and sewage treatment result parameters output by the updated generator of the generative adversarial network are input into the discriminator of the generative adversarial network corresponding to the sewage treatment result parameters for adversarial training.
[0028] In a preferred embodiment of the present invention, the generator reaches a stable state, comprising:
[0029] Obtain a first virtual sample and a second virtual sample output by a generator of a generative adversarial network; wherein the first virtual sample and the second virtual sample are the last two virtual samples output by the generator of the generative adversarial network during adversarial training;
[0030] calculating the maximum average difference between the first virtual sample and the second virtual sample;
[0031] When the maximum average difference is less than the difference threshold, the generator is determined to have reached a stable state.
[0032] In a preferred embodiment of the present invention, the above-mentioned initialization population is input into the generator of the generative adversarial network, the initial virtual samples output by the generator of the generative adversarial network and the sewage treatment parameter data set are input into the discriminator of the generative adversarial network, and adversarial training is performed to obtain the virtual samples output by the generator after reaching a stable state as the virtual samples corresponding to the sewage treatment parameter data set, which includes:
[0033] The virtual samples are input into the sewage treatment soft measurement model, and the sewage treatment soft measurement model is trained to obtain a trained sewage treatment soft measurement model. The sewage treatment soft measurement model is used to predict sewage treatment result parameters based on sewage treatment process parameters; wherein, the sewage treatment soft measurement model is a neural network model constructed based on a multi-layer perceptron.
[0034] In a second aspect, an embodiment of the present invention further provides a device for generating virtual samples for soft measurement of sewage treatment, comprising:
[0035] A data acquisition module, configured to acquire a sewage treatment parameter data set, wherein the sewage treatment parameter data set includes sewage treatment process parameters and at least one sewage treatment result parameter;
[0036] An initialization population acquisition module is used to optimize the initial input data set of the generative adversarial network generator based on a multi-objective optimization function to generate an initialization population; wherein the multi-objective optimization function includes a coverage index function and a discretization index function;
[0037] The virtual sample acquisition module is used to input the initialized population into the generator of the generative adversarial network, input the initial virtual samples and sewage treatment parameter data set output by the generator of the generative adversarial network into the discriminator of the generative adversarial network, perform adversarial training, and obtain the virtual samples output by the generator after reaching a stable state as the virtual samples corresponding to the sewage treatment parameter data set; wherein, the adversarial training refers to multi-task joint training implemented for each of the sewage treatment result parameters.
[0038] In a third aspect, an embodiment of the present invention further provides an electronic device comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the sewage treatment soft measurement virtual sample generation method of the first aspect mentioned above.
[0039] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the sewage treatment soft measurement virtual sample generation method of the first aspect mentioned above.
[0040] The embodiments of the present invention bring the following beneficial effects:
[0041] The embodiments of the present invention provide a method for generating an initialization population through a multi-objective optimization function. By optimizing these objectives, the generated initialization population can be made closer to the real sample set and have higher diversity, thereby making the generated virtual samples more reflective of the complex characteristics of the sewage treatment process, thereby making the soft measurement model better adapted to the actual sewage treatment process, solving the technical bottlenecks of gradient vanishing and mode collapse in the generative adversarial network, ensuring the intrinsic structure consistency of the virtual samples and the sewage treatment parameter dataset, and improving the accuracy of the virtual samples. By integrating and acquiring the original sensor dataset collected during the sewage treatment process, the focus is on building a high-quality input dataset that conforms to the characteristics of industrial scenarios, aiming to solve the problem of uneven distribution of original data and provide a foundation for improving the characterization ability and integrity of virtual samples.
[0042] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.
[0043] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 A flowchart of a method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention;
[0046] Figure 2 A flowchart of another method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention;
[0047] Figure 3a A flowchart of another method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention;
[0048] Figure 3b A schematic diagram of sharing criteria between multi-task subnets provided in an embodiment of the present invention;
[0049] Figure 4 A schematic diagram of another method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention;
[0050] Figure 5 A schematic structural diagram of a virtual sample generation device for soft measurement of sewage treatment provided by an embodiment of the present invention;
[0051] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0053] In the field of virtual sample generation technology, existing technical solutions mainly include the following technical routes:
[0054] 1) Interpolation methods based on statistical distribution achieve sample expansion through multidimensional spatial interpolation strategies. The macro-trend diffusion (MTD) method uses a linear interpolation mechanism to improve the uniformity of sample distribution. However, its linear assumption leads to insufficient feature decoupling capabilities for nonlinear dynamic systems.
[0055] 2) The improved method improves sampling robustness by reconstructing the joint probability distribution, but it is prone to over-tightening the model due to the constraints of the prior distribution.
[0056] 3) Generative adversarial network technology captures the potential distribution characteristics of data through deep nonlinear mapping. Its improvement solutions include an adversarial generation framework that integrates an encoder structure, using the collaborative modeling of local patterns and global features to improve the physical consistency of generated samples, and introducing a generative adversarial network with a fuzzy membership function to achieve robust generation under unstructured noise interference. However, there are common problems such as instability in adversarial training and incomplete dissociation of multivariate coupling features.
[0057] 4) Neuro-evolutionary fusion methods use evolutionary algorithms to optimize network architecture and parameters, constructing hierarchical evolutionary mechanisms to mitigate mode collapse. However, these methods face bottlenecks in the structural integration of evolutionary operators and process knowledge. When addressing the multi-scale dynamics of industrial processes, these methods still face technical bottlenecks such as a lack of domain knowledge embedding mechanisms and inadequate modeling of causal relationships between variables.
[0058] Based on this, an embodiment of the present invention provides a method for generating virtual samples for soft measurement of sewage treatment. The method generates an initialization population through a multi-objective optimization function, takes into account multiple factors, and enables the generated virtual samples to better reflect the complex characteristics of the sewage treatment process, thereby enabling the soft measurement model to better adapt to the actual sewage treatment process, solving the technical bottlenecks of gradient vanishing and mode collapse in the generative adversarial network, ensuring the intrinsic structure consistency of the virtual samples and the sewage treatment parameter data set, and improving the accuracy of the virtual samples.
[0059] To facilitate understanding of this embodiment, a method for generating virtual samples for soft measurement of sewage treatment disclosed in an embodiment of the present invention is first introduced in detail.
[0060] Example 1
[0061] The embodiment of the present invention provides a method for generating virtual samples of soft measurement in sewage treatment. Figure 1 The flowchart of a method for generating virtual samples of sewage treatment soft measurement provided by an embodiment of the present invention is as follows. Figure 1 As shown, the sewage treatment soft measurement virtual sample generation method may include the following steps:
[0062] Step S101: Acquire a sewage treatment parameter data set.
[0063] The sewage treatment parameter data set includes sewage treatment process parameters and sewage treatment result parameters, and there is at least one sewage treatment result parameter. Among them, sewage treatment process parameters are key indicators collected in real time during the operation of the sewage treatment process; sewage treatment result parameters are core parameters that characterize the final treatment effect after the sewage treatment process is completed, and there are at least one such parameter. From a causal logic perspective, sewage treatment process parameters are key variables that affect sewage treatment result parameters. By accurately regulating the former, effective control of the latter can be achieved, thereby ensuring the quality and efficiency of sewage treatment.
[0064] The sewage treatment parameter dataset is collected by sensors installed during the sewage treatment process. Furthermore, the raw data collected by the sensors during the sewage treatment process is preprocessed by performing data interpolation, variable conversion, and disturbance addition on the raw data in the sensor raw data to obtain the sewage treatment parameter dataset.
[0065] For example, task 1 and task 2 in the sewage treatment task are the 5-day biochemical oxygen demand (BOD5) and chemical oxygen demand (COD), respectively. The detailed information of the variables included in the sewage treatment parameter dataset is shown in Table 1.
[0066] Table 1. 13 variables of the wastewater treatment process
[0067]
[0068] There are a total of 100 records of input-output data in the sewage treatment parameter data set. Each input-output data includes x1 to x2 as shown in Table 1. 13 The input data shown in Table 1, i.e., the wastewater treatment process parameters, and the output data shown in Table 1, i.e., the wastewater treatment result parameters, are 70% used as the training data set and 30% as the test data set. The training data samples and the test data samples are mutually exclusive.
[0069] Step S102: Based on a multi-objective optimization function, the initial input data set of the generative adversarial network generator is optimized to generate an initialized population.
[0070] The multi-objective optimization function includes a coverage metric function and a discretization metric function. The coverage metric measures the consistency of the evolving population distribution with the real data. The discretization metric assesses the diversity of individuals within the population. By optimizing these objectives, the generated initial population can be made closer to the real sample set and have higher diversity.
[0071] The initial input data set may be a randomly generated data set. For example, the initial input data set may be composed of multiple random numbers.
[0072] Specifically, assume that the population D representing the generator input consists of n individuals, P D and P R represents the distribution of population D and sewage treatment parameter data set. The coverage index function can be expressed as:
[0073]
[0074] Among them, Cover(D) is the coverage index; is the probability distribution of each individual in population D; is the probability distribution of each data in the sewage treatment parameter data set; x is the individual in population D; y is the data in the sewage treatment parameter data set.
[0075] The discretization index function Dis(D) can be expressed as:
[0076]
[0077] Among them, Dis(D) is the discretization index; c(i,j) represents the cosine similarity between individual i and individual j.
[0078] An initial input dataset consisting of n random numbers is pre-set. Based on a multi-objective optimization function, the coverage index and discretization index between the initial input dataset and the sewage treatment parameter dataset are calculated. The initial input dataset is then optimized based on the coverage index and discretization index to reduce the coverage index and discretization index, thereby obtaining an initialized population.
[0079] In step S103, the initialized population is input into the generator of the generative adversarial network, and the initial virtual samples and the sewage treatment parameter data set output by the generator of the generative adversarial network are input into the discriminator of the generative adversarial network for adversarial training to obtain the virtual samples output after the generator reaches a stable state as the virtual samples corresponding to the sewage treatment parameter data set.
[0080] In a generative adversarial network, the generator is used to generate virtual sample data, and the discriminator is used to determine the probability that the sample comes from the virtual sample data or the real sample. The generator learns the distribution of real samples based on the results of the discriminator to reduce errors, so that the generator and discriminator are trained together in a minimum-maximum game confrontation.
[0081] In this embodiment of the present invention, the generator uses a multilayer perceptron with 4 hidden layers, the hidden layers use the ReLU activation function, and the output layer uses the linear activation function:
[0082]
[0083]
[0084] in, and are the weights and biases between the generator input layer and the hidden layer, respectively; is the output of the hidden layer in the generator; and are the weights and biases between the generator hidden layer and the output layer, respectively; is the output of the generator during training. are the sewage treatment process parameters composed of noise data, It is the sewage treatment result parameter in the sewage treatment parameter dataset. Constitute the initial population.
[0085] The discriminator consists of multiple hidden layers, where the hidden layer uses the Relu activation function and the output layer uses the Sigmoid activation function:
[0086]
[0087]
[0088]
[0089] in, The initial virtual sample and sewage treatment parameter datasets The mixed sample composed of and are the weights and biases between the discriminator input layer and the hidden layer, respectively; is the output of the hidden layer in the discriminator; and are the weights and biases between the hidden layer and the output layer respectively; sigmoid is the S-type activation function; Output is the output of the discriminator during training.
[0090] The objective function of the generative adversarial network is:
[0091]
[0092] in, Represents the sewage treatment process parameters in the sewage treatment parameter dataset distribution of Yes, the discriminator Output; Represents the sewage treatment process parameters in the initial virtual sample The distribution of ; Output is the discriminator of Output.
[0093] After n training cycles, the quality of the initial virtual samples output by the generator is compared with the quality of the initial virtual samples detected last time. When the difference between the two is less than the preset threshold, the generator is considered to have reached stability. Specifically, the following formula can be used to determine whether the generator has reached stability:
[0094]
[0095] Among them, Q n represents the quality of the initial virtual samples generated by the n-th training generator, Indicates the preset threshold, which can be set according to actual conditions. A value of 1 indicates that the generator has reached stability; otherwise, it has not reached stability and needs to continue training.
[0096] When the generator is stable, the initial virtual samples generated by the last training of the generator are used as the virtual samples corresponding to the sewage treatment parameter dataset.
[0097] Adversarial training refers to multi-task joint training for the sewage treatment result parameters. Specifically, a subtask is established for each sewage treatment result parameter. For each subtask, an initialization population is input into the corresponding generator. The generator generates initial virtual samples based on the initialization population. These initial virtual samples, along with sewage treatment process parameters and the sewage treatment result parameters corresponding to the subtask, are then input into the discriminator. The discriminator's task is to determine whether the input sample is real sewage treatment data (including sewage treatment process parameters and sewage treatment result parameters) or a virtual sample generated by the generator. During this process, the generator and the discriminator undergo adversarial training. The generator continuously adjusts its parameters to generate more realistic virtual samples to deceive the discriminator. The discriminator is also continuously optimized to improve its ability to distinguish between real and virtual samples. Through this adversarial training, the generator gradually learns the distribution characteristics of real sewage treatment data, thereby generating high-quality virtual samples. After training is completed, different generators are trained for different subtasks, and the parameter similarity between the generators meets a preset threshold. The parameter similarity is the ratio of the number of identical parameters between any two generators to the total number of parameters of each generator. For example, if Generator 1 and Generator 2 each have 10 parameters and 8 of them are identical, the parameter similarity for Generator 1 is 80%, and for Generator 2, the parameter similarity is 80%.
[0098] The embodiment of the present invention provides a method for generating virtual samples for soft measurement of sewage treatment. This method generates an initialization population through a multi-objective optimization function, takes data coverage and discreteness as optimization targets, and considers multiple factors to ensure that the generated virtual samples can better reflect the complex characteristics of the sewage treatment process, thereby making the soft measurement model better adapted to the actual sewage treatment process. This method solves the technical bottlenecks of gradient vanishing and mode collapse in generative adversarial networks, ensures the intrinsic structure consistency of virtual samples with sewage treatment parameter datasets, and improves the accuracy of virtual samples. By integrating and acquiring the original sensor datasets collected during the sewage treatment process, the method focuses on constructing a high-quality input dataset that conforms to the characteristics of industrial scenarios. Preprocessing operations such as data interpolation, variable conversion, and adding disturbances are performed on the original data in the sensor original datasets, aiming to solve the problems of high noise and uneven distribution of the original data and improve the data representation capability and integrity.
[0099] Example 2
[0100] An embodiment of the present invention also provides another method for generating virtual samples for soft measurement of sewage treatment; this method is implemented on the basis of the method of the above embodiment; this method focuses on describing a multi-objective optimization function including a coverage index function and a discretization index function; based on the multi-objective optimization function, the initial input data of the generative adversarial network generator is optimized to generate a specific implementation method for the initialization population.
[0101] Figure 2 A flowchart of another method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the sewage treatment soft measurement virtual sample generation method may include the following steps:
[0102] Step S201: Acquire a sewage treatment parameter data set.
[0103] Step S202: Create a set of initial input data sets that obey a normal distribution.
[0104] Specifically, a set of random data sets that obey a normal distribution is created in the target space O as the initial input data set. The data included in the initial input data set can be called individuals, and the individuals in the initial input data set can be used as parent individuals.
[0105] Step S203 , calculating the coverage index and discretization index corresponding to each parent individual in the initial input data set according to the coverage index function and the discretization index function.
[0106] For each parent individual in the initial input data set, the sewage treatment parameter data set and the initial input data set are input into the covering index function to obtain the covering index of the parent individual, and the sewage treatment parameter data set and the initial input data set are input into the discretization index function to obtain the discretization index of the parent individual.
[0107] Step S204 , screening the parent individuals according to the coverage index and discretization index corresponding to each parent individual to obtain the parent population.
[0108] A binary tournament selection is performed based on the coverage and discretization indices corresponding to each parent individual. Parent individuals with better indices are retained to form the parent population. It is understood that the coverage and discretization indices of two adjacent parent individuals can be compared in a certain order, and the parent individual with the smaller coverage index and the parent individual with the smaller discretization index can be retained. The retained parent individuals serve as the parent population.
[0109] Step S205 : generating a child population corresponding to the parent population based on a simulated binary crossover operator.
[0110] The simulated binary crossover (SBX) reproduction operator is used to generate the offspring population. Assume that the two parent individuals are and , use the SBX operator to generate two offspring individuals and :
[0111]
[0112] Where d refers to the number of data contained in an individual; is the distribution factor according to the equation Dynamically randomly determined:
[0113]
[0114] in, For custom parameters, The larger the value, the greater the probability that the offspring individuals are close to the parent individuals. .
[0115] Specifically, the offspring population can be determined through steps A1 to A3.
[0116] Step A1: Obtain two parent individuals from the parent population in sequence according to a preset order.
[0117] Step A2: Input the parent individuals into the simulated binary crossover operator to obtain two offspring individuals until all parent individuals are traversed.
[0118] Step A3: The obtained offspring individuals are formed into an offspring population.
[0119] The preset order can be preset according to actual conditions.
[0120] Step S206 , calculating the coverage index and discretization index corresponding to each offspring individual in the offspring population according to the coverage index function and the discretization index function.
[0121] For each offspring individual in the offspring population, the sewage treatment parameter dataset and the offspring population are input into the covering index function to obtain the covering index of the offspring individual, and the sewage treatment parameter dataset and the offspring population are input into the discretization index function to obtain the discretization index of the offspring individual.
[0122] In step S207, when the coverage index corresponding to each offspring individual satisfies the coverage threshold and the discretization index satisfies the discrete threshold, a preset number of individuals are selected from the parent population and the offspring population as the initialization population based on the Pareto dominance relationship.
[0123] The coverage threshold and the discrete threshold refer to the thresholds of the coverage index and the discrete index that are set in advance. The coverage threshold and the discrete threshold can be used to determine the consistency of the distribution of the offspring population with the sewage treatment parameter data set. When the coverage index corresponding to each offspring individual is less than the coverage threshold, and the discretization index is less than the discrete threshold, it is determined that the coverage index corresponding to each offspring individual meets the coverage threshold, and the discretization index meets the discrete threshold. At this point, it indicates that the distribution of the offspring population is well consistent with the sewage treatment parameter data set. Otherwise, it indicates that the distribution of the offspring population is poorly consistent with the sewage treatment parameter data set, and the offspring population needs to be updated to the parent population, and the process returns to step S204. Alternatively, when the number of times step S204 is returned to the preset number, step S208 can be executed even if the coverage index corresponding to the offspring individual does not meet the coverage threshold, or the discretization index does not meet the discrete threshold.
[0124] Specifically, when the coverage index corresponding to each offspring individual meets the coverage threshold and the discretization index meets the discretization threshold, a preset number of individuals are selected from the parent population and the offspring population as the initial population according to the Pareto dominance relationship. The preset number can be the same as the number of data in the initial input dataset.
[0125] Furthermore, in an embodiment of the present invention, the acquisition of the initialization population can be achieved by using the evolutionary optimization algorithm MBEA-GI. Specifically, the evolutionary optimization algorithm MBEA-GI is shown in Table 2:
[0126] Table 2. Evolutionary optimization algorithm MBEA-GI
[0127]
[0128] In step S208, the initialized population is input into the generator of the generative adversarial network, and the initial virtual samples and sewage treatment parameter data set output by the generator of the generative adversarial network are input into the discriminator of the generative adversarial network for adversarial training to obtain the virtual samples output after the generator reaches a stable state as the virtual samples corresponding to the sewage treatment parameter data set.
[0129] The embodiment of the present invention provides a method for generating virtual samples for soft measurement of sewage treatment. The method uses coverage indicators and discretization indicators to dynamically correct the offspring population to ensure the intrinsic structure consistency of the offspring population with the original sewage treatment parameter data set. The method uses coverage indicators and discretization indicators to monitor the generation process of the offspring population. When the coverage indicators and discretization indicators of the offspring population in continuous iterations are lower than the set threshold, the training is automatically terminated. This ensures that the generator ultimately generates virtual samples that both conform to the distribution of the sewage treatment parameter data set and cover the blind spots of the feature space, breaking through the limitations of traditional generation models in industrial small sample scenarios.
[0130] Example 3
[0131] An embodiment of the present invention also provides another method for generating virtual samples for soft measurement of sewage treatment; this method is implemented on the basis of the method of the above embodiment; this method focuses on describing the specific implementation method of inputting the initialized population into the generator of the generative adversarial network, and inputting the initial virtual samples and sewage treatment parameter data set output by the generator of the generative adversarial network into the discriminator of the generative adversarial network to perform adversarial training.
[0132] Figure 3a A flowchart of another method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention is shown in FIG. Figure 3a As shown, the sewage treatment soft measurement virtual sample generation method may include the following steps:
[0133] Step S301: Obtain a sewage treatment parameter data set.
[0134] Step S302: Based on a multi-objective optimization function, the initial input data set of the generative adversarial network generator is optimized to generate an initialized population.
[0135] Step S303: For each sewage treatment result parameter, a training subtask is established as a subtask corresponding to the sewage treatment result parameter.
[0136] The wastewater treatment process involves multiple outcome parameters, such as chemical oxygen demand (COD), biochemical oxygen demand (BOD5), and ammonia nitrogen content. A separate training subtask is established for each outcome parameter. This allows for refined generative adversarial network training tailored to each specific outcome parameter, as these are influenced in varying ways and degrees by various factors during the treatment process. Each subtask focuses on learning how to generate virtual samples related to that specific outcome parameter to better reflect its changing patterns and influencing factors. Each subtask corresponds to a specific generative adversarial network.
[0137] Step S304: For each subtask, generate a parameter mask of the generator in the subtask.
[0138] A parameter mask is a matrix with the same structure as the generator's parameters, whose elements are typically either 0 or 1. Within each subtask, a specific algorithm or strategy is used to generate the generator's parameter mask. The parameter mask controls which generator parameters are included in the calculation and which are temporarily masked. For example, elements with a value of 1 correspond to generator parameters that are used during the calculation, while elements with a value of 0 correspond to parameters that are not. This allows the generator's structure and functionality to be flexibly adjusted to suit the needs of different subtasks.
[0139] Specifically, for each subtask, the parameter mask of the subtask can be generated as all 1s by default.
[0140] In step S305, for each subtask, an element-wise multiplication operation is performed according to the preset initialized basic network and parameter mask to construct a sub-network corresponding to the generator of the generative adversarial network in the subtask.
[0141] The preset initialized base network is a predefined network structure consisting of a certain number of neurons and connections. For each subtask, the initialized base network is element-wise multiplied by the generated parameter mask. Specifically, each parameter in the base network is multiplied by the element at the corresponding position in the parameter mask, resulting in a new network structure, the sub-network. This operation selectively retains or removes certain parameters and connections in the base network, depending on the parameter mask settings. This allows the sub-network to focus on learning features and patterns relevant to the sub-task, improving the sub-network's relevance and efficiency.
[0142] Step S306: For each subtask, prune the parameter mask of the generator of the generative adversarial network in the subtask according to a preset pruning rate to obtain the pruned parameter mask of the generator in the subtask.
[0143] The preset pruning rate is a pre-set ratio that controls the proportion of parameters in the parameter mask that need to be pruned (i.e., set to 0). For each subtask, the generator's parameter mask is pruned according to this pruning rate. During the pruning process, the contribution of each parameter in the parameter mask to model performance is evaluated. Then, according to specific rules, the mask elements corresponding to parameters with smaller contributions are set to 0. This further simplifies the subnetwork structure, removes redundant parameters, reduces the model's computational complexity, avoids overfitting, and improves the model's generalization ability.
[0144] Step S307: For each subtask, when the sharing rate of the pruned parameter mask of the generator of the generative adversarial network in the subtask is less than or equal to the sharing rate threshold, the pruned parameter mask of the generator in the subtask is input into the generator of the generative adversarial network in the subtask, and the generator of the generative adversarial network in the subtask is updated to obtain the updated generator of the generative adversarial network in the subtask.
[0145] The sharing rate threshold is a pre-set threshold used to determine whether the parameter mask is appropriately shared. For each subtask, when the sharing rate of the pruned parameter mask of the generator is less than or equal to the sharing rate threshold, it indicates that the parameter mask achieves good parameter sharing and structural simplification while ensuring the performance of the generative adversarial network. At this point, the pruned parameter mask is input into the generator of the generative adversarial network in that subtask, and the generator parameters are updated. The updated generator can better adapt to the needs of the subtask and produce virtual samples that are more consistent with the parameter characteristics of specific sewage treatment results.
[0146] Step S308: For each subtask, the initialized population is input into the updated generator of the generative adversarial network corresponding to the sewage treatment result parameters, and the initial virtual samples, sewage treatment process parameters and sewage treatment result parameters output by the updated generator of the generative adversarial network are input into the discriminator of the generative adversarial network corresponding to the sewage treatment result parameters for adversarial training.
[0147] For each subtask, the initialized population is input into the corresponding updated generator. The generator generates initial virtual samples based on the initialized population, and then inputs these initial virtual samples, sewage treatment process parameters, and sewage treatment result parameters corresponding to the subtask into the discriminator. The discriminator's task is to determine whether the input sample is real sewage treatment data (including sewage treatment process parameters and sewage treatment result parameters) or a virtual sample generated by the generator. In this process, the generator and the discriminator undergo adversarial training. The generator continuously adjusts its own parameters in an attempt to generate more realistic virtual samples to deceive the discriminator; the discriminator is also continuously optimized to improve its ability to distinguish between real and virtual samples. Through this adversarial training, the generator can gradually learn the distribution characteristics of real sewage treatment data, thereby generating high-quality virtual samples.
[0148] Furthermore, in an embodiment of the present invention, the training of the generative adversarial network between subtasks can be achieved through the guidance information sharing architecture. Specifically, the guidance information sharing architecture is shown in Table 3:
[0149] Table 3. Guidance information sharing architecture
[0150]
[0151] Among them, the network parameters in the pre-parameterized basic network Ԑ are ,right Perform random sampling and obtain For each task, the parameter mask Initialize the mask to all 1s, that is For each task, use the dataset D of the task t, train the pre-parameterized basic network for k steps and get . Prune according to the pruning rate α The remaining parameters in . Among them, is the network parameter of the network obtained after k steps of training. If the jth parameter in the network parameter If pruned, the jth data in the parameter mask Set to 0. The sharing ratio is calculated based on the proportion of non-zero data in the parameter mask, where is the number of non-zero elements in the parameter mask, Refers to the number of parameters in the pre-parameterized basic network Ԑ. If the calculated sharing ratio is less than or equal to S, it means that the parameter sharing degree meets the requirements and the current parameter mask is retained. If the calculated sharing ratio is greater than S, it means that the task reuses too many dedicated parameters and needs to enhance sharing. In this case, Reset the network to its initial value or the network parameters obtained during a training session, and retrain and prune until the calculated sharing rate is less than or equal to S.
[0152] Among them, steps 4-6 in Algorithm 2 can be achieved by Figure 3b The schematic diagram of the sharing of criteria between the multi-task sub-networks is shown in Figure 1. Given an original task and a target task, the criteria can be derived from the respective tasks 1 and 2 through the sparse mask sharing mechanism. Specifically, the network of the original task generator is the initialization base network Ԑ, and the mask All can be set to 1, task 1 is the BOD5 sample generation task, task 2 is the COD sample generation task, and the parameters of the generators of task 1 and task 2 are adjusted by the pruning mask M and the initialization base network Ԑ. Use the mask M of task t t And initialize the basic network Ԑ, the generator of task t can be expressed as , where ⊙ represents element-wise multiplication. Thus, a subnetwork is derived for each task from the initialized base network Ԑ, that is, the mask of the generator of task 1 is and the mask of the generator for task 2 is , the subnetwork has a structure associated with a hypothesis subspace suitable for a given task. In essence, the inductive bias tailored for a task is embedded in the subnetwork structure. Ideally, tasks with similar inductive biases should be assigned to similar parameter parts.
[0153] Because the guidance information sharing architecture is iterative, multiple candidate subnetworks may be generated as pruning progresses. In practice, only one subnetwork is selected for each task to form the guidance information sharing architecture. To address this issue, we adopt a greedy approach to select the best performing subnetwork among the candidate subnetworks. If multiple best-performing subnetworks exist, the one with the lowest sparsity is selected. The specific steps are shown in Table 4:
[0154] Table 4. Training steps of the network based on guided information sharing
[0155]
[0156] During multi-task training, each task is processed sequentially. This step selects the task to be trained, choosing one from T tasks for subsequent data processing and network parameter updates. For example, when T = 3, the first iteration might select task 1, the second iteration task 2, and the third iteration task 3, and so on. A mini-batch is a small portion of data randomly selected from the sewage treatment parameter dataset for task t. When training on large datasets, the entire dataset is typically not used at once, but rather divided into multiple mini-batches. Randomly selecting mini-batches increases the randomness and generalization of training, preventing the model from overfitting to specific data. For example, if the dataset for task t contains 1000 examples and the mini-batch size is set to 32, 32 examples are randomly selected from the 1000 examples to form a mini-batch. Each task has its own corresponding sub-network, which is derived from the initialized base network through operations such as parameter sharing and pruning. The selected mini-batch of data is fed into the subnet corresponding to task t, allowing the subnet to perform forward propagation based on the input data and generate an output. After the subnet performs forward propagation and generates an output, it is compared with the true labels in the mini-batch of data to calculate a loss function (such as mean squared error or cross entropy). The gradient of the loss function with respect to the subnet parameters is then calculated using a backpropagation algorithm. The subnet parameters are then updated based on the gradient to bring the subnet's output closer to the true labels. This is a key step in the training process; by continuously adjusting the parameters, the subnet learns the features and patterns relevant to the task.
[0157] Step S309: The virtual sample outputted by the generator after reaching a stable state is used as the virtual sample corresponding to the sewage treatment parameter data set.
[0158] The method for generating virtual samples for soft sensing in sewage treatment, provided by an embodiment of the present invention, achieves targeted knowledge transfer across multiple tasks through parameter pruning and sharing mechanisms. Based on dynamic masking technology, an adaptively adjustable sparse subnetwork is constructed. While retaining task-specific features, underlying network parameters are reused at a preset ratio to mine implicit correlations between different prediction tasks. By processing multiple industrial indicator prediction tasks (COD and BOD5) in parallel, while ensuring the independence of each task, a cross-task knowledge transfer channel is established using a shared parameter layer, significantly improving the model's generalization ability and multi-task collaboration efficiency in small sample scenarios.
[0159] Example 4
[0160] The embodiment of the present invention also provides another method for generating virtual samples for soft measurement of sewage treatment; this method is implemented on the basis of the method of the above embodiment; this method focuses on describing the specific implementation method for the generator to reach a stable state.
[0161] Figure 4 A flowchart of another method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the sewage treatment soft measurement virtual sample generation method may include the following steps:
[0162] Step S401: Obtain a sewage treatment parameter data set.
[0163] Step S402: Based on a multi-objective optimization function, the initial input data set of the generative adversarial network generator is optimized to generate an initialized population.
[0164] In step S403, the initialized population is input into the generator of the generative adversarial network, and the initial virtual samples and sewage treatment parameter data set output by the generator of the generative adversarial network are input into the discriminator of the generative adversarial network for adversarial training.
[0165] Step S404: Obtain a first virtual sample and a second virtual sample output by a generator of a generative adversarial network.
[0166] The first and second virtual samples are the last two virtual samples output by the generator of the generative adversarial network during adversarial training. Specifically, during adversarial training, the generator continuously generates virtual samples. The virtual samples output during the last two training sessions are collected and generated, and are referred to as the first and second virtual samples, respectively.
[0167] Step S405 , calculating the maximum average difference between the first virtual sample and the second virtual sample.
[0168] The Maximum Mean Difference (MMD) is a metric used to measure the difference between two distributions. By calculating the MMD between the first and second virtual samples, we can assess the stability of the generator when outputting two consecutive virtual samples. Smaller MMD values indicate more similar distributions between the two virtual samples, and more stable generator outputs. Larger MMD values indicate greater disparity between the distributions of the two virtual samples, and greater fluctuations in the generator output.
[0169] For example, the maximum average difference can be calculated by the following formula:
[0170]
[0171] Where x represents the first virtual sample, y represents the second virtual sample, and E represents the expected value. represents the Euclidean norm.
[0172] Step S406: When the maximum average difference is less than the difference threshold, it is determined that the generator has reached a stable state.
[0173] A difference threshold is pre-set. When the calculated maximum average difference between the first virtual sample and the second virtual sample is less than the threshold, the generator output is considered stable, that is, when the generator outputs virtual samples twice in a row, the difference in the generated sample distribution is small, and the generator performance has reached a certain stability. If the calculated maximum average difference between the first virtual sample and the second virtual sample is greater than or equal to the threshold, the generator output is considered unstable, that is, when the generator outputs virtual samples twice in a row, the difference in the generated sample distribution is large, the generator performance has not reached stability, and further training is required, and the process returns to step S403.
[0174] Furthermore, the laundry virtual sample and the second virtual sample may be obtained multiple times, and when the maximum average difference between the first virtual sample and the second virtual sample obtained twice in a row is less than a preset threshold, it is determined that the generator has reached a stable state.
[0175] Step S407: The virtual sample outputted by the generator after reaching a stable state is used as the virtual sample corresponding to the sewage treatment parameter data set.
[0176] Step S408: input the virtual samples into the sewage treatment soft measurement model, train the sewage treatment soft measurement model, and obtain a trained sewage treatment soft measurement model.
[0177] The sewage treatment soft-sensor model is used to predict sewage treatment result parameters based on sewage treatment process parameters. Specifically, the sewage treatment process parameters from the virtual samples are used as input to the sewage treatment soft-sensor model. The predicted sewage treatment result parameters are then compared with the sewage treatment result parameters from the virtual samples to determine the error between the two. Based on this error, it is determined whether the sewage treatment soft-sensor model has been trained. If the error between the two is less than a preset error, training is considered complete; otherwise, training continues. Furthermore, the virtual samples can be divided into a training set and a validation set to train the sewage treatment soft-sensor model. Typically, the training set to validation set ratio is 8:2 or 7:3.
[0178] Furthermore, the sewage treatment soft-sensing model is a neural network model built on a multilayer perceptron. The modeling process is described as follows: Step 1: Determine the original training samples for the multilayer perceptron, namely the sewage treatment parameter dataset. The virtual sample set is merged with the original training samples to form an expanded training sample set. Step 2: Use the mean squared error (MSE) as the loss function to minimize the difference between the predicted value and the true value, thereby establishing a regression model. Specifically, based on the expanded training sample set and the MSE loss function, the multilayer perceptron is trained using the backpropagation algorithm. The backpropagation algorithm calculates the gradient of the loss function with respect to each parameter in the network and propagates the gradient back through the network, updating the network parameters (weights and biases). The model is continuously adjusted to reduce the loss function value, thereby establishing a regression model that can accurately predict key sewage treatment water quality indicators. Step 3: Determine the hyperparameters of the multilayer perceptron, including the number of neurons and the learning rate.
[0179] In an embodiment of the present invention, the multi-layer perceptron architecture consists of three hidden layers, each of which contains 64, 32 and 16 neurons respectively, and an output layer containing each neuron. All hidden layers use the ReLU activation function, while the output layer uses a linear activation function to adapt to the regression model. In order to ensure the stable convergence of the sewage treatment soft measurement model, the weights are initialized using the Xavier method. The Xavier initialization method randomly initializes the weights according to certain rules based on the number of inputs and outputs of neurons, so that the variance of the activation values and gradients of each layer remains stable during the network training process, avoiding gradient explosion or disappearance due to improper weight initialization, thereby improving the stability and convergence speed of model training. During the training process, the Adam optimizer is used and the learning rate is set to 0.001. By setting a batch size of 16 and 200 training cycles, the computational efficiency and generalization performance of the training process are balanced.
[0180] The method for generating virtual samples for soft measurement of sewage treatment provided by an embodiment of the present invention determines whether the generator has reached a stable state by calculating the maximum mean difference (MMD) between two consecutive virtual samples output by the generator and comparing it with the difference threshold. This method can effectively measure whether the output of the generator has converged to a stable state, avoid over-training or under-training of the generator, and ensure that the generated virtual samples have good stability and consistency. After the generator reaches a stable state, the virtual samples output by it are obtained as virtual samples corresponding to the sewage treatment parameter data set. These virtual samples can better reflect the characteristics and distribution of the original data set. It can provide more accurate data support for the simulation, prediction, optimization, etc. of the sewage treatment process, help improve the performance of related models and algorithms, and thus improve the efficiency and quality of sewage treatment.
[0181] Example 5
[0182] Corresponding to the above method embodiment, the embodiment of the present invention provides a sewage treatment soft measurement virtual sample generation device, Figure 5 A schematic diagram of a virtual sample generation device for soft measurement of sewage treatment provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the sewage treatment soft measurement virtual sample generation device may include:
[0183] The data acquisition module 501 is used to acquire a sewage treatment parameter data set; wherein the sewage treatment parameter data set includes sewage treatment process parameters and at least one sewage treatment result parameter;
[0184] An initialization population acquisition module 502 is configured to optimize an initial input data set of a generative adversarial network generator based on a multi-objective optimization function to generate an initialization population; wherein the multi-objective optimization function includes a coverage index function and a discretization index function;
[0185] The virtual sample acquisition module 503 is used to input the initialized population into the generator of the generative adversarial network, input the initial virtual samples and the sewage treatment parameter data set output by the generator of the generative adversarial network into the discriminator of the generative adversarial network, perform adversarial training, and obtain the virtual samples output after the generator reaches a stable state as the virtual samples corresponding to the sewage treatment parameter data set; wherein, the adversarial training refers to multi-task joint training implemented for each of the sewage treatment result parameters.
[0186] The embodiment of the present invention provides a device for generating virtual samples for soft measurement of sewage treatment. This device generates an initialization population through a multi-objective optimization function, takes data coverage and discreteness as optimization targets, and considers multiple factors to ensure that the generated virtual samples can better reflect the complex characteristics of the sewage treatment process, thereby enabling the soft measurement model to better adapt to the actual sewage treatment process. This device solves the technical bottlenecks of gradient vanishing and mode collapse in generative adversarial networks, ensures the intrinsic structural consistency of virtual samples with sewage treatment parameter datasets, and improves the accuracy of virtual samples. By integrating and acquiring the original sensor datasets collected during the sewage treatment process, the device focuses on constructing a high-quality input dataset that conforms to the characteristics of industrial scenarios. Preprocessing operations such as data interpolation, variable conversion, and adding disturbances are performed on the raw data in the sensor raw datasets, aiming to solve the problems of high noise and uneven distribution of raw data and improve the data representation capability and integrity.
[0187] In some embodiments, the initialization population acquisition module 502 is further configured to:
[0188] Create an initial set of input data that follows a normal distribution;
[0189] According to the covering index function and the discretization index function, the covering index and the discretization index corresponding to each parent individual in the initial input data set are calculated;
[0190] The parent individuals are screened according to the coverage index and discretization index corresponding to each parent individual to obtain the parent population;
[0191] Generate the offspring population corresponding to the parent population based on the simulated binary crossover operator;
[0192] According to the covering index function and the discretization index function, the covering index and the discretization index corresponding to each offspring individual in the offspring population are calculated;
[0193] When the coverage index corresponding to each offspring individual meets the coverage threshold and the discretization index meets the discrete threshold, a preset number of individuals are selected from the parent population and the offspring population as the initialization population based on the Pareto dominance relationship.
[0194] In some embodiments, generating a child population corresponding to a parent population based on a simulated binary crossover operator includes:
[0195] Obtain two parent individuals from the parent population in sequence according to the preset order;
[0196] Input the parent individuals into the simulated binary crossover operator to obtain two offspring individuals until all parent individuals are traversed;
[0197] The obtained offspring individuals are composed of the offspring population.
[0198] In some embodiments, the sewage treatment parameter data set includes sewage treatment process parameters and sewage treatment result parameters, and the number of sewage treatment result parameters is at least one.
[0199] In some embodiments, the virtual sample acquisition module 503 is further configured to:
[0200] For each sewage treatment result parameter, establish a training subtask as the subtask corresponding to the sewage treatment result parameter;
[0201] For each subtask, generate the parameter mask of the generator in the subtask;
[0202] For each subtask, perform element-wise multiplication based on the preset initialized base network and parameter mask to construct the subnetwork corresponding to the generator of the generative adversarial network in the subtask;
[0203] For each subtask, prune the parameter mask of the generator of the generative adversarial network in the subtask according to the preset pruning rate to obtain the pruned parameter mask of the generator in the subtask;
[0204] For each subtask, when the sharing rate of the pruned parameter mask of the generator of the GAN in the subtask is less than or equal to the sharing rate threshold, the pruned parameter mask of the generator in the subtask is input into the generator of the GAN in the subtask, and the generator of the GAN in the subtask is updated to obtain the updated generator of the GAN in the subtask;
[0205] For each subtask, the initialized population is input into the updated generator of the generative adversarial network corresponding to the sewage treatment result parameters, and the initial virtual samples, sewage treatment process parameters and sewage treatment result parameters output by the updated generator of the generative adversarial network are input into the discriminator of the generative adversarial network corresponding to the sewage treatment result parameters for adversarial training.
[0206] In some embodiments, the virtual sample acquisition module 503 is further configured to:
[0207] Obtain a first virtual sample and a second virtual sample output by a generator of a generative adversarial network; wherein the first virtual sample and the second virtual sample are the last two virtual samples output by the generator of the generative adversarial network during adversarial training;
[0208] calculating the maximum average difference between the first virtual sample and the second virtual sample;
[0209] When the maximum average difference is less than the difference threshold, the generator is determined to have reached a stable state.
[0210] In some embodiments, the apparatus further comprises:
[0211] The model training module is used to input virtual samples into the sewage treatment soft measurement model, train the sewage treatment soft measurement model, and obtain the trained sewage treatment soft measurement model. The sewage treatment soft measurement model is used to predict sewage treatment result parameters based on sewage treatment process parameters; wherein, the sewage treatment soft measurement model is a neural network model constructed based on a multi-layer perceptron.
[0212] The device provided in the embodiment of the present invention has the same implementation principle and technical effects as those in the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference can be made to the corresponding content in the aforementioned method embodiment.
[0213] Example 6
[0214] The embodiment of the present invention further provides an electronic device for executing the above-mentioned method for generating virtual samples of soft measurement for sewage treatment; Figure 6 A structural diagram of an electronic device is shown, which includes a memory 600 and a processor 601, wherein the memory 600 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 601 to implement the above-mentioned sewage treatment soft measurement virtual sample generation method.
[0215] Further, Figure 6 The electronic device shown further includes a bus 602 and a communication interface 603 , and the processor 601 , the communication interface 603 and the memory 600 are connected via the bus 602 .
[0216] The memory 500 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 603 (which may be wired or wireless), and may use the Internet, a wide area network, a local area network, a metropolitan area network, etc. The bus 602 may be an ISA bus, a PCI bus, or an EISA bus. Buses can be divided into address buses, data buses, control buses, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0217] The processor 601 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 601 or by software instructions. The above processor 601 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in memory 600, and processor 601 reads information from memory 500 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.
[0218] An embodiment of the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned sewage treatment soft measurement virtual sample generation method. The specific implementation can be found in the method embodiment and will not be repeated here.
[0219] The computer program product for the method of generating virtual samples for soft measurement of sewage treatment provided in an embodiment of the present invention includes a computer-readable storage medium storing non-volatile program code executable by a processor. The instructions included in the program code can be used to execute the method described in the previous method embodiment. For specific implementation, please refer to the method embodiment and will not be repeated here.
[0220] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0221] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.
[0222] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0223] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0224] If the functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.
[0225] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A method for generating virtual samples for soft measurement of sewage treatment, characterized in that: include: Acquire a sewage treatment parameter data set; wherein the sewage treatment parameter data set includes sewage treatment process parameters and at least one sewage treatment result parameter; Based on a multi-objective optimization function, an initial input data set of a generator in a generative adversarial network is optimized to generate an initialized population; wherein the multi-objective optimization function includes a coverage index function and a discretization index function; For each sewage treatment result parameter, establish a training subtask as the subtask corresponding to the sewage treatment result parameter; For each subtask, generate a parameter mask for the generator in the subtask; For each subtask, perform element-wise multiplication based on the preset initialized base network and the parameter mask to construct a subnetwork corresponding to the generator of the generative adversarial network in the subtask; For each subtask, prune the parameter mask of the generator of the generative adversarial network in the subtask according to a preset pruning rate to obtain a pruned parameter mask of the generator in the subtask; For each subtask, when the sharing rate of the pruned parameter mask of the generator of the generative adversarial network in the subtask is less than or equal to the sharing rate threshold, the pruned parameter mask of the generator in the subtask is input into the generator of the generative adversarial network in the subtask, and the generator of the generative adversarial network in the subtask is updated to obtain the updated generator of the generative adversarial network in the subtask; For each subtask, the initialized population is input into the updated generator of the generative adversarial network corresponding to the sewage treatment result parameters, and the initial virtual samples output by the updated generator of the generative adversarial network, the sewage treatment process parameters, and the sewage treatment result parameters are input into the discriminator of the generative adversarial network corresponding to the sewage treatment result parameters to perform adversarial training; wherein, the adversarial training is implemented by guiding the information sharing architecture. After the training is completed, different generators are obtained by training corresponding to each subtask, and the similarity of the parameters between the generators meets a preset threshold. The similarity of the parameters refers to the ratio of the number of identical parameters of any two generators to the total number of parameters of their respective generators; The virtual samples output after the generator reaches a stable state are used as virtual samples corresponding to the sewage treatment parameter data set; wherein, the adversarial training refers to multi-task joint training implemented for each of the sewage treatment result parameters.
2. The method according to claim 1, characterized in that The method optimizes the initial input data of the generative adversarial network generator based on the multi-objective optimization function to generate an initialized population, including: Create an initial set of input data that follows a normal distribution; Calculate the coverage index and discretization index corresponding to each parent individual in the initial input data set according to the coverage index function and the discretization index function; The parent individuals are screened according to the coverage index and the discretization index corresponding to each parent individual to obtain a parent population; Generate a child population corresponding to the parent population based on a simulated binary crossover operator; Calculating the coverage index and the discretization index corresponding to each offspring individual in the offspring population according to the coverage index function and the discretization index function; When the coverage index corresponding to each offspring individual satisfies the coverage threshold and the discretization index satisfies the discrete threshold, a preset number of individuals are selected from the parent population and the offspring population as the initialization population based on the Pareto dominance relationship.
3. The method according to claim 2, characterized in that Generating a child population corresponding to the parent population based on a simulated binary crossover operator, including: Obtaining two parent individuals from the parent population in sequence according to a preset order; Inputting the parent individuals into a simulated binary crossover operator to obtain two offspring individuals, until all parent individuals are traversed; The obtained offspring individuals constitute the offspring population.
4. The method according to claim 1, wherein The generator reaches a stable state, including: Obtain a first virtual sample and a second virtual sample output by the generator of the generative adversarial network; wherein the first virtual sample and the second virtual sample are the last two virtual samples output by the generator of the generative adversarial network during adversarial training; calculating a maximum average difference between the first virtual sample and the second virtual sample; When the maximum average difference is less than a difference threshold, it is determined that the generator reaches a stable state.
5. The method according to claim 1, wherein After inputting the initialized population into the generator of the generative adversarial network, inputting the initial virtual samples output by the generator of the generative adversarial network and the sewage treatment parameter dataset into the discriminator of the generative adversarial network, performing adversarial training, and obtaining virtual samples output by the generator after reaching a stable state as virtual samples corresponding to the sewage treatment parameter dataset, the method further includes: The virtual sample is input into a sewage treatment soft measurement model, and the sewage treatment soft measurement model is trained to obtain a trained sewage treatment soft measurement model. The sewage treatment soft measurement model is used to predict the sewage treatment result parameters based on the sewage treatment process parameters; wherein the sewage treatment soft measurement model is a neural network model constructed based on a multi-layer perceptron.
6. A sewage treatment soft measurement virtual sample generation device, characterized in that: include: A data acquisition module, configured to acquire a sewage treatment parameter data set, wherein the sewage treatment parameter data set includes sewage treatment process parameters and at least one sewage treatment result parameter; An initialization population acquisition module is used to optimize the initial input data set of the generative adversarial network generator based on a multi-objective optimization function to generate an initialization population; wherein the multi-objective optimization function includes a coverage index function and a discretization index function; A virtual sample acquisition module is used to establish a training subtask for each sewage treatment result parameter as a subtask corresponding to the sewage treatment result parameter; for each subtask, a parameter mask of the generator in the subtask is generated; for each subtask, an element multiplication operation is performed according to a preset initialization basic network and the parameter mask to construct a subnetwork corresponding to the generator of the generative adversarial network in the subtask; for each subtask, the parameter mask of the generator of the generative adversarial network in the subtask is pruned according to a preset pruning rate to obtain the pruned parameter mask of the generator in the subtask; for each subtask, when the sharing rate of the pruned parameter mask of the generator of the generative adversarial network in the subtask is less than or equal to the sharing rate threshold, the pruned parameter mask of the generator in the subtask is input into the generator of the generative adversarial network in the subtask, and the generator of the generative adversarial network in the subtask is updated to obtain the generative adversarial network in the subtask. the updated generator of the generative adversarial network; for each subtask, the initialized population is input into the updated generator of the generative adversarial network corresponding to the sewage treatment result parameters, and the initial virtual samples output by the updated generator of the generative adversarial network, the sewage treatment process parameters and the sewage treatment result parameters are input into the discriminator of the generative adversarial network corresponding to the sewage treatment result parameters for adversarial training; wherein, the adversarial training is implemented by guiding the information sharing architecture. After the training is completed, different generators are obtained through training corresponding to each of the subtasks, and the similarity of the parameters between the generators meets the preset threshold. The similarity of the parameters refers to the ratio of the number of the same parameters of any two generators to the total number of parameters of their respective generators; the virtual samples output after the generator reaches a stable state are used as the virtual samples corresponding to the sewage treatment parameter data set; wherein, the adversarial training refers to the multi-task joint training implemented for each of the sewage treatment result parameters.
7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for generating virtual samples for soft measurement of sewage treatment according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the method for generating virtual samples for soft measurement of sewage treatment according to any one of claims 1 to 5.
Citation Information
Patent Citations
A multi-grade chemical process soft sensor modeling method automatically generating samples
CN109002686A
Intelligent risk control system for financial fraud detection based on generative adversarial network
CN119941390A