Water quality prediction method and device, computer equipment and storage medium
By using data augmentation and dense vector conversion technology, combined with time and operating condition information, the accuracy and stability of the water quality prediction model are improved, the problem of insufficient model training in existing technologies is solved, and efficient water quality detection and resource conservation are achieved.
Patent Information
- Application Number
- CN202511261487.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-05
- Publication Date
- 2025-10-17
AI Technical Summary
Existing technologies ignore modal features such as time and operating conditions in water quality prediction, resulting in low model training accuracy, easy overfitting, and insufficient water quality sampling data, which affects the timeliness of detection and wastes resources.
Through data augmentation technology, random numbers with uniform distribution of [-σ,σ] are generated, combined with historical time information and water quality data, and converted into dense vectors. Deep learning model is used for training, and different weight coefficients are set to improve the generalization ability and accuracy of the model.
It improves the accuracy of water quality prediction, reduces the waste of testing resources, realizes timely water quality testing and drug addition, and ensures production stability.
Smart Images

Figure CN120804601A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of water quality detection, and in particular to a water quality prediction method and device, computer equipment and a storage medium. BACKGROUND
[0002] In process industries such as chemical, power, steel, papermaking, textile and semiconductor, the change of water quality will directly affect the process stability of production system, the corrosion resistance of equipment and the energy conversion efficiency. In the field of chemical or semiconductor, ion impurities in ultrapure water may cause reaction out of control or precision component fouling; in the power or steel industry, the corrosive substances in circulating cooling water will accelerate the corrosion of the pipeline, resulting in the decrease of heat exchange efficiency; in the papermaking or textile process, the deposition of suspended solids in water will block the filtration system, increasing energy consumption and maintenance cost.
[0003] Some water quality indicators, such as pH value and conductivity, can be monitored in real time by sensors, but water quality indicators such as bacteria, turbidity and metal ion content cannot be detected in real time by sensors. At present, the common method is to detect and add chemicals regularly. However, the change of water quality is nonlinear, sometimes the change is relatively stable, at this time frequent detection will cause waste of resources; sometimes the change is relatively fast, at this time if the detection and addition of chemicals cannot be timely, it may cause irreversible impact on production. Therefore, a method for accurately predicting water quality indicator values is needed, so as to facilitate timely detection of water quality. SUMMARY
[0004] Therefore, in order to overcome the shortcomings of the prior art, the present application provides a water quality prediction method, device, computer equipment and storage medium, which can accurately predict the water quality, thereby reducing the waste of detection resources and timely detecting and adding chemicals to the water quality exceeding the standard.
[0005] In order to achieve the above purpose, the present application provides a water quality prediction method, comprising: receiving historical water quality data, the historical water quality data at least containing historical time information and historical water quality value; data augmentation is performed on the historical water quality value, and the historical time information is combined to construct augmented data corresponding to the historical water quality data; the augmented data and the historical water quality data are converted into dense vectors to construct a data set; the data set of the dense vector is learned and trained to obtain a water quality test model; the to-be-predicted time information is converted into a dense vector and input into the water quality test model to output the corresponding predicted water quality value.
[0006] In one of the embodiments, the data augmentation on the historical water quality values, combined with the historical time information, constructs augmented data corresponding to the historical water quality data, comprising: generating a plurality of groups of random numbers subject to [-σ, σ] uniform distribution according to the measurement error σ of collecting the historical water quality values; adding the random numbers and the historical water quality values respectively, combined with the historical time information to obtain augmented data.
[0007] In one of the embodiments, the conversion of the augmented data and the historical water quality data into dense vectors, and the construction of a data set, comprising: converting various category information in the historical time information into first numerical type vectors respectively; converting the first numerical type vectors into first dense vectors by using word embedding method; converting the historical water quality values corresponding to various water quality indexes into second vectors; combining the first dense vectors with the corresponding second vectors to generate a data set.
[0008] In one of the embodiments, the historical water quality data further contains historical working condition information, and the conversion of the augmented data and the historical water quality data into dense vectors, and the construction of a data set, further comprising: converting the historical working condition information into third numerical type data; converting the third numerical type data into third dense vectors by using word embedding method; combining the first dense vectors, the third dense vectors with the corresponding second vectors to generate a data set.
[0009] In one of the embodiments, the learning training on the data set of the dense vectors, and obtaining a water quality test model, comprising: dividing the data set of the dense vectors into a training set and a test set; inputting the training set into a deep learning model for training, and setting weight coefficients of augmented data and weight coefficients of the historical water quality data during back propagation respectively, wherein the weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data; testing the learning model obtained by training through the test set to obtain a water quality test model.
[0010] In one of the embodiments, further comprising: analyzing the predicted water quality values, and outputting an analysis result.
[0011] The device for water quality prediction comprises a receiving module for receiving historical water quality data, the historical water quality data at least containing historical time information and historical water quality values; an augmenting module for data augmenting the historical water quality values, combining the historical time information to construct augmented data corresponding to the historical water quality data; a vector conversion module for converting the augmented data and the historical water quality data into dense vectors to construct a data set; a training module for learning and training the data set of the dense vectors to obtain a water quality test model; and a prediction module for converting to-be-predicted time information into a dense vector to input the water quality test model and output corresponding predicted water quality values.
[0012] In one of the embodiments, the augmenting module comprises a random number generating unit for generating multiple groups of random numbers subject to [-sigma, sigma] uniform distribution according to measurement error sigma of the historical water quality values; and an augmented data generating unit for adding the random numbers and the historical water quality values respectively to obtain augmented data in combination with the historical time information.
[0013] A computer device comprises a memory and a processor, the memory storing a computer program, and the processor implements the steps of the above method when executing the computer program.
[0014] A computer readable storage medium stores a computer program, and the computer program implements the steps of the above method when executed by a processor.
[0015] Compared with the prior art, the advantages of the present application are that a small amount of historical water quality data is augmented to increase the accuracy of model training, and the time information is considered, the time information is converted into a first dense vector at least by a word embedding model, and water quality indexes directly related to water quality are converted into a second vector with the same length as the first dense vector, the fusion of multi-modal data is realized, the water quality prediction accuracy is further improved, and the detection frequency can be determined according to the predicted value of the water quality condition, so as to reduce the waste of detection resources and detect and add chemicals in time when the water quality exceeds the standard. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 is a flowchart of a method for water quality prediction in an embodiment of the present application; Figure 2 is an example graph of historical water quality data in an embodiment of the present application; Figure 3 is a flowchart of the dense vector conversion step in an embodiment of the present application; Figure 4 is a training loss variation graph when the weight of augmented data back propagation is set to 0.1 in an embodiment of the present application; Figure 5 is a training loss variation graph when the weight of augmented data back propagation is set to 0.5 in an embodiment of the present application; Figure 6 is a structural block diagram of the water quality prediction device in an embodiment of the present application; Figure 7 is an internal structure diagram of the computer device in an embodiment of the present application. DETAILED DESCRIPTION
[0018] The embodiments of the present application will be described in detail below with reference to the drawings.
[0019] The above embodiments are only some of the embodiments of the present application, but not all of the embodiments of the present application. The present application can be implemented or applied in other different specific embodiments, and each detail in the present application can be modified or changed based on different views and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0020] It should be noted that various aspects of the embodiments described below are within the scope of the present application. It should be apparent that the aspects described herein can be implemented in a wide variety of forms, and that any specific structure and / or function described herein is merely illustrative. Based on the present application, one of skill in the art should appreciate that one aspect described herein can be implemented independently of any other aspect and that two or more aspects described herein can be combined in various ways. For example, an apparatus can be implemented or a method can be practiced using any number of the aspects described herein. In addition, an apparatus can be implemented or a method can be practiced using other structure and / or functionality in addition to or other than one or more of the aspects described herein.
[0021] It is also need to be explained that the figures provided in the following embodiments only illustrate the basic concept of the present application in a schematic way, and only the components related to the present application are shown in the figures, not the number, shape and size of the components when actually implemented, and the shape, number and proportion of each component when actually implemented can be a random change, and the component layout pattern can also be more complex.
[0022] In addition, in the following description, specific details are provided in order to facilitate a thorough understanding of the examples. However, one skilled in the relevant art will understand that the aspects described can be practiced without these specific details.
[0023] The applicant found in the research that most of the existing prediction models only consider the factors that directly affect water quality, ignoring the influence of time and / or working conditions on water quality, which reduces the accuracy of model training. Moreover, the over-fitting of the trained model is also easy to cause by the too few samples of water quality sampling data in the training process, and the model precision is not high and the weight of the model may have a large jump change in the training process instead of converging smoothly.
[0024] Therefore, in order to overcome the above problems, the present application provides a water quality prediction method, which can be applied on a server or a terminal. The terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable smart devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.
[0025] In one embodiment, as shown in Figure 1 A water quality prediction method is provided. Taking the method applied to a server as an example, the method comprises the following steps: Step 101, receiving historical water quality data, the historical water quality data at least containing historical time information and historical water quality value.
[0026] The server receives historical water quality data, the historical water quality data at least containing historical time information and historical water quality value.
[0027] The historical water quality value contains multiple index values affecting water quality, for example, the historical water quality value can contain pH value, conductivity, bacterial value, turbidity and metal ion content, etc. The type of water quality index contained in the historical water quality value can be one to several, and the specific index can be adjusted according to the needs of different industries.
[0028] The historical time information is the sampling time corresponding to the historical water quality value. The expression can be a combination of date + month, or superimposed with week information and / or working day information.
[0029] Step 102, data augmentation is performed on the historical water quality values, and augmented data corresponding to the historical water quality data is constructed in combination with historical time information.
[0030] The server performs data augmentation on the historical water quality values, and constructs augmented data corresponding to the historical water quality data in combination with historical time information. In an embodiment, the server can generate a plurality of groups of random numbers subject to [-σ, σ] uniform distribution according to the measurement error σ of the collected historical water quality values; add the random numbers to the historical water quality values respectively, and obtain the augmented data in combination with the historical time information. The measurement error can be the measurement error of the sensor for collecting the water quality index, or the method error for collecting the water quality index. For example, the data selected for rationality verification selected 132 pieces of data of irregular sampling from March 13, 2019 to March 13, 2021 in a certain water plant (only part of the data is shown). Among them, the measurement error σ of pH is ±0.05. Therefore, the server can generate 1000 times of random numbers subject to [-0.05, 0.05] uniform distribution, 132 pieces each time. Then, the random numbers are added to the true values of the historical water quality data to obtain the augmented data, a total of 132000 pieces. At the same time, add the 132 pieces of historical water quality data, so the total training data is 132132 pieces. Figure 2
[0031] Step 103, convert the augmented data and the historical water quality data into dense vectors to construct a data set.
[0032] The server converts the augmented data and the historical water quality data into dense vectors to construct a data set. The server can directly convert the augmented data and the historical water quality data into dense vectors through a word embedding model; or can map each category to a statistical value related to the target variable to form a corresponding dense vector; the server can also map each category to a binary vector through binary encoding. The server collects the vectors corresponding to each augmented data and historical water quality data, and forms a data set of dense vectors.
[0033] Step 104, learning and training the data set of dense vectors to obtain a water quality test model.
[0034] The server learns and trains the data set of dense vectors to obtain a water quality test model. The server can use a decision tree model or a neural network model to learn and train the data set, and obtain a water quality test model.
[0035] Step 105, convert the to-be-predicted time information into a dense vector and input it into the water quality test model to output the corresponding predicted water quality value.
[0036] The server can convert the time information to be predicted into a dense vector and input it into the water quality test model, and output the corresponding predicted water quality value. In one embodiment, when the server predicts the predicted water quality value at time t+1, the server can also convert the historical water quality data at time t into a dense vector, and input it into the water quality test model together with the dense vector converted from the time information to be predicted, and output the predicted water quality value corresponding to time t+1. At this time, the historical water quality data at time t corresponds to the latest data in the data set, which can further improve the accuracy of the prediction. In one embodiment, when the historical water quality data contains working condition information, the server can also convert the working condition information into a vector, and input it into the water quality test model, and output the predicted water quality value at time t+1.
[0037] The above method augments a small amount of historical water quality data to increase the accuracy of model training and takes time information into consideration. Through the word embedding model, the time information is at least converted into a first dense vector. At the same time, the water quality indicators directly related to water quality are converted into a second vector of the same length as the first dense vector, realizing the fusion of multimodal data and further improving the accuracy of water quality prediction. This ensures that the subsequent detection frequency can be determined based on the predicted value of the water quality, thereby reducing the waste of detection resources and allowing timely detection and addition of drugs for water quality that exceeds the standard.
[0038] In one embodiment, data augmentation is performed on historical water quality values, and augmented data corresponding to the historical water quality data is constructed in combination with historical time information, including: generating multiple groups of random numbers that obey the uniform distribution of [-σ, σ] based on the measurement error σ of collecting historical water quality values; adding the random numbers to the historical water quality values respectively, and obtaining the augmented data in combination with the historical time information.
[0039] The server generates multiple sets of random numbers uniformly distributed over the range [-σ,σ] based on the measurement error σ of the collected historical water quality values. When multiple water quality indicators are present, the server generates multiple sets of random numbers for each indicator. The server then adds these random numbers to the corresponding historical water quality values, combining them with historical time information to generate augmented data.
[0040] When there are multiple water quality indicators, the amount of augmented data generated by the server can increase exponentially compared to the amount of augmented data for a single water quality indicator, further expanding the data set and thereby improving the accuracy of model training.
[0041] The above method performs data augmentation on historical water quality data, improves the generalization ability of the model and reduces the risk of overfitting.
[0042] In one embodiment, Figure 3 As shown in Figure 2, the augmented data and historical water quality data are converted into dense vectors and the dataset is constructed, which includes the following steps: Step 301, converting various category information in historical time information into first numerical type vectors respectively.
[0043] The server can convert various category information in historical time information into first numerical type vectors respectively. The server can convert category type data into numerical type data by One-hot encoding, and the server maps each category to a unique binary vector, where only one position is 1 and the rest are 0. Specifically, the server can convert date information into one-hot encoding representation with a length of 31; the server can also convert month information into one-hot encoding representation with a length of 12; the server can also convert week information into one-hot encoding representation with a length of 7; and the server converts whether it is a working day information into one-hot encoding representation with a length of 2.
[0044] Step 302, converting the first numerical type vector into a first dense vector by using word embedding method.
[0045] The server converts the first numerical type vector into a first dense vector by using word embedding method. The server converts the One-hot encoded vector into the first dense vector through an embedding layer (word embedding method). The weight matrix E of the embedding layer can have a shape of (vocabulary size, embedding dimension). In order to facilitate the integration of the vectors of the three word embedding methods, the embedding dimension is selected to be a power of 2. In an embodiment, the value of n can be selected according to the computing resources, for example, a natural number between 5 and 11 can be selected. Specifically, in the word embedding method of the date, the vocabulary size is 31, and taking n as 7 for example, the embedding dimension is 128; in the word embedding method of the week, the vocabulary size is 7, and the embedding dimension is 128; in the word embedding method of the month, the vocabulary size is 12, and the embedding dimension is 128.
[0046] Step 303, converting historical water quality values corresponding to various water quality indicators into second vectors.
[0047] The server converts historical water quality values corresponding to various water quality indicators into second vectors. The server can convert water quality indicators that directly affect water quality into second vectors with the same length as the above dense vectors through a fully connected neural network, a total of 1.
[0048] Step 304, combining the first dense vector with the corresponding second vector to generate a data set.
[0049] The server combines the first dense vector with the corresponding second vector to generate a data set.
[0050] The above method considers various category information in time simultaneously, and predicts water quality together with water quality indicators that directly affect water quality, thereby improving the accuracy of model prediction.
[0051] In one embodiment, the historical water quality data further comprises historical working condition information, and converting the augmented data and the historical water quality data into dense vectors and constructing the data set further comprises: converting the historical working condition information into third numerical data; converting the third numerical data into third dense vectors by using a word embedding method; and combining the first dense vectors, the third dense vectors, and the corresponding second vectors to generate the data set.
[0052] The server converts the working condition information into third dense vectors by using a word embedding model. The server can divide the working condition information into 10 levels according to the starting load, and convert the working condition information of the 10 levels into one-hot encoding representation with a length of 10. Then the server converts it into third dense vectors by using a word embedding model. In order to facilitate the combination of vectors, in one embodiment, the dimension of the vector is 128.
[0053] The server combines the first dense vectors, the third dense vectors, and the corresponding second vectors to generate the data set.
[0054] The above method considers both time and working condition information, and predicts water quality together with water quality indicators that directly affect water quality, further improving the accuracy of model prediction.
[0055] In one embodiment, the data set of dense vectors is learned and trained to obtain a water quality test model, including the following steps: dividing the data set of dense vectors into a training set and a test set; inputting the training set into a deep learning model for training, and setting the weight coefficients of the augmented data and the weight coefficients of the historical water quality data during back propagation, wherein the weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data; testing the learned model obtained by training through the test set to obtain a water quality test model.
[0056] The server divides the data set of dense vectors into a training set and a test set. For example, taking the 132,132 data in step 102 as an example, the server can divide the augmented data and the historical water quality data into 80% and 20% respectively, with 80% of the data as training data (105,600 augmented data and 105 historical water quality data), and 20% of the data as test data (26,400 augmented data and 27 historical water quality data). The training data constitutes the training set of the training model, and the test data constitutes the test set of the test model. In one embodiment, the augmented data and the historical water quality data in the training set correspond.
[0057] The server uses a deep neural network to train the training set. In one embodiment, the deep neural network has three hidden layers: the first hidden layer has 512 neurons, the second hidden layer has 1024 neurons, and the third hidden layer has 512 neurons. The deep neural network uses ReLU as the activation function, Adam as the optimizer, bach_size is 16, the learning rate is 0.001, and the epoch number is 1000.
[0058] The server sets the weight coefficient of the augmented data and the weight coefficient of the historical water quality data during back propagation respectively. The weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data. The weight coefficient of the historical water quality data can range from 0.8 to 2, and the weight coefficient of the augmented data can range from 0.1 to 0.5. The smaller the value of the weight coefficient of the augmented data is set, the smaller the training loss of the model. For example, the weight coefficient of the historical water quality data is set to 1. When the weight of the augmented data back propagation is set to 0.1, the change trend of the loss during the training process is as follows Figure 4 When the weight of the augmented data back propagation is set to 0.5, the change trend of the loss during training is as follows. Figure 5 As shown in the figure, the convergence speed of the two is similar. When the weight of the augmented data back propagation is set to 0.1, the final training loss is about 0.03. When the weight of the augmented data back propagation is set to 0.5, the final training loss is about 0.05. Figure 4 and Figure 5 The horizontal axis of is the number of training times. Figure 4 and Figure 5 The vertical axes are all training losses.
[0059] The performance on the test set is that when the weight of the augmented data back propagation is set to 0.1, the mean absolute error of the test set is 0.07; when the weight of the augmented data back propagation is set to 0.5, the mean absolute error of the test set is 0.12.
[0060] The above method sets different back-propagation weight coefficients for augmented data and historical water quality data during the deep neural network training process, thereby reducing the impact of augmented data on the deep neural network model while ensuring the accuracy of the model.
[0061] In one embodiment, the method further comprises the following steps: analyzing the predicted water quality value and outputting the analysis result.
[0062] The server analyzes the predicted water quality value and outputs an analysis result. For example, when the predicted water quality value does not exceed a predetermined threshold, the server can determine to adjust the to-be-predicted time information, lengthen the time interval between the to-be-predicted time and the latest detection result, and reduce the detection frequency; when the predicted water quality value exceeds the predetermined threshold, the server can determine to adjust the to-be-predicted time information, shorten the time interval between the to-be-predicted time and the latest detection result, and increase the detection frequency.
[0063] In one embodiment, as shown in FIG. 6, a water quality prediction device is provided, which includes a receiving module 601, an augmentation module 602, a vector conversion module 603, a training module 604, and a prediction module 605. Figure 6
[0064] The receiving module 601 is configured to receive historical water quality data, which at least includes historical time information and historical water quality values.
[0065] The augmentation module 602 is configured to perform data augmentation on the historical water quality values, and construct augmented data corresponding to the historical water quality data in combination with the historical time information.
[0066] The vector conversion module 603 is configured to convert the augmented data and the historical water quality data into dense vectors, and construct a data set.
[0067] The training module 604 is configured to learn and train the data set of the dense vectors, and obtain a water quality test model.
[0068] The prediction module 605 is configured to convert to-be-predicted time information into a dense vector input into the water quality test model, and output a corresponding predicted water quality value.
[0069] In one embodiment, the augmentation module 602 includes: A random number generation unit is configured to generate a plurality of groups of random numbers subject to [-σ, σ] uniform distribution according to a measurement error σ of the collected historical water quality values.
[0070] An augmented data generation unit is configured to add the random numbers and the historical water quality values respectively, and obtain the augmented data in combination with the historical time information.
[0071] In some embodiments, the vector conversion module includes: A first numerical value type vector conversion unit is configured to convert various category information in the historical time information into first numerical value type vectors respectively.
[0072] A first dense vector conversion unit is configured to convert the first numerical value type vectors into first dense vectors by using a word embedding method.
[0073] A second vector conversion unit is configured to convert the historical water quality values corresponding to various water quality indexes into second vectors.
[0074] The data set generation unit is configured to combine the first dense vector and the corresponding second vector to generate a data set.
[0075] In some embodiments, the vector conversion module further comprises: The third numerical value type vector conversion unit is configured to convert the historical working condition information into third numerical value type data.
[0076] The third dense vector conversion unit is configured to convert the third numerical value type data into a third dense vector by using a word embedding method.
[0077] The data set generation unit is configured to combine the first dense vector and the third dense vector and the corresponding second vector to generate a data set.
[0078] In some embodiments, the training module comprises: The splitting unit is configured to split the data set of the dense vector into a training set and a test set. The training unit is configured to input the training set into a deep learning model for training, and set a weight coefficient of augmented data and a weight coefficient of historical water quality data when back propagation, wherein the weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data. The test verification unit is configured to test the learned model obtained by training through the test set to obtain a water quality test model.
[0079] In one embodiment, the apparatus further comprises: The analysis module is configured to analyze the predicted water quality value and output an analysis result.
[0080] The specific limitations of the apparatus for water quality prediction can be referred to the limitations of the method for water quality prediction in the above, which will not be repeated here. Each module in the above apparatus for water quality prediction can be realized by software, hardware and their combinations in whole or in part. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.
[0081] In one embodiment, a computer device is provided, which can be a server, and its internal structure diagram can be as shown in Figure 7As shown in the figure. The computer device includes a processor, a memory, a network interface and a database connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store historical water quality data. The network interface of the computer device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement a water quality prediction method.
[0082] Those skilled in the art can understand that, Figure 7 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0083] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the following steps: receiving historical water quality data, the historical water quality data at least containing historical time information and historical water quality values; data augmentation is performed on the historical water quality values, and augmented data corresponding to the historical water quality data is constructed in combination with the historical time information; the augmented data and the historical water quality data are converted into dense vectors to construct a data set; the data set of the dense vectors is learned and trained to obtain a water quality test model; the to-be-predicted time information is converted into a dense vector and input into the water quality test model to output corresponding predicted water quality values.
[0084] In one embodiment, the processor executing the computer program to implement the data augmentation on the historical water quality values and the construction of the augmented data corresponding to the historical water quality data in combination with the historical time information comprises: generating a plurality of groups of random numbers subject to [-σ, σ] uniform distribution according to the measurement error σ of the collected historical water quality values; adding the random numbers and the historical water quality values respectively to obtain the augmented data in combination with the historical time information.
[0085] In one embodiment, the processor executing the computer program to implement the conversion of the augmented data and the historical water quality data into dense vectors to construct a data set comprises: converting various category information in the historical time information into first numerical type vectors respectively; converting the first numerical type vectors into first dense vectors by using a word embedding method; converting the historical water quality values corresponding to various water quality indexes into second vectors; combining the first dense vectors with the corresponding second vectors to generate a data set.
[0086] In an embodiment, the historical water quality data realized by the processor when executing the computer program further comprises historical working condition information, and converting the augmented data and the historical water quality data into dense vectors and constructing the data set further comprises: converting the historical working condition information into third numerical data; converting the third numerical data into third dense vectors by using a word embedding method; and combining the first dense vectors, the third dense vectors, and the corresponding second vectors to generate the data set.
[0087] In an embodiment, the learning training of the data set of the dense vectors realized by the processor when executing the computer program to obtain the water quality test model comprises: dividing the data set of the dense vectors into a training set and a test set; inputting the training set into a deep learning model for training, and setting a weight coefficient of the augmented data and a weight coefficient of the historical water quality data when back propagation, wherein the weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data; and testing the learning model obtained by training through the test set to obtain the water quality test model.
[0088] In an embodiment, the processor when executing the computer program further realizes the following steps: analyzing the predicted water quality numerical value and outputting an analysis result.
[0089] In an embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to realize the following steps: receiving historical water quality data, wherein the historical water quality data at least comprises historical time information and historical water quality numerical values; data augmenting the historical water quality numerical values, combining the historical time information to construct augmented data corresponding to the historical water quality data; converting the augmented data and the historical water quality data into dense vectors to construct a data set; learning training the data set of the dense vectors to obtain a water quality test model; converting to-be-predicted time information into a dense vector to input the water quality test model, and outputting a corresponding predicted water quality numerical value.
[0090] In an embodiment, the data augmenting of the historical water quality numerical values and the combining of the historical time information to construct the augmented data corresponding to the historical water quality data realized by the computer program when executed by the processor comprises: generating a plurality of groups of random numbers subject to [-σ, σ] uniform distribution according to a measurement error σ of the collected historical water quality numerical values; and adding the random numbers and the historical water quality numerical values respectively to obtain the augmented data in combination with the historical time information.
[0091] In an embodiment, the converting of the augmented data and the historical water quality data into dense vectors and the constructing of the data set realized by the computer program when executed by the processor comprises: converting various types of information in the historical time information into first numerical vectors; converting the first numerical vectors into first dense vectors by using a word embedding method; converting the historical water quality numerical values corresponding to various water quality indexes into second vectors; and combining the first dense vectors, the corresponding second vectors, and the augmented data to generate the data set.
[0092] In one embodiment, the historical water quality data realized by the computer program executed by the processor further comprises historical working condition information, the augmented data and the historical water quality data are converted into dense vectors, and the data set is constructed, and the method further comprises: converting the historical working condition information into third numerical data; converting the third numerical data into third dense vectors by using a word embedding method; and combining the first dense vectors, the third dense vectors, and the corresponding second vectors to generate the data set.
[0093] In one embodiment, the computer program executed by the processor realizes learning and training on the data set of the dense vectors to obtain a water quality test model, and the method comprises: dividing the data set of the dense vectors into a training set and a test set; inputting the training set into a deep learning model for training, and setting a weight coefficient of the augmented data and a weight coefficient of the historical water quality data during back propagation, respectively, wherein the weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data; and testing the learning model obtained by training through the test set to obtain the water quality test model.
[0094] In one embodiment, the computer program executed by the processor further realizes the following steps: analyzing the predicted water quality numerical value and outputting an analysis result.
[0095] The above merely describes a specific implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.
Claims
1. A method for water quality prediction, characterized in that: include: Receiving historical water quality data, wherein the historical water quality data at least includes historical time information and historical water quality values; Performing data augmentation on the historical water quality values, and constructing augmented data corresponding to the historical water quality data in combination with the historical time information; Converting the augmented data and the historical water quality data into dense vectors to construct a data set; Performing learning and training on the dense vector data set to obtain a water quality testing model; The time information to be predicted is converted into a dense vector and input into the water quality test model, and the corresponding predicted water quality value is output.
2. The method according to claim 1, characterized in that The data augmentation of the historical water quality values and the construction of augmented data corresponding to the historical water quality data in combination with the historical time information include: Generate multiple sets of random numbers that obey a uniform distribution of [-σ,σ] according to the measurement error σ of the historical water quality values collected; The random number and the historical water quality value are added together, and the augmented data is obtained by combining the historical time information.
3. The method according to claim 1, characterized in that The step of converting the augmented data and the historical water quality data into dense vectors to construct a data set includes: Converting various types of information in the historical time information into first numerical vectors respectively; Converting the first numerical vector into a first dense vector using a word embedding method; Converting the historical water quality values corresponding to various water quality indicators into a second vector; The first dense vector is combined with the corresponding second vector to generate a data set.
4. The method according to claim 3, characterized in that The historical water quality data also includes historical operating condition information. The step of converting the augmented data and the historical water quality data into dense vectors to construct a data set further includes: Converting the historical operating condition information into third numerical data; Converting the third numerical data into a third dense vector using a word embedding method; The first dense vector and the third dense vector are combined with the corresponding second vector to generate a data set.
5. The method according to claim 1, wherein The dense vector data set is trained to obtain a water quality test model, including: Dividing the dense vector dataset into a training set and a test set; Inputting the training set into a deep learning model for training, and setting weight coefficients of the augmented data and the historical water quality data during back propagation, respectively, wherein the weight coefficient of the historical water quality data is greater than the weight coefficient of the augmented data; The trained learning model is tested using the test set to obtain a water quality test model.
6. The method according to claim 1, characterized in that Also includes: The predicted water quality value is analyzed and the analysis result is output.
7. A device for predicting water quality, characterized in that: The device comprises: A receiving module, configured to receive historical water quality data, wherein the historical water quality data at least includes historical time information and historical water quality values; An augmentation module, configured to perform data augmentation on the historical water quality values and construct augmented data corresponding to the historical water quality data in combination with the historical time information; A vector conversion module, configured to convert the augmented data and the historical water quality data into dense vectors to construct a data set; A training module, configured to perform training on the dense vector data set to obtain a water quality test model; The prediction module is used to convert the time information to be predicted into a dense vector and input it into the water quality test model, and output the corresponding predicted water quality value.
8. The device according to claim 7, characterized in that The augmentation module includes: A random number generation unit, configured to generate a plurality of groups of random numbers that obey a uniform distribution of [-σ, σ] according to a measurement error σ of the historical water quality values collected; The augmented data generating unit is used to add the random number and the historical water quality value respectively, and obtain augmented data in combination with the historical time information.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Photovoltaic power generation prediction method and prediction device
CN111967675A
Power system load prediction method and device, computer equipment and storage medium
CN118195353A
Industrial sewage water quality prediction method and device based on deep learning
CN118260574A
Drainage basin water quality prediction method, device, equipment and medium
CN119884672A
Predicting arrival time of components based on historical receipt data
US20190392363A1