COD prediction method, device and terminal

By calculating the cosine similarity between the environmental vector of the water to be measured and the historical environmental vector in the prediction model pool, and selecting or updating the COD prediction model, the problems of inaccurate COD prediction and secondary pollution in traditional methods are solved, and higher prediction accuracy and adaptability are achieved.

CN119044096BActive Publication Date: 2025-03-18QUANZHOU INST OF EQUIP MFG +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411536528.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-03-18
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

Traditional chemical method to determine COD data will increase secondary pollution to water bodies, while the linear model based on ultraviolet-visible light absorption spectrometry causes inaccurate COD prediction results due to regional water composition differences.

Method used

By calculating the cosine similarity between the current environmental vector of the water to be tested and the multiple historical environmental vectors in the prediction model pool, the maximum similarity is determined and the corresponding COD prediction model is selected. This model is the model that is most similar to the water quality environment to be measured in the predicted model pool, or the model updated through the current environment vector.

Benefits of technology

It improves the accuracy of COD prediction, reduces the secondary pollution of water by chemical substances, and can adapt to changes in different regions and water quality, ensuring the accuracy and practicality of the prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119044096B_ABST
    Figure CN119044096B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a COD prediction method, device and terminal, wherein the COD prediction method includes: obtaining the current environment vector of the water to be tested and the historical environment vector of the prediction model pool; calculating multiple cosine similarities based on the current environment vector and the historical environment vector; determining the maximum similarity based on the multiple cosine similarities; determining the COD prediction model based on the maximum similarity; the COD prediction model is the first prediction model corresponding to the first historical environment vector with the maximum similarity calculated in the prediction model pool, or the second prediction model obtained by updating the first prediction model based on the current environment vector; outputting COD data based on the COD prediction model. The COD prediction method provided by the embodiment of the present application can improve the accuracy of predicting COD.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of water quality detection, and in particular to a COD prediction method, device and terminal. Background Art

[0002] In water treatment, Chemical Oxygen Demand (COD) is one of the important indicators to measure the content of organic pollution in water. The determination of COD can reflect the degree of organic pollution in water. By measuring COD data, it can help to formulate reasonable treatment plans, reduce the pollution of water bodies by organic pollutants, and improve the quality of the ecological environment.

[0003] However, if the traditional chemical method is used to determine COD data, it will increase secondary pollution to the water body. If a linear model is constructed based on UV-visible absorption spectroscopy and COD data, it will be affected by differences in water composition in different regions, making the results inaccurate. Summary of the invention

[0004] In view of the above problems, the embodiments of the present application provide a COD prediction method, device and terminal, which can improve the accuracy of COD prediction.

[0005] In a first aspect, an embodiment of the present application provides a COD prediction method, comprising:

[0006] Obtain the current environmental vector of the water to be tested and the historical environmental vector of the prediction model pool;

[0007] Calculate multiple cosine similarities based on the current environment vector and the historical environment vector;

[0008] Based on multiple cosine similarities, determine the maximum similarity;

[0009] Based on the maximum similarity, a COD prediction model is determined; the COD prediction model is a first prediction model corresponding to the first historical environment vector with the maximum similarity calculated in the prediction model pool, or a second prediction model obtained by updating the first prediction model based on the current environment vector;

[0010] Output COD data based on COD prediction model.

[0011] In an optional implementation, determining a COD prediction model based on the maximum similarity includes:

[0012] When the maximum similarity is greater than or equal to the first threshold, determining the first prediction model as the COD prediction model;

[0013] When the maximum similarity is less than the first threshold and greater than or equal to the second threshold, determining the model with the highest accuracy between the first prediction model and the second prediction model as the COD prediction model;

[0014] When the maximum similarity is less than the second threshold, the second prediction model is determined to be the COD prediction model.

[0015] In an optional implementation, determining the model with the highest accuracy between the first prediction model and the second prediction model as the COD prediction model includes:

[0016] Obtaining evaluation indicators of the first prediction model and the second prediction model; the evaluation indicators include: determination coefficient and root mean square error;

[0017] The model with the largest determination coefficient and the smallest root mean square error was determined as the COD prediction model.

[0018] In an optional implementation, the method further includes:

[0019] Obtain pure absorption spectrum and corresponding COD data;

[0020] The pure absorption spectrum and COD data are input into an improved radial basis network to obtain a first prediction model; the improved radial basis network includes a clustering layer located between an input layer and a hidden layer.

[0021] In an optional implementation, the method further includes:

[0022] When the maximum similarity is less than a first threshold, the current environment vector is added to the data set of the historical environment vector;

[0023] Obtaining the current pure absorption spectrum of the water to be tested, and adding the current pure absorption spectrum to the data set of pure absorption spectrum;

[0024] Resetting the target feature parameters of the first prediction model to a unit vector;

[0025] The pure absorption spectrum and COD data were input into the improved radial basis network to obtain the second prediction model.

[0026] In an optional implementation, the target feature parameter is at least one of the number of clusters, the number of model iterations, the learning rate, and the band selection.

[0027] In an optional implementation, obtaining the current pure absorption spectrum of the water to be tested includes:

[0028] Obtaining the original absorption spectrum of the water to be tested;

[0029] Based on the turbidity compensation model and the original absorption spectrum, the pure absorption spectrum of the water to be tested is obtained.

[0030] In a second aspect, an embodiment of the present application provides a COD prediction device, comprising:

[0031] A data acquisition module is used to obtain the current environmental vector and historical environmental vector of the water to be tested;

[0032] A data calculation module, used for calculating the maximum similarity based on the current environment vector and the historical environment vector;

[0033] A model selection module is used to determine the COD prediction model based on the maximum similarity;

[0034] The data processing module is used to output COD data based on the COD prediction model; the COD prediction model is the first prediction model or the second prediction model updated based on the current environmental vector.

[0035] In a third aspect, an embodiment of the present application provides a terminal, comprising: a memory and a processor; the memory stores a computer program or instruction that can be executed by the processor; the processor executes the computer program or instruction to implement the COD prediction method of any one of the above-mentioned first aspects.

[0036] In a fourth aspect, an embodiment of the present application provides a computer storage medium, in which a computer program or instruction that can be executed by a processor is stored. When the computer program or instruction is executed, the COD prediction method of any one of the above-mentioned first aspects is implemented.

[0037] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the COD prediction method of any one of the above-mentioned first aspects.

[0038] The COD prediction method, device and terminal provided in the embodiment of the present application calculate the cosine similarity between the current environmental vector of the water to be tested and multiple historical environmental vectors in the prediction model pool, thereby determining the maximum similarity and the corresponding first prediction model. The first prediction model is the prediction model in the prediction model pool that is most similar to the water quality environment of the water to be tested. The degree of conformity between the water quality environment of the water to be tested and the water quality environment of the first prediction model is judged by the value of the maximum similarity. When the degree of conformity of the water quality environment is high, the first prediction model is used to predict the COD data of the water to be tested. When the degree of conformity of the water quality environment is low, the current environmental vector of the water to be tested is used to update the first prediction model to obtain the second prediction model, thereby ensuring that the COD prediction model finally determined is most consistent with the water quality environment of the water to be tested, so as to ensure that the COD data that best conforms to the water environment to be tested is accurately output. When the current environmental vector has a high similarity with the environmental vector of the first prediction model, the existing model is used to predict COD data to reduce the secondary pollution of water bodies by chemical substances. When the current environmental vector has a low similarity with the environmental vector of the first prediction model, online incremental learning is performed to optimize the prediction model to obtain a prediction model that meets the water environment to be tested. Therefore, no matter how the sewage environment changes, the model can be adjusted to predict COD data that meets the current water quality environment, thereby improving data accuracy, reducing deviations and protecting water bodies.

[0039] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present application, a brief introduction will be given below to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0041] Figure 1 It is a flow chart of the COD prediction method provided in the embodiment of the present application.

[0042] Figure 2 It is a structural schematic diagram of a COD prediction device provided in an embodiment of the present application.

[0043] Figure 3 It is a structural diagram of a terminal provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by technicians in the technical field to which this application belongs; the terms used in the specification of the application are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification, claims and drawings of this application are intended to cover non-exclusive inclusions.

[0046] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0047] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0048] The directional words appearing in the following description are all directions shown in the drawings, and are not specific limitations of the present application. For example, in the description of the present application, the directions or positional relationships indicated by the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation of the present application.

[0049] In addition, the terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects rather than to describe a specific order, and may explicitly or implicitly include one or more of the features.

[0050] In the description of the present application, unless otherwise specified, “plurality” means more than two (including two), and similarly, “plurality groups” means more than two (including two).

[0051] COD can indicate the amount of oxidants consumed by organic matter in water that is easily oxidized by strong oxidants, usually measured in milligrams per liter (mg / L). The COD value can directly reflect the degree of organic pollution in the water. The larger the COD value, the more serious the organic pollution in the water, and effective sewage treatment is needed in a timely manner.

[0052] Traditional methods for determining COD have some disadvantages, such as strict reaction conditions, long reaction time, the need for chemical reagents, and secondary pollution to the environment. For example, in the chemiluminescence method, potassium dichromate is reduced to chromium ions by organic matter in the sample, producing a certain intensity of chemiluminescence. The flow injection method uses chemical solvents to produce a certain degree of chemical precipitation with organic matter. The oxidation method uses strong oxidants such as dichromates and permanganates to oxidize organic matter in water bodies. Therefore, compared with the traditional method of determining the content of chemical oxygen demand, the spectrophotometric detection method can calculate the concentration of chemical oxygen demand by measuring the absorbance of the sample in the ultraviolet-visible light spectrum, reducing the use of traditional chemical reagents, thereby reducing the secondary pollution of chemical components to water bodies, and at the same time has high detection accuracy and detection speed. Therefore, the spectrophotometric detection method has been widely used in the measurement of chemical oxygen demand.

[0053] Usually, after measuring the absorbance of a known sample using spectrophotometry, a mathematical model of the absorbance of the known sample and COD is established to predict the COD content of the unknown sample. However, sewage contains many different components, so the prediction results are often not accurate enough if only the linear model of absorbance and COD is relied upon. In addition, the components of water bodies in different regions are different except for chemical oxygen demand, making the offline training model unsuitable for other waters. Therefore, the method of detecting chemical oxygen demand only by establishing a linear model is not suitable for actual sewage application scenarios and has large errors.

[0054] Based on the above problems, the embodiments of the present application provide a COD prediction method, device and terminal, which can improve the accuracy of COD prediction.

[0055] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0056] Figure 1 Schematic diagram of a COD prediction method provided in the embodiment of the present application. Figure 1 As shown, the COD prediction method provided in the embodiment of the present application may include:

[0057] S101, obtaining the current environmental vector of the water to be tested and the historical environmental vector of the prediction model pool.

[0058] Specifically, the environmental vector is a data set used to describe environmental characteristics or conditions, which may include data such as temperature, pressure, pH (Pondus Hydrogenii, pH) value, etc. The water quality environment of the water area can be known through the environmental vector. When the environmental vectors measured by two sewage samples are consistent, their water quality environments are also the same. Exemplarily, the environmental vector of the water area can be written as (temperature, pressure, pH, turbidity). For example, the environmental vector a of the sample in water area A (8℃, 981pa, 6.5, 0.8563), and the environmental vector b of the sample in water area B (12℃, 954pa, 7.5, 0.9721), it can be seen that the water quality environment similarity of the samples in water area AB is low, and the samples in water area A and water area B may be samples from two water areas with different geographical locations, or samples collected from the same water area at different collection points, such as fish farming at one collection point and shrimp farming at another collection point.

[0059] Specifically, the prediction model pool contains multiple prediction models, which are obtained by fitting the correspondence between absorbance and chemical oxygen demand in the ultraviolet-visible light spectrum. Each prediction model has a corresponding historical environmental vector, which represents the water quality environment applicable to the prediction model. The current environmental vector of the water to be tested can be determined by sampling and then testing. The water quality environment of the sewage sample is quantified by the environmental vector, which is convenient for subsequent calculations, comparisons, etc.

[0060] S102: Calculate multiple cosine similarities based on the current environment vector and the historical environment vector.

[0061] Specifically, the cosine similarity of the current environment vector and the historical environment vector corresponding to each prediction model in the prediction model pool is calculated respectively. Cosine similarity can characterize the similarity between two vectors, and the numerical range is [0, 1]. The larger the cosine similarity, the more similar the two vectors are. The environment vector contains a variety of information about water quality. By calculating the cosine similarity of two environment vectors, the similarity of the water quality environment of two water areas can be determined. For example, the cosine similarity between the environment vector c of the water to be tested and the environment vector d of prediction model one is 0.3, the cosine similarity between the environment vector c of the water to be tested and the environment vector e of prediction model two is 0.8, and the cosine similarity between the environment vector c of the water to be tested and the environment vector f of prediction model three is 0.5.

[0062] S103: Determine a maximum similarity based on multiple cosine similarities.

[0063] Specifically, the maximum similarity is the minimum value among multiple cosine similarities, and the maximum similarity among multiple cosine similarities can be determined by sorting to obtain the minimum value, traversal method, etc. For example, the maximum value among 0.3, 0.8, and 0.5 is 0.8, so the maximum similarity of the environment between the water to be tested and the three prediction models in the prediction model pool is 0.8, and the water environment corresponding to the water to be tested and the prediction model 2 is the most similar.

[0064] S104: Determine a COD prediction model based on the maximum similarity, wherein the COD prediction model is a first prediction model corresponding to the first historical environment vector with the maximum similarity calculated in the prediction model pool, or a second prediction model obtained by updating the first prediction model based on the current environment vector.

[0065] It is understandable that each prediction model has its applicable water quality environment. Therefore, it is necessary to determine the prediction model applicable to the water to be tested by calculating the cosine similarity between the environmental vectors.

[0066] Exemplarily, the maximum similarity of 0.8 is calculated by the current environmental vector c and the environmental vector e of the water to be tested, then the first historical environmental vector is the environmental vector e, and the first prediction model corresponding to the environmental vector e is prediction model 2. Therefore, there is a prediction model in the prediction model pool that has a high similarity to the water quality environment of the water to be tested, that is, prediction model 2 is determined as the COD prediction model.

[0067] Exemplarily, the cosine similarities between the current environment vector c of the water to be tested and multiple historical environment vectors in the prediction model pool are 0.2, 0.1, 0.3, ..., respectively, and the maximum similarity is 0.3, indicating that there is no water quality environment in the prediction model pool that is similar to the environment of the water to be tested. The first prediction model determined from the prediction model pool according to the maximum similarity of 0.3 cannot be used to accurately predict the COD data of the water to be tested. Therefore, by adding the current environment vector c of the water to be tested to the historical environment vector of the first prediction model to update the first prediction model, a second prediction model that meets the water quality environment of the water to be tested can be obtained, thereby determining the second prediction model as the COD prediction model, and the COD data of the water to be tested can be accurately predicted.

[0068] S105. Output COD data based on the COD prediction model.

[0069] Specifically, after determining the COD prediction model suitable for the water to be tested according to the maximum similarity, the pure absorption spectrum is input into the COD prediction model to obtain the COD data of the water to be tested. The COD data output by the COD prediction model conforms to the water quality of the water to be tested, and reduces the use of chemical methods and the risk of secondary pollution of sewage.

[0070] The COD detection method provided in the embodiment of the present application determines the maximum similarity and the corresponding first prediction model by calculating the cosine similarity between the current environmental vector of the water to be tested and multiple historical environmental vectors in the prediction model pool. The first prediction model is the prediction model in the prediction model pool that is most similar to the water quality environment of the water to be tested. The degree of conformity between the water quality environment of the water to be tested and the water quality environment of the first prediction model is judged by the value of the maximum similarity. When the degree of conformity of the water quality environment is high, the first prediction model is used to predict the COD data of the water to be tested. When the degree of conformity of the water quality environment is low, the current environmental vector of the water to be tested is used to update the first prediction model to obtain the second prediction model, thereby ensuring that the COD prediction model finally determined is most consistent with the water quality environment of the water to be tested, so as to ensure that the COD data that best conforms to the water environment to be tested is accurately output. When the current environmental vector has a high similarity with the environmental vector of the first prediction model, the existing model is used to predict COD data to reduce the secondary pollution of water bodies by chemical substances. When the current environmental vector has a low similarity with the environmental vector of the first prediction model, online incremental learning is performed to optimize the prediction model to obtain a prediction model that meets the water environment to be tested. Therefore, no matter how the sewage environment changes, the model can be adjusted to predict COD data that meets the current water quality environment, thereby improving data accuracy, reducing deviations and protecting water bodies.

[0071] Optionally, S104 may include:

[0072] S201. When the maximum similarity is greater than or equal to a first threshold, determine that the first prediction model is a COD prediction model.

[0073] It is understandable that, according to the definition of cosine similarity, the first prediction model corresponding to the historical environmental variable with the maximum similarity calculated with the current environmental variable is the model most similar to the water quality environment of the water to be tested in the prediction model pool. If the maximum similarity meets the condition greater than or equal to the first threshold value, it means that the first prediction model is sufficiently similar to the water quality environment of the water to be tested, so the first prediction model can be used as the COD prediction model of the water to be tested to predict the COD value of the water to be tested. Wherein, the first threshold value can be set according to experience, for example, the first threshold value can be 0.8, and the environmental similarity exceeds 0.8, which is defined as the water quality environment is similar, and the first prediction model can be used as the COD prediction model of the water to be tested.

[0074] Optionally, when the maximum similarity is less than the first threshold, the first prediction model is updated based on the current environment vector to obtain the second prediction model. Thus, S202, when the maximum similarity is less than the first threshold and greater than or equal to the second threshold, the model with the highest accuracy between the first prediction model and the second prediction model is determined as the COD prediction model.

[0075] Optionally, the model with the highest accuracy can be the model with the largest cosine similarity calculated with the current environmental vector. Exemplarily, if the maximum cosine similarity among the multiple cosine similarities calculated between the current environmental vector of the water to be tested and the historical environmental vector in the prediction model pool is 0.6, and the first threshold is 0.8, and the second threshold is 0.5, then the first prediction model is updated based on the current environmental vector to obtain the second prediction model, and the second cosine similarity between the environmental vector of the second prediction model and the current environmental vector is calculated and compared with the maximum similarity of 0.6. When the second cosine similarity is greater than or equal to the maximum similarity, the second prediction model is determined to be a COD prediction model, and when the second cosine similarity is less than the maximum similarity, the first prediction model is determined to be a COD prediction model.

[0076] Optionally, the model with the highest accuracy may also be the model with the highest accuracy determined according to the evaluation index of the model. Specifically, in S202, determining the model with the highest accuracy between the first prediction model and the second prediction model as the COD prediction model may include:

[0077] S2021. Obtain evaluation indicators of the first prediction model and the second prediction model. The evaluation indicators include: determination coefficient and root mean square error.

[0078] Specifically, the coefficient of determination ) and Root Mean Square Error (RMSE) are two important indicators for evaluating the goodness of fit of a model and the accuracy of prediction. The coefficient of determination provides the percentage of variance explained by the model and is a relative measure that can be used to compare the fit of different models. The coefficient of determination ranges from 0 to 1. The closer it is to 1, the better the model fits the data and the stronger its ability to explain variance. The root mean square error provides an absolute measure of the prediction error. It is the standard deviation of the difference between the predicted value and the actual observed value, and can be used to quantify the accuracy of the model's prediction. The smaller the RMSE value, the higher the prediction accuracy of the model and the smaller the difference between the actual observed value.

[0079] S2022. Determine the model with the largest determination coefficient and the smallest root mean square error as the COD prediction model.

[0080] Understandably, high A low value and a low RMSE value usually mean that the model has a good fit. Therefore, between the first prediction model and the second prediction model, choose The model with the largest value and the smallest RMSE value can be used as the COD prediction model to make the predicted COD data more accurate.

[0081] S203: When the maximum similarity is less than a second threshold, determine that the second prediction model is a COD prediction model.

[0082] Specifically, if the maximum similarity is less than the second threshold, it means that the first prediction model is not suitable for the water quality environment of the water to be tested, so the second prediction model updated based on the current environment vector of the water to be tested can be directly determined, and the second prediction model is more suitable for COD prediction of the water to be tested than the first prediction model. For example, when the maximum similarity is 0.3 and the second threshold is 0.5, the second prediction model can be directly determined to be the COD prediction model.

[0083] By setting thresholds and conditional judgments, we can effectively deal with a variety of numerical situations with maximum similarity and select a COD prediction model that is more in line with the water quality environment of the water to be tested, thereby ensuring the accuracy of COD data prediction.

[0084] Optionally, considering the limitations of Lambert-Beer's law at high concentrations, the relationship between chemical oxygen demand and absorption spectrum is generally not linear. Therefore, the embodiment of the present application provides an improved radial basis network for fitting pure absorption spectrum and COD data to obtain a prediction model in the prediction model pool. Specifically, it may include:

[0085] S001. Obtain pure absorption spectrum and corresponding COD data.

[0086] Specifically, pure absorption spectra and corresponding COD data of multiple sewage samples are obtained. The pure absorption spectra may be absorption spectra of multiple sewage samples without interference factors, and the interference factors may include solvent, turbidity, temperature, errors caused by sample preparation, instrument errors, etc. The COD data may include COD data measured by chemical method or ultraviolet-visible absorption spectroscopy.

[0087] S002, inputting the pure absorption spectrum and COD data into an improved radial basis network to obtain a first prediction model, wherein the improved radial basis network includes a clustering layer located between the input layer and the hidden layer.

[0088] Specifically, a radial basis function neural network is an artificial neural network that uses a radial basis function as an activation function. The output of the radial basis function network is a linear combination of the input radial basis function and the neuron parameters. The improved radial basis network provided in the embodiment of the present application inserts a clustering layer between the input layer and the hidden layer, and classifies a large amount of data in the input layer through the clustering layer, thereby improving the processing speed and accuracy of the model.

[0089] Optionally, in the embodiment of the present application, updating the first prediction model based on the current environment vector to obtain the second prediction model may include:

[0090] S301: When the maximum similarity is less than a first threshold, the current environment vector is added to a data set of historical environment vectors.

[0091] Specifically, when the maximum similarity is less than the first threshold value, the current environment vector is added to the data set of the first historical environment vector, and the first prediction model is updated to make it applicable to the COD prediction of the water to be tested. It is understandable that the prediction model is obtained by improving the radial basis network training, and the input training data is the training data of a certain sewage sample, and the prediction model obtained by training is the prediction model corresponding to a certain sewage sample, and the environment vector of the sewage sample is the water quality environment of the sewage to which the prediction model is applicable. Only when the water quality environment of the water to be tested is similar to the water quality environment to which the prediction model is applicable, the COD data of the water to be tested can be predicted by the prediction model. Therefore, if the maximum similarity is less than the first threshold value, it means that the first prediction model determined by the maximum similarity is extremely different from the water quality environment of the water to be tested. At this time, it is necessary to obtain the COD prediction model corresponding to the water to be tested based on the current environment vector, so as to ensure the accuracy of the prediction result.

[0092] S302, obtaining the current pure absorption spectrum of the water to be tested, and adding the current pure absorption spectrum to a data set of pure absorption spectra.

[0093] Optionally, obtaining the current pure absorption spectrum of the water to be tested may include: obtaining the original absorption spectrum of the water to be tested. Based on the turbidity compensation model and the original absorption spectrum, the pure absorption spectrum of the water to be tested is obtained. Specifically, in the process of obtaining the absorption spectrum of the sewage sample, it is interfered by many factors, among which the turbidity of the sewage has a very serious influence on the scattering phenomenon of light. Therefore, by using the turbidity compensation model to correct the data of the original absorption spectrum, the interference of turbidity on the absorption spectrum can be removed, making the data cleaner and more accurate.

[0094] Specifically, the pure absorption spectrum is the absorption spectrum of the multiple sewage samples used for training the prediction model mentioned in the above embodiment, while the current pure absorption spectrum is the pure absorption spectrum of the water to be tested, which does not belong to the absorption spectrum data for training the prediction model. Therefore, if the first prediction model is to be trained as a model suitable for COD prediction of the water to be tested, the current pure absorption spectrum is added to the data set of pure absorption spectrum for retraining.

[0095] S303: Reset the target feature parameters of the first prediction model to a unit vector.

[0096] Specifically, before updating and training the first prediction model, it is necessary to reset the target feature parameters of the first prediction model to a unit vector and initialize the target feature parameters of the first prediction model to ensure that the updated second prediction model is not affected by the parameters of the first prediction model.

[0097] Optionally, the target feature parameter may be at least one of the number of clusters, the number of model iterations, the learning rate, and the band selection.

[0098] Specifically, the number of clusters refers to how many clusters the data should be divided into in cluster analysis. An appropriate number of clusters can obtain meaningful and interpretable clustering results. The number of model iterations usually refers to the number of iterations in the training process, which can also be called the number of training rounds. One round of training means that the model has completed a complete learning of the entire training data set. The learning rate determines the adjustment amplitude of the model at each step in the training process, that is, the learning rate controls the size of the model's parameter update along the gradient direction in each iteration. Band selection usually refers to selecting specific features or attributes from the data as input for model training, such as selecting a specific wavelength range in the absorption spectrum to obtain the desired absorbance data. According to the above parameters, the COD detection model with the highest accuracy can be trained to be applied to chemical oxygen demand monitoring in actual scenarios.

[0099] S304, inputting the pure absorption spectrum and COD data into the improved radial basis network to obtain a second prediction model.

[0100] The updated pure absorption spectrum includes the current pure absorption spectrum of the water to be tested. By improving the radial basis network to fit the pure absorption spectrum and COD data, a second prediction model suitable for the water quality environment of the water to be tested is obtained. Therefore, the prediction model can be updated in real time according to changes in regional data to adapt to sewage detection in different regions and realize real-time online detection of chemical oxygen demand concentration with low pollution risk.

[0101] By calculating the cosine similarity of the environmental vector, the COD prediction model suitable for the water to be tested is determined, and when the existing model does not meet the requirements, the COD prediction model is optimized based on online incremental learning to adapt it to new samples and conditions. Online incremental learning combines deep learning and spectral analysis technology, and uses an automated method to establish a model between absorbance and chemical oxygen demand in the absorption spectrum, thereby realizing chemical oxygen demand detection more quickly and accurately. Through online incremental learning, new sample information can be gradually accumulated and utilized without retraining the entire model, so that the COD prediction model can be quickly updated and improved. The embodiment of the present application uses online incremental learning and ultraviolet-visible light spectroscopy analysis technology to perform chemical oxygen demand detection, realizing dynamic, real-time monitoring and prediction of chemical oxygen demand detection of sewage water quality, with the advantages of improving measurement accuracy, reducing reagent use and realizing real-time monitoring.

[0102] By continuously iterating the COD prediction model, it is possible to adapt to changes in environmental variables, flexibly respond to changes in sewage water quality in various scenarios, and improve the accuracy and practicality of the COD prediction model. In addition, by training a COD prediction model with high accuracy, the demand for high-precision chemical oxygen demand sensors can be reduced, secondary pollution of sewage can be avoided, and high-cost investment can be reduced. Therefore, the COD prediction method provided in the embodiment of the present application provides a more feasible and economical solution for dynamically monitoring chemical oxygen demand for sewage treatment, which is expected to have a positive and far-reaching impact in the fields of environmental protection and water quality management.

[0103] The COD detection method provided in the embodiment of the present application determines the maximum similarity and the corresponding first prediction model by calculating the cosine similarity between the current environmental vector of the water to be tested and multiple historical environmental vectors in the prediction model pool. The first prediction model is the prediction model in the prediction model pool that is most similar to the water quality environment of the water to be tested. The degree of conformity between the water quality environment of the water to be tested and the water quality environment of the first prediction model is judged by the value of the maximum similarity. When the degree of conformity of the water quality environment is high, the first prediction model is used to predict the COD data of the water to be tested. When the degree of conformity of the water quality environment is low, the current environmental vector of the water to be tested is used to update the first prediction model to obtain the second prediction model, thereby ensuring that the COD prediction model finally determined is most consistent with the water quality environment of the water to be tested, so as to ensure that the COD data that best conforms to the water environment to be tested is accurately output. When the current environmental vector has a high similarity with the environmental vector of the first prediction model, the existing model is used to predict COD data to reduce the secondary pollution of water bodies by chemical substances. When the current environmental vector has a low similarity with the environmental vector of the first prediction model, online incremental learning is performed to optimize the prediction model to obtain a prediction model that meets the water environment to be tested. Therefore, no matter how the sewage environment changes, the model can be adjusted to predict COD data that meets the current water quality environment, thereby improving data accuracy, reducing deviations and protecting water bodies.

[0104] Figure 2 Schematic diagram of the structure of a COD prediction device provided in an embodiment of the present application. Figure 2 As shown, the COD prediction device provided in the embodiment of the present application may include:

[0105] The data acquisition module 201 is used to obtain the current environmental vector of the water to be tested and the historical environmental vector of the prediction model pool.

[0106] The data calculation module 202 is used to calculate multiple cosine similarities based on the current environment vector and the historical environment vector.

[0107] The model selection module 203 is used to determine the maximum similarity based on multiple cosine similarities.

[0108] The data processing module 204 is used to determine the COD prediction model based on the maximum similarity. The COD prediction model is the first prediction model corresponding to the first historical environment vector with the maximum similarity calculated in the prediction model pool, or the second prediction model obtained by updating the first prediction model based on the current environment vector.

[0109] The model training module 205 is used to output COD data based on the COD prediction model.

[0110] Optionally, the data processing module 204 is specifically used for:

[0111] When the maximum similarity is greater than or equal to the first threshold, the first prediction model is determined to be the COD prediction model.

[0112] When the maximum similarity is less than the first threshold and greater than or equal to the second threshold, the model with the highest accuracy between the first prediction model and the second prediction model is determined as the COD prediction model.

[0113] When the maximum similarity is less than the second threshold, the second prediction model is determined to be the COD prediction model.

[0114] Optionally, the data processing module 204 is further configured to:

[0115] Obtain evaluation indicators of the first prediction model and the second prediction model. The evaluation indicators include: determination coefficient and root mean square error.

[0116] The model with the largest determination coefficient and the smallest root mean square error was determined as the COD prediction model.

[0117] Optionally, the data acquisition module 201 may also be used to acquire a pure absorption spectrum and corresponding COD data.

[0118] Optionally, the model training module 205 is further used to:

[0119] The pure absorption spectrum and COD data are input into the improved radial basis network to obtain the first prediction model, wherein the improved radial basis network includes a clustering layer located between the input layer and the hidden layer.

[0120] Optionally, the model training module 205 is further used to:

[0121] When the maximum similarity is less than a first threshold, the current environment vector is added to the data set of historical environment vectors.

[0122] The current pure absorption spectrum of the water to be tested is obtained, and the current pure absorption spectrum is added to the data set of pure absorption spectrum.

[0123] Reset the target feature parameters of the first prediction model to a unit vector.

[0124] The pure absorption spectrum and COD data were input into the improved radial basis network to obtain the second prediction model.

[0125] Optionally, the target feature parameter is at least one of the number of clusters, the number of model iterations, the learning rate and the band selection.

[0126] Optionally, the model training module 205 is specifically used for:

[0127] Obtaining the original absorption spectrum of the water to be tested;

[0128] Based on the turbidity compensation model and the original absorption spectrum, the pure absorption spectrum of the water to be tested is obtained.

[0129] Figure 3 Schematic diagram of a terminal structure provided by an embodiment of the present application. Figure 3 As shown, the terminal provided in the embodiment of the present application may include: a memory 11 and a processor 10; the memory 11 stores a computer program 12 or instructions that can be executed by the processor; the processor 10 executes the computer program 12 or the instructions to implement the COD prediction method described in any one of the above method embodiments.

[0130] Optionally, the terminal 1 provided in the embodiment of the present application may further include a display 13 for displaying COD data obtained by the COD prediction method.

[0131] In summary, the COD prediction method, device and terminal provided in the embodiment of the present application calculate the cosine similarity between the current environmental vector of the water to be tested and multiple historical environmental vectors in the prediction model pool, thereby determining the maximum similarity and the corresponding first prediction model. The first prediction model is the prediction model in the prediction model pool that is most similar to the water quality environment of the water to be tested. The degree of conformity between the water quality environment of the water to be tested and the water quality environment of the first prediction model is judged by the value of the maximum similarity. When the degree of conformity of the water quality environment is high, the first prediction model is used to predict the COD data of the water to be tested. When the degree of conformity of the water quality environment is low, the current environmental vector of the water to be tested is used to update the first prediction model to obtain the second prediction model, thereby ensuring that the COD prediction model finally determined is most suitable for the water quality environment of the water to be tested, so as to ensure that the COD data that best conforms to the water environment to be tested is accurately output. When the current environmental vector has a high similarity with the environmental vector of the first prediction model, the existing model is used to predict COD data to reduce the secondary pollution of water bodies by chemical substances. When the current environmental vector has a low similarity with the environmental vector of the first prediction model, online incremental learning is performed to optimize the prediction model to obtain a prediction model that meets the water environment to be tested. Therefore, no matter how the sewage environment changes, the model can be adjusted to predict COD data that meets the current water quality environment, thereby improving data accuracy, reducing deviations and protecting water bodies.

[0132] An embodiment of the present application further provides a computer storage medium, in which a computer program or instruction that can be executed by a processor is stored. When the computer program or instruction is executed, the COD prediction method of any one of the above method embodiments is implemented.

[0133] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device executes the COD prediction method described in any one of the above method embodiments.

[0134] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0135] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0136] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.

[0137] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

[0138] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A COD prediction method, characterized in that: The method comprises: Obtain the current environmental vector of the water to be tested and the historical environmental vector of the prediction model pool; Calculate multiple cosine similarities based on the current environment vector and the historical environment vector; the environment vector is a data set used to describe environmental characteristics or conditions; Based on the multiple cosine similarities, determining a maximum similarity; Based on the maximum similarity, a COD prediction model is determined; the COD prediction model is a first prediction model corresponding to the first historical environment vector with the maximum similarity calculated in the prediction model pool, or a second prediction model obtained by updating the first prediction model based on the current environment vector; Outputting COD data based on the COD prediction model; Determining a COD prediction model based on the maximum similarity includes: When the maximum similarity is greater than or equal to a first threshold, determining the first prediction model as the COD prediction model; When the maximum similarity is less than the first threshold and greater than or equal to the second threshold, determining the model with the highest accuracy between the first prediction model and the second prediction model as the COD prediction model; When the maximum similarity is less than the second threshold, the second prediction model is determined to be the COD prediction model.

2. The method according to claim 1, characterized in that The step of determining the model with the highest accuracy between the first prediction model and the second prediction model as the COD prediction model comprises: Obtaining evaluation indicators of the first prediction model and the second prediction model; the evaluation indicators include: determination coefficient and root mean square error; The model with the largest determination coefficient and the smallest root mean square error is determined as the COD prediction model.

3. The method according to claim 2, characterized in that The method further comprises: Obtain pure absorption spectrum and corresponding COD data; The pure absorption spectrum and the COD data are input into an improved radial basis network to obtain the first prediction model; the improved radial basis network includes a clustering layer located between an input layer and a hidden layer.

4. The method according to claim 3, characterized in that The method further comprises: When the maximum similarity is less than the first threshold, adding the current environment vector to the data set of the historical environment vector; Acquire the current pure absorption spectrum of the water to be tested, and add the current pure absorption spectrum to the data set of the pure absorption spectrum; Resetting the target feature parameter of the first prediction model to a unit vector; The pure absorption spectrum and the COD data are input into an improved radial basis network to obtain the second prediction model.

5. The method according to claim 4, characterized in that The target feature parameter is at least one of the number of clusters, the number of model iterations, the learning rate and the band selection.

6. The method according to claim 4, characterized in that The step of obtaining the current pure absorption spectrum of the water to be tested comprises: Obtaining the original absorption spectrum of the water to be tested; Based on the turbidity compensation model and the original absorption spectrum, the pure absorption spectrum of the water to be tested is obtained.

7. A COD prediction device, characterized in that: The device comprises: A data acquisition module is used to obtain the current environmental vector and historical environmental vector of the water to be tested; A data calculation module, used to calculate a plurality of cosine similarities based on the current environment vector and the historical environment vector; the environment vector is a data set used to describe environmental characteristics or conditions; A model selection module, used for determining a maximum similarity based on the cosine similarity; A data processing module, used for determining a COD prediction model based on the maximum similarity; A model training module, used for outputting COD data based on the COD prediction model; the COD prediction model is a first prediction model corresponding to the first historical environment vector with the maximum similarity calculated in the prediction model pool, or a second prediction model obtained by updating the first prediction model based on the current environment vector; The data processing module is specifically used to: when the maximum similarity is greater than or equal to a first threshold, determine that the first prediction model is the COD prediction model; when the maximum similarity is less than the first threshold and greater than or equal to a second threshold, determine that the model with the highest accuracy between the first prediction model and the second prediction model is the COD prediction model; when the maximum similarity is less than the second threshold, determine that the second prediction model is the COD prediction model.

8. A terminal, characterized in that: The terminal comprises: a memory and a processor; the memory stores a computer program or an instruction that can be executed by the processor; the processor executes the computer program or the instruction to implement the COD prediction method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the COD prediction method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Method for evaluating water quality pollution based on environmental characteristic information

    CN115810403A

  • Heat supply demand prediction method and system

    CN116071099A