Water purifier filter element loss prediction method based on confrontation strategy
By constructing a water purifier filter element loss prediction model for the Transformer network and the generated adversarial network, the problem of failure to fully consider the spatiotemporal relationship in the existing technology is solved, and a more accurate and robust filter element loss prediction is achieved.
Patent Information
- Application Number
- CN202510441385.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-04-09
AI Technical Summary
The existing water purifier filter life prediction method based on the mirror symmetric adversarial network model fails to fully consider the spatiotemporal relationship between various factors affecting the life of the water purifier filter element, resulting in inaccurate prediction of filter element loss.
Using the water purifier filter element loss prediction method based on adversarial strategy, a prediction model composed of Transformer network and generative adversarial network is constructed. Through time series data training and verification, the self-attention mechanism is used to capture the spatiotemporal relationship, and the prediction results are optimized by generation adversarial network.
It realizes more accurate water purifier filter element loss prediction, improves the accuracy and robustness of prediction, and can effectively deal with complex environmental changes.
Smart Images

Figure CN120387361A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of predicting the loss of water purifier filters, and specifically to a method for predicting the loss of water purifier filters based on an adversarial strategy. Background Art
[0002] Water purification equipment, with its advantage of effectively removing harmful substances in water, has become an important tool for improving water quality. There are a wide variety of water purifiers on the current market, including reverse osmosis (RO) water purifiers, activated carbon filters, etc. These devices remove impurities and harmful substances in water through different filtration technologies. However, the performance of water purifiers and the drinking water safety of users largely depend on the degree of filter loss. Accurately predicting the loss of filters has become the key to improving the overall performance of water purifiers.
[0003] The prior art discloses a method for predicting the remaining life of the filter of an intelligent water purifier. Specifically, by obtaining the operation data and filter state data of the intelligent water purifier, and inputting these data into a mirror symmetric adversarial network model for prediction. However, the mirror symmetric adversarial network model does not fully consider the spatio-temporal relationship between various factors affecting the life of the water purifier filter during the prediction process. The loss of the filter is not only related to the current operation data and state data, but may also be affected by historical data, environmental factors, and complex dynamic changes caused by uncertainty. Therefore, simply relying on the mirror symmetric adversarial network model for prediction may not be able to comprehensively and accurately reflect the actual loss situation of the filter. Summary of the Invention
[0004] Aiming at the above defects, the present invention proposes a method for predicting the loss of water purifier filters based on an adversarial strategy, aiming to solve the problem that in the existing method for predicting the life of water purifier filters based on the mirror symmetric adversarial network model, the mirror symmetric adversarial network model does not fully consider the spatio-temporal relationship between various factors affecting the life of the water purifier filter during the prediction process, resulting in the possibility that the actual loss situation of the filter may not be comprehensively and accurately reflected.
[0005] To achieve this purpose, the present invention adopts the following technical solutions:
[0006] A method for predicting the loss of water purifier filters based on an adversarial strategy, comprising the following steps:
[0007] Step S1: Collect data related to the degree of loss of the water purifier filter and determine the loss rate of the water purifier filter, organize the data related to the degree of loss of the water purifier filter into time series data, construct a data set from the time series data and the loss rate of the water purifier filter, and divide the data set into a training set and a validation set;
[0008] Step S2: Construct a prediction model for the loss of the water purifier filter element. The prediction model for the loss of the water purifier filter element consists of a Transformer network and a generative adversarial network;
[0009] Step S3: Input the training set into the Transformer network for training, output the first prediction value, and generate random noise by adjusting the parameters of the Gaussian function;
[0010] Step S4: Input the first prediction value and the random noise into the generative adversarial network for training to obtain the trained prediction model for the loss of the water purifier filter element;
[0011] Step S5: Use the validation set to validate the trained prediction model for the loss of the water purifier filter element to obtain the validated prediction model for the loss of the water purifier filter element;
[0012] Step S6: Predict the loss of the water purifier filter element according to the validated prediction model for the loss of the water purifier filter element.
[0013] Preferably, in step S1, it specifically includes the following sub-steps:
[0014] Step S11: Collect data related to the loss degree of the water purifier filter element. The data related to the loss degree of the water purifier filter element includes fluid data, historical data, and environmental condition data. The fluid data includes the flow rate of the fluid, the temperature of the fluid, the total dissolved solid value of the fluid, the pollutant concentration of the fluid, and the residual chlorine concentration of the fluid. The historical data includes the characteristic data of the PP cotton filter element, the characteristic data of the activated carbon filter element, and the characteristic data of the RO membrane filter element. The environmental condition data includes the humidity of the environment and the temperature change of the environment;
[0015] Step S12: Determine the loss rate of the water purifier filter element according to the change in the water flow rate. The specific calculation formula is as follows:
[0016]
[0017] where y t represents the loss rate of the water purifier filter element at the t-th moment; Q0 represents the initial water flow rate; Q’ represents the water flow rate after loss;
[0018] Step S13: Organize the data related to the loss degree of the water purifier filter element into time-series data. The mathematical expression of the time-series data related to the loss degree of the water purifier filter element is as follows:
[0019] x t =[Q t , T t , TDS t , C t , L t , P t , AC t, RO t , H t , ΔT t ;
[0020] Among them, x t represents the time-series data related to the loss degree of the water purifier filter element at the t-th moment; Q t represents the flow rate of the fluid at the t-th moment; T t represents the temperature of the fluid at the t-th moment; TDS t represents the total dissolved solids value of the fluid at the t-th moment; C t represents the pollutant concentration of the fluid at the t-th moment; L t represents the residual chlorine concentration of the fluid at the t-th moment; P t represents the characteristic data of the PP cotton of the filter element at the t-th moment; AC t represents the characteristic data of the activated carbon of the filter element at the t-th moment; RO t represents the characteristic data of the RO membrane of the filter element at the t-th moment; H t represents the humidity of the environment at the t-th moment; ΔT t represents the temperature change of the environment at the t-th moment;
[0021] Step S14: Perform standardization processing on the time-series data related to the loss degree of the water purifier filter element to obtain the standardized time-series data x tnorm , and the specific calculation formula is as follows:
[0022]
[0023] Among them, min(x t ) represents the minimum value of the time-series data related to the loss degree of the water purifier filter element at the t-th moment; max(x t ) represents the maximum value of the time-series data related to the loss degree of the water purifier filter element at the t-th moment;
[0024] Step S15: Convert the standardized time-series data x tnorm into an input with a fixed window size of 7;
[0025] Step S16: Construct the input with a fixed window size of 7 and the loss rate y of the water purifier filter element t into a data set, and divide the data set into a training set and a validation set according to the ratio of 8:2.
[0026] Preferably, in step S2, the Transformer network includes an input layer, a self-attention mechanism layer, a feed-forward neural network layer, and an output layer;
[0027] In step S3, input the training set into the Transformer network for training and output the first prediction value, which specifically includes the following sub-steps:
[0028] Step S31: Input the training set into the input layer for conversion into a high-dimensional vector suitable for processing by the Transformer network.
[0029] Step S32: Input the high-dimensional vector suitable for processing by the Transformer network into the self-attention mechanism layer to calculate the interrelationships between different time steps in the time-series data.
[0030] Step S33: Input the output of the self-attention mechanism layer into the feed-forward neural network layer for processing.
[0031] Step S34: Input the output of the feed-forward neural network layer into the output layer for processing and output the first predicted value.
[0032] Preferably, in step S3, during the process of training the Transformer network, the following steps are further included: calculating the loss function of the Transformer network by introducing weighted absolute error and loss trend penalty, and minimizing the loss function of the Transformer network, where the calculation formula of the loss function of the Transformer network is as follows:
[0033] L Transformer = λ1L WAE + λ2L trend ;
[0034] where, L Transformer represents the loss function of the Transformer network; both λ1 and λ2 represent hyperparameters and are both used to control the importance of each part of the loss function;
[0035] L WAE represents the weighted absolute error, and the specific mathematical formula is as follows:
[0036]
[0037] where, N represents the number of days; ω t represents the weight at the t-th moment; y t ′ represents the true filter element loss value at the t-th moment; represents the predicted filter element loss value at the t-th moment;
[0038] L trend represents the loss trend penalty, and the specific mathematical formula is as follows:
[0039]
[0040] where, represents the predicted filter element loss value at the (t + 1)-th moment; represents the predicted filter element loss value at the (t - 1)-th moment.
[0041] Preferably, in step S2, the generative adversarial network includes a generator and a discriminator;
[0042] In step S4, it specifically includes the following sub-steps:
[0043] Step S41: Combine the first predicted value and the random noise to form the input value G input , and input G input into the generator for processing, and output the second predicted value y generated , and the specific calculation formula is as follows:
[0044] y generated = ConvTranspose(G input );
[0045] where ConvTranspose(x) represents a convolutional neural network;
[0046] Step S42: Collect the true filter element loss value y ture , and input y tre and y generated into the discriminator for processing, and judge whether the input sample is real data or generated data according to the output value D output of the discriminator. If D output is 1, it means that the input sample is real data. If D output is 0, it means that the input sample is generated data. Among them, D output the specific calculation formula is as follows:
[0047] D output = σ(ConvTranspose(y ture , y generated ));
[0048] where σ(x) represents the Sigmoid function.
[0049] Preferably, in step S4, during the training of the generative adversarial network, the following steps are further included:
[0050] Calculate the loss function L adv of the generator, and minimize the loss function L adv of the generator. Among them, L adv the specific calculation formula is as follows:
[0051] L adv = -E(logB(G input ));
[0052] where E(x) represents the mathematical expectation, and B(x) represents a binary classification convolutional network;
[0053] Calculate the loss function L of the discriminator dis and maximize the loss function L of the discriminator dis where L dis The specific calculation formula is as follows:
[0054] L dis =-E(logB(y ture ))-E(log(1 - B(G input ))).
[0055] Preferably, in step S5, during the process of validating the trained water purifier filter element loss prediction model using the validation set, the following steps are further included: adopting evaluation indicators such as mean absolute error, coefficient of determination, and loss trend penalty to evaluate the performance of the trained water purifier filter element loss prediction model.
[0056] The technical solution provided by the embodiment of the present application may include the following beneficial effects:
[0057] In this solution, a water purifier filter element loss prediction model composed of a transformer network and a generative adversarial network is constructed, and the model is trained and validated using time series data related to the loss degree of the water purifier filter element and the loss rate of the water purifier filter element, and the validated model is used for predicting the loss of the water purifier filter element. Compared with the existing prediction method based on the mirror symmetry adversarial network model, the self-attention mechanism of the transformer network is adopted in the water purifier filter element loss prediction model of this solution, fully considering the data time series and spatial relationships, so as to achieve more accurate prediction of the water purifier filter element loss. While ensuring the prediction accuracy, the generative adversarial network is adopted as an optimization strategy, enabling the water purifier filter element loss prediction model to effectively cope with complex environmental changes, thereby improving its robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 is a flowchart of the steps of a water purifier filter element loss prediction method based on an adversarial strategy. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0059] The following details the embodiments of the present invention. The examples of the embodiments are shown in the drawings, wherein the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation of the present invention.
[0060] A water purifier filter element loss prediction method based on an adversarial strategy includes the following steps:
[0061] Step S1: Collect data related to the loss degree of the water purifier filter element and determine the loss rate of the water purifier filter element, organize the data related to the loss degree of the water purifier filter element into time series data, construct the time series data and the loss rate of the water purifier filter element into a data set, and divide the data set into a training set and a validation set;
[0062] Step S2: Construct a prediction model for the loss of the water purifier filter element, where the prediction model for the loss of the water purifier filter element consists of a transformer network and a generative adversarial network;
[0063] Step S3: Input the training set into the Transformer network for training, output the first predicted value, and generate random noise by adjusting the parameters of the Gaussian function;
[0064] Step S4: Input the first predicted value and the random noise into the generative adversarial network for training to obtain the trained prediction model for the loss of the water purifier filter element;
[0065] Step S5: Use the validation set to validate the trained prediction model for the loss of the water purifier filter element to obtain the validated prediction model for the loss of the water purifier filter element;
[0066] Step S6: Predict the loss of the water purifier filter element according to the validated prediction model for the loss of the water purifier filter element.
[0067] A method for predicting the loss of a water purifier filter element based on an adversarial strategy in this solution, as Figure 1As shown, the first step is to collect data related to the wear degree of the water purifier filter element and determine the wear rate of the water purifier filter element, organize the data related to the wear degree of the water purifier filter element into time series data, construct a data set from the time series data and the wear rate of the water purifier filter element, and divide the data set into a training set and a validation set. In this embodiment, the data related to the wear degree of the water purifier filter element includes fluid data, historical data, and environmental condition data. For the wear rate of the water purifier filter element, it is determined based on the change in water flow rate. By organizing the data related to the wear degree of the water purifier filter element into time series data, the spatio-temporal relationship between various factors affecting the life of the water purifier filter element can be captured in subsequent model training. By constructing a data set consisting of time series data and the wear rate of the water purifier filter element and dividing the data set into a training set and a validation set, a data foundation is laid for the subsequent training and validation of the model. The second step is to construct a water purifier filter element wear prediction model. Among them, the water purifier filter element wear prediction model consists of a Transformer network and a generative adversarial network. In this embodiment, the Transformer network is a neural network based on the self-attention mechanism, and the self-attention mechanism can capture the spatial correlation and long-term and short-term dependencies of the input sequence. The generative adversarial network is a deep neural network. Specifically, through the mutual confrontation and game of two neural networks, the purpose of generating realistic samples from random noise is achieved. By constructing a model consisting of a Transformer network and a generative adversarial network, it is beneficial for subsequent water purifier filter element wear prediction. The fourth step is to input the training set into the Transformer network for training, output the first prediction value, and generate random noise by adjusting the parameters of the Gaussian function. In this embodiment, the Transformer network is trained using the training set to complete the first stage of training of the water purifier filter element wear prediction model, so that the water purifier filter element wear prediction model can process time series data. By adjusting the parameters of the Gaussian function to generate random noise, it prepares for the subsequent training of the generative adversarial network. The fifth step is to input the first prediction value and the random noise into the generative adversarial network for training to obtain the trained water purifier filter element wear prediction model. In this embodiment, the generative adversarial network is trained using the first prediction value and the random noise to complete the second stage of training of the water purifier filter element wear prediction model, so that the water purifier filter element wear prediction model optimizes its prediction results. The fifth step is to use the validation set to verify the trained water purifier filter element wear prediction model to obtain the verified water purifier filter element wear prediction model. In this embodiment, by using the validation set to verify the trained water purifier filter element wear prediction model, it is beneficial to detect and evaluate the prediction performance of the water purifier filter element wear prediction model. The sixth step is to predict the wear of the water purifier filter element according to the verified water purifier filter element wear prediction model. In this embodiment, when it is evaluated that the prediction performance of the water purifier filter element wear prediction model is stable, this model can be used to predict the wear of the water purifier filter element, and the predicted wear value is relatively accurate.
[0068] In this solution, a prediction model for the loss of water purifier filter elements is constructed, which consists of a Transformer network and a generative adversarial network. Time series data related to the loss degree of water purifier filter elements and the loss rate of water purifier filter elements are used to train and validate this model, and the validated model is used to predict the loss of water purifier filter elements. Compared with the existing prediction method based on the mirror symmetry adversarial network model, the self-attention mechanism of the Transformer network is adopted in the prediction model of the loss of water purifier filter elements in this solution, fully considering the data time series and spatial relationships, so as to achieve more accurate prediction of the loss of water purifier filter elements. While ensuring the prediction accuracy, the generative adversarial network is adopted as an optimization strategy, enabling the prediction model of the loss of water purifier filter elements to effectively cope with complex environmental changes, thereby improving its robustness.
[0069] Preferably, in step S1, it specifically includes the following sub-steps:
[0070] Step S11: Collect data related to the loss degree of water purifier filter elements. Among them, the data related to the loss degree of water purifier filter elements include fluid data, historical data, and environmental condition data. The fluid data includes the flow rate of the fluid, the temperature of the fluid, the total dissolved solids value of the fluid, the pollutant concentration of the fluid, and the residual chlorine concentration of the fluid. The historical data includes the characteristic data of the PP cotton filter element, the characteristic data of the activated carbon filter element, and the characteristic data of the RO membrane filter element. The environmental condition data includes the humidity of the environment and the temperature change of the environment;
[0071] Step S12: Determine the loss rate of the water purifier filter element according to the change in water flow rate. The specific calculation formula is as follows:
[0072]
[0073] where, y t represents the loss rate of the water purifier filter element at the t-th moment; Q0 represents the initial water flow rate; Q’ represents the water flow rate after loss;
[0074] Step S13: Organize the data related to the loss degree of the water purifier filter element into time series data. Among them, the mathematical expression of the time series data related to the loss degree of the water purifier filter element is as follows:
[0075] x t =[Q t , T t , TDS t , C t , L t , P t , AC t , RO t , H t , ΔT t ;
[0076] Among them, x t represents the time-series data related to the loss degree of the water purifier filter element at the t-th moment; Q t represents the flow rate of the fluid at the t-th moment; T t represents the temperature of the fluid at the t-th moment; TDS t represents the total dissolved solids value of the fluid at the t-th moment; C t represents the pollutant concentration of the fluid at the t-th moment; L t represents the residual chlorine concentration of the fluid at the t-th moment; P t represents the characteristic data of the PP cotton of the filter element at the t-th moment; AC t represents the characteristic data of the activated carbon of the filter element at the t-th moment; RO t represents the characteristic data of the RO membrane of the filter element at the t-th moment; H t represents the humidity of the environment at the t-th moment; ΔT t represents the temperature change of the environment at the t-th moment;
[0077] Step S14: Perform standardization processing on the time-series data related to the loss degree of the water purifier filter element to obtain the standardized time-series data x tnorm , and the specific calculation formula is as follows:
[0078]
[0079] Among them, min(x t ) represents the minimum value of the time-series data related to the loss degree of the water purifier filter element at the t-th moment; max(x t ) represents the maximum value of the time-series data related to the loss degree of the water purifier filter element at the t-th moment;
[0080] Step S15: Convert the standardized time-series data x tnorm into an input with a fixed window size of 7;
[0081] Step S16: Construct the input with a fixed window size of 7 and the loss rate y of the water purifier filter element t into a data set, and divide the data set into a training set and a validation set according to the ratio of 8:2.
[0082] In this embodiment, in step S14, by performing standardization processing on the time-series data related to the loss degree of the water purifier filter element, it is beneficial to ensure that different features in the time-series data have similar scales. In step 15, by converting the standardized time-series data x tnorm into an input with a fixed window size of 7, it is beneficial to ensure that the water purifier filter element loss prediction model can process time-series data. In step S16, by using the input with a fixed window size of 7 and the loss rate y of the water purifier filter element tConstruct a dataset and divide the dataset into a training set and a validation set according to a ratio of 8:2, laying a data foundation for the training and validation of the subsequent water purifier filter element loss prediction model.
[0083] Preferably, in step S2, the Transformer network includes an input layer, a self-attention mechanism layer, a feed-forward neural network layer, and an output layer;
[0084] In step S3, input the training set into the Transformer network for training and output the first prediction value, which specifically includes the following sub-steps:
[0085] Step S31: Input the training set into the input layer for conversion to a high-dimensional vector suitable for processing by the Transformer network;
[0086] Step S32: Input the high-dimensional vector suitable for processing by the Transformer network into the self-attention mechanism layer to calculate the mutual relationship between different time steps in the time series data;
[0087] Step S33: Input the output of the self-attention mechanism layer into the feed-forward neural network layer for processing;
[0088] Step S34: Input the output of the feed-forward neural network layer into the output layer for processing and output the first prediction value.
[0089] In this embodiment, in step S31, the input layer of the Transformer network includes vocabulary embedding or other types of feature embedding, and this embedding can encode the features of each time step into a fixed-dimensional vector representation. In step S32, in the filter element loss prediction task, the self-attention mechanism helps the water purifier filter element loss prediction model capture the dependencies between each time step, that is, the influence of fluid data, historical data, and environmental condition data at different times on the current filter element loss. After passing through the self-attention mechanism layer, the output feature vector contains global time series information for subsequent prediction. In step S33, by inputting the output of the self-attention mechanism layer into the feed-forward neural network layer for processing, the water purifier filter element loss prediction model can process more complex input data. In step S34, by inputting the output of the feed-forward neural network layer into the output layer for processing, the final prediction value can be obtained.
[0090] Preferably, in step S3, during the process of training the Transformer network, the following steps are further included: calculating the loss function of the Transformer network by introducing weighted absolute error and loss trend penalty, and minimizing the loss function of the Transformer network, where the calculation formula of the loss function of the Transformer network is as follows:
[0091] L Transformer = λ1L WAE + λ2L trend ;
[0092] Among them, L Transformer represents the loss function of the Transformer network; both λ1 and λ2 represent hyperparameters, which are both used to control the importance of each part of the loss function;
[0093] L WAE represents the weighted absolute error, and the specific mathematical formula is as follows:
[0094]
[0095] Among them, N represents the number of days; ω t represents the weight at the t-th moment; y t ' represents the true filter element loss value at the t-th moment; represents the predicted filter element loss value at the t-th moment;
[0096] L trend represents the loss trend penalty, and the specific mathematical formula is as follows:
[0097]
[0098] Among them, represents the predicted filter element loss value at the (t + 1)-th moment; represents the predicted filter element loss value at the (t - 1)-th moment.
[0099] In this embodiment, the loss function of the Transformer network is calculated by introducing the weighted absolute error and the loss trend penalty. This loss function can better optimize the training process of the Transformer network. Further explanation, the weighted absolute error enables the Transformer network to more accurately predict those periods that are crucial for the filter element loss, especially when the filter element is about to fail during use. The loss trend penalty makes the loss change output by the Transformer network smoother, avoiding overfitting or unstable phenomena during the training process. By minimizing the loss function of the Transformer network to update the parameters of the Transformer network, the Transformer network can better fit the data.
[0100] Preferably, in step S2, the generative adversarial network includes a generator and a discriminator;
[0101] In step S4, it specifically includes the following sub-steps:
[0102] Step S41: Combine the first predicted value and the random noise to form the input value G input, and input G input into the generator for processing, and output the second predicted value y generated . The specific calculation formula is as follows:
[0103] y generated = ConvTranspose(G input );
[0104] Among them, ConvTranspose(x) represents a convolutional neural network;
[0105] Step S42: Collect the true filter element loss value y ture , and input y tre and y generated into the discriminator for processing, and judge whether the input sample is real data or generated data according to the output value D output of the discriminator. If D output is 1, it means that the input sample is real data. If D output is 0, it means that the input sample is generated data. Among them, D output The specific calculation formula is as follows:
[0106] D output = σ(ConvTranspose(y ture , y generated ));
[0107] Among them, σ(x) represents the Sigmoid function.
[0108] In this embodiment, the generator receives the first predicted value output by the Transformer network and random noise, and generates virtual samples that conform to the loss trend, attempting to imitate the distribution of real data. The setting of the discriminator can judge whether the data input into the discriminator is real data or virtual data generated by the generator.
[0109] Preferably, in step S4, during the process of training the generative adversarial network, the following steps are further included:
[0110] Calculate the loss function L adv of the generator, and minimize the loss function L adv of the generator. Among them, L adv The specific calculation formula is as follows:
[0111] L adv = -E(logB(G input ));
[0112] Among them, E(x) represents the mathematical expectation, and B(x) represents a binary classification convolutional network;
[0113] Calculate the loss function L of the discriminatordis and maximize the loss function L of the discriminator dis , where L dis The specific calculation formula is as follows:
[0114] L dis = -E(logB(y ture )) - E(log(1 - B(G input ))).
[0115] In this embodiment, by minimizing the loss function L of the generator adv , it is beneficial to optimize the generation ability of the generator. By maximizing the loss function L of the discriminator dis , it is beneficial to improve the classification ability of the discriminator for real data and generated data.
[0116] Preferably, in step S5, during the process of validating the trained water purifier filter element loss prediction model using the validation set, the following steps are further included: adopting evaluation indicators such as mean absolute error, coefficient of determination, and loss trend penalty to evaluate the performance of the trained water purifier filter element loss prediction model. In this embodiment, the mean absolute error is used to reflect the accuracy of the model prediction. The coefficient of determination is used to reflect the ability of the model to explain the data variance, helping people understand the effectiveness of the model. The loss trend penalty is used to avoid predictions where the model output is too volatile or does not conform to actual physical laws, ensuring that the loss prediction values show a reasonable change trend.
[0117] In addition, in each embodiment of the present invention, each functional unit can be integrated in a processing module, or each unit can exist physically alone, or two or more units can be integrated in one module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. When the above integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.
[0118] Although the embodiments of the present invention have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for predicting the loss of a water purifier filter element based on an adversarial strategy, characterized in that: Including the following steps: Step S1: Collect data related to the loss degree of the water purifier filter element and determine the loss rate of the water purifier filter element, organize the data related to the loss degree of the water purifier filter element into time series data, construct a data set with the time series data and the loss rate of the water purifier filter element, and divide the data set into a training set and a validation set; Step S2: Construct a water purifier filter element loss prediction model, where the water purifier filter element loss prediction model consists of a Transformer network and a generative adversarial network; Step S3: Input the training set into the Transformer network for training, output a first prediction value, and generate random noise by adjusting the parameters of the Gaussian function; Step S4: Input the first prediction value and the random noise into the generative adversarial network for training to obtain a trained water purifier filter element loss prediction model; Step S5: Use the validation set to validate the trained water purifier filter element loss prediction model to obtain a validated water purifier filter element loss prediction model; Step S6: Predict the loss of the water purifier filter element according to the validated water purifier filter element loss prediction model.
2. The method for predicting the loss of a water purifier filter element based on an adversarial strategy according to claim 1, wherein: In step S1, it specifically includes the following sub-steps: Step S11: Collect data related to the loss degree of the water purifier filter element, where the data related to the loss degree of the water purifier filter element includes fluid data, historical data, and environmental condition data. The fluid data includes the flow rate of the fluid, the temperature of the fluid, the total dissolved solids value of the fluid, the pollutant concentration of the fluid, and the residual chlorine concentration of the fluid. The historical data includes the characteristic data of the PP cotton filter element, the characteristic data of the activated carbon filter element, and the characteristic data of the RO membrane filter element. The environmental condition data includes the humidity of the environment and the temperature change of the environment; Step S12: Determine the loss rate of the water purifier filter element according to the change in water flow rate. The specific calculation formula is as follows: where y t represents the loss rate of the water purifier filter element at the t-th moment; Q0 represents the initial water flow rate; Q’ represents the water flow rate after loss; Step S13: Organize the data related to the loss degree of the water purifier filter element into time series data. The mathematical expression of the time series data related to the loss degree of the water purifier filter element is as follows: x t = [Q t , T t , TDS t , C t , L t , P t , AC t , RO t , H t , ΔT t ; Among them, x t represents the time-series data related to the loss degree of the water purifier filter element at the t-th moment; Q t represents the flow rate of the fluid at the t-th moment; T t represents the temperature of the fluid at the t-th moment; TDS t represents the total dissolved solids value of the fluid at the t-th moment; C t represents the pollutant concentration of the fluid at the t-th moment; L t represents the residual chlorine concentration of the fluid at the t-th moment; P t represents the characteristic data of the PP cotton of the filter element at the t-th moment; AC t represents the characteristic data of the activated carbon of the filter element at the t-th moment; RO t represents the characteristic data of the RO membrane of the filter element at the t-th moment; H t represents the humidity of the environment at the t-th moment; ΔT t represents the temperature change of the environment at the t-th moment; Step S14: Standardize the time series data related to the loss degree of the water purifier filter element to obtain the standardized time series data x tnorm , and the specific calculation formula is as follows: where min(x t ) represents the minimum value of the time-series data related to the loss degree of the water purifier filter element at the t-th moment; max(x t ) represents the maximum value of the time-series data related to the loss degree of the water purifier filter element at the t-th moment; Step S15: Convert the standardized time series data x tnorm into an input with a fixed window size of 7; Step S16: Construct a data set with the input of a fixed window size of 7 and the loss rate y of the water purifier filter element t and divide the data set into a training set and a validation set in a ratio of 8:
2.
3. A method for predicting the loss of a water purifier filter element based on an adversarial strategy according to claim 1, characterized in that: In step S2, the Transformer network includes an input layer, a self-attention mechanism layer, a feed-forward neural network layer, and an output layer; In step S3, inputting the training set into the Transformer network for training and outputting the first prediction value specifically includes the following sub-steps: Step S31: Input the training set into the input layer for conversion to a high-dimensional vector suitable for processing by the Transformer network; Step S32: Input the high-dimensional vector suitable for processing by the Transformer network into the self-attention mechanism layer to calculate the mutual relationship between different time steps in the time series data; Step S33: Input the output of the self-attention mechanism layer into the feed-forward neural network layer for processing; Step S34: Input the output of the feed-forward neural network layer into the output layer for processing to output the first prediction value.
4. A method for predicting the loss of a water purifier filter element based on an adversarial strategy according to claim 3, characterized in that: In step S3, during the process of training the Transformer network, the following steps are further included: calculating the loss function of the Transformer network by introducing weighted absolute error and loss trend penalty, and minimizing the loss function of the Transformer network, where the calculation formula of the loss function of the Transformer network is as follows: L Transformer = λ1L WAE + λ2L trend ; Among them, L Transformer represents the loss function of the Transformer network; both λ1 and λ2 represent hyperparameters, which are both used to control the importance of each part of the loss function; L WAE represents the weighted absolute error, and the specific mathematical formula is as follows: Among them, N represents the number of days; ω t represents the weight at the t-th moment; y t ' represents the true filter element loss value at the t-th moment; represents the predicted filter element loss value at the t-th moment; L trend Indicates the loss trend penalty, specifically, the mathematical formula is as follows: Among them, represents the predicted filter element loss value at the (t + 1)-th moment; represents the predicted filter element loss value at the (t - 1)-th moment.
5. A method for predicting the loss of a water purifier filter element based on an adversarial strategy according to claim 1, characterized in that: In step S2, the generative adversarial network includes a generator and a discriminator; In step S4, it specifically includes the following sub-steps: Step S41: Combine the first prediction value and random noise to form an input value G input , and input G input into the generator for processing, and output a second prediction value y generated . The specific calculation formula is as follows: y generated = ConvTranspose(G input ); Among them, ConvTranspose(x) represents a convolutional neural network; Step S42: Collect the true filter element loss value y ture , and input y ture and y generated into the discriminator for processing, and based on the output value D output of the discriminator, determine whether the input sample is real data or generated data. If D output is 1, it indicates that the input sample is real data. If D output is 0, it indicates that the input sample is generated data. Among them, the specific calculation formula of D output is as follows: D output = σ(ConvTranspose(y ture , y generated )); Among them, σ(x) represents the Sigmoid function.
6. A method for predicting the loss of a water purifier filter element based on an adversarial strategy according to claim 5, characterized in that: In step S4, during the process of training the generative adversarial network, the following steps are further included: Calculate the loss function L of the generator adv and minimize the loss function L of the generator adv where L adv The specific calculation formula is as follows: L adv = -E(logB(G input )); Among them, E(x) represents the mathematical expectation, and B(x) represents a binary classification convolutional network; Calculate the loss function \(L\) of the discriminator dis and maximize the loss function \(L\) of the discriminator dis where \(L\) dis The specific calculation formula is as follows: L dis = -E(logB(y ture )) - E(log(1 - B(G input )))。 7. A method for predicting the loss of a water purifier filter element based on an adversarial strategy according to claim 1, characterized in that: In step S5, during the process of validating the trained water purifier filter element loss prediction model using the validation set, the following steps are further included: Adopt evaluation indicators of mean absolute error, coefficient of determination, and loss trend penalty to evaluate the performance of the trained water purifier filter element loss prediction model.
Citation Information
Patent Citations
Heat supply energy consumption cycle prediction method based on generative adversarial network
CN113947186A
Online car-hailing demand prediction method based on Transform and generative adversarial network
CN118154240A
Short-term electric power prediction method, system and device and medium
CN118232340A
Intelligent water purifier on-line control and adjustment method and device and computing equipment
CN118718525A
Transform-based abnormal index prediction method for water-turbine generator set
CN119150063A
Cited By
Environment simulation model training method and device, sewage treatment method, equipment and medium
CN121638329A