Water quality detection optimization method, electronic equipment and storage medium

By setting reward values ​​and updating the accumulated regret methods in water quality detection, the water quality detection results are optimized, and the accuracy and inefficiency caused by environmental factors in the existing technology are solved, and the accurate detection of water quality parameters is achieved.

CN119443353APending Publication Date: 2025-02-14WUHAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411395694.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-08
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The existing water quality detection technology is affected by a variety of environmental factors, resulting in the accuracy and efficiency need to be improved.

Method used

By setting several reward values ​​in each base arm that respectively represent the different environmental factors affecting the water quality detection data, the collected environmental factor data are assigned to each base arm, and a basic arm is randomly pulled to obtain feedback data, and based on the feedback data, the collected environmental factor data is assigned. Update the accumulation regret, repeat several rounds to obtain the optimal reward value in each base arm that makes the accumulation regret satisfy the preset conditions, thereby achieving optimization of the water quality detection results.

Benefits of technology

Through this method, the accuracy and efficiency of water quality detection can be improved, the accurate detection of water quality parameters can be achieved, and the problem of inaccuracy and efficiency of the prior art due to environmental factors is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119443353A_ABST
    Figure CN119443353A_ABST
Patent Text Reader

Abstract

The invention relates to a water quality detection optimization method, electronic equipment and a storage medium, and belongs to the technical field of water quality detection.The method comprises the steps that a plurality of reward values are set in each basic arm representing different environmental factors affecting water quality detection data; correspondingly distributing the collected environmental factor data to each basic arm, and randomly pulling one basic arm to obtain feedback data; based on the feedback data, updating and accumulating the business regret; other basic arms which are not pulled are selected to continue to update and accumulate the arc regret; repeating the operation for a plurality of rounds, and obtaining an optimal reward value which enables the accumulated barrel regret to meet a preset condition in each basic arm; and optimizing the water quality detection result based on the optimal reward value. The technical problem that the accuracy and the efficiency need to be improved due to the influence of various environmental factors in the prior art is effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of water quality detection, and in particular to a water quality detection optimization method, electronic equipment and storage medium. Background Art

[0002] With the continuous development of science and technology and economic level, people's requirements for high-quality water resources are constantly increasing. The sewage treatment rate in my country is low. Especially in rural areas, the construction of sewage treatment facilities is insufficient, resulting in a large amount of domestic and agricultural wastewater directly discharged into the water body. The main causes of water pollution include agricultural activities, industrial development, urban life, etc., and water resources will continue to be tight. At present, the total phosphorus and total nitrogen content of rivers is mainly measured by multiple means such as manual monitoring, and tested in the laboratory.

[0003] Chemical measurement, physical measurement, microbial detection, and radioactive detection methods are now commonly used to test water quality, but they are affected by various environmental factors, and their accuracy and efficiency need to be improved. Summary of the invention

[0004] In view of this, it is necessary to provide a water quality detection optimization method, electronic device and storage medium to solve the technical problem that the accuracy and efficiency of the existing technology need to be improved due to the influence of various environmental factors.

[0005] In order to solve the above problems, the present invention provides a water quality detection optimization method, comprising: A number of reward values ​​are set in each basic arm respectively representing different environmental factors affecting water quality detection data; The collected environmental factor data are distributed to each base arm accordingly, and a base arm is randomly pulled to obtain feedback data; Update the accumulated regret of the super arm based on the feedback data; Select other base arms that have not been pulled to continue updating the accumulated regret; Repeat the above operation for several rounds to obtain the optimal reward value in each basic arm that makes the accumulated regret meet the preset conditions; Optimize water quality test results based on the optimal reward value.

[0006] In a possible implementation, the setting of several reward values ​​in each basic arm respectively representing different environmental factors affecting water quality detection data includes: Determine the reward expectation and confidence interval of each basic arm based on the offline algorithm; The plurality of reward values ​​are set based on the reward expectation and the confidence interval.

[0007] In a possible implementation, setting the plurality of reward values ​​based on the reward expectation and the confidence interval includes: Based on the Thompson sampling method and the reward expectation, the plurality of reward values ​​are distributed and set within the confidence interval.

[0008] In a possible implementation, the collected environmental factor data is correspondingly distributed to each base arm, and a base arm is randomly pulled to obtain feedback data, including: After pulling the base arm, a reward value is randomly obtained; The reward value is added to or subtracted from the water quality detection data to obtain feedback data.

[0009] In a possible implementation, updating the accumulated regret based on the feedback data includes: The combination of all the base arms is taken as a super arm, and the accumulated regret of the super arm is defined; Obtain the degree of data deviation of the feedback data compared to the preset standard curve; The accumulated regret is updated based on the magnitude of the data deviation.

[0010] In a possible implementation, updating the accumulated regret based on the magnitude of the data deviation degree includes: optimizing the accumulated regret based on the CTS algorithm and the magnitude of the data deviation degree feedback, and updating the regret upper bound.

[0011] In a possible implementation, obtaining the optimal reward value in each basic arm that enables accumulated regret to satisfy a preset condition includes: Get the optimal reward value in each basis arm that makes the accumulated regret reach the global minimum.

[0012] In a possible implementation, the optimization of the water quality test result based on the optimal reward value includes: The optimal reward value is used as a compensation value to compensate the water quality test result to obtain an optimized water quality test result.

[0013] The present invention also provides an electronic device, comprising: Memory, used to store programs; A processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the water quality detection optimization method described in any one of the above method items.

[0014] The present invention also provides a storage medium for storing computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the water quality detection optimization method described in any one of the above-mentioned method items.

[0015] The beneficial effects of the present invention are as follows: the present invention provides a water quality detection optimization method, which regards multiple environmental factors that affect the detection result data as basic arms, and stipulates multiple reward values ​​for each basic arm, and then assigns the influencing factors of the data collected each time to a basic arm, obtains feedback data by randomly obtaining a reward value in the confidence interval, updates the accumulated regret according to the feedback data, and performs the next round of data collection. At the same time, other basic arms are selected, and through several rounds of data collection, the optimal reward value of each basic arm is found, so that the accumulated regret is minimized, and accurate detection of water quality parameters is achieved, thereby solving the technical problem that the accuracy and efficiency of the prior art need to be improved due to the influence of multiple environmental factors. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A method flow chart of an embodiment of a water quality detection optimization method provided by the present invention; Figure 2 for Figure 1 A method flow chart of an embodiment of step S102; Figure 3 for Figure 1 A method flow chart of an embodiment of step S103; Figure 4 A schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0017] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.

[0018] In the description of the embodiments of the present invention, unless otherwise specified, "multiple" means two or more than two. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone.

[0019] The descriptions of "first", "second", etc. involved in the embodiments of the present invention are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" and "second" may explicitly or implicitly include at least one of the features.

[0020] 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 invention. The appearance of the phrase in various places 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.

[0021] In order to solve the above problems, Figure 1 As shown, the present invention provides a water quality detection optimization method, comprising: S101. Set a number of reward values ​​in each basic arm respectively representing different environmental factors affecting water quality detection data.

[0022] Furthermore, environmental factors include: ambient light intensity, detection light intensity, liquid flow rate, temperature, channel length and other factors.

[0023] In a possible implementation, based on the Objective Thompson Sample (OTS) method and reward expectations, several reward values ​​are distributed and set within a confidence interval.

[0024] like Figure 2 In a possible implementation, step S101 specifically includes the following steps: S201. Determine the confidence interval and reward expectation of each basic arm based on an offline algorithm.

[0025] Specifically, the confidence interval can be determined based on an upper confidence bound (UCB) algorithm.

[0026] Furthermore, the confidence interval is determined by the following process: the learner can choose a super arm in each round that contains at most m Base arms, of which m is a hyperparameter. Each super arm A a is represented as a weighted combination of all basis arms, with the weight vector being m Dimensional vector a express, represents the weight of the basic arm in the super arm, A a Contains all satisfaction The base arm i The confidence upper bound of a super arm is the weighted sum of the confidence upper bounds of the base arms it contains.

[0027] S202. Setting several reward values ​​based on the confidence interval.

[0028] S102, the collected environmental factor data are distributed to each base arm accordingly, and a base arm is randomly pulled to obtain feedback data.

[0029] In a possible implementation, step S102 includes: After pulling the base arm, a random reward value is obtained; The reward value is added or subtracted from the water quality test data to obtain feedback data.

[0030] S103. Update accumulated regret based on feedback data.

[0031] like Figure 3 In a possible implementation, step S103 includes: S301. The combination of all basic arms is taken as a super arm, and the accumulated regret of the super arm is defined.

[0032] Specifically, accumulated regret is the deviation from the standard curve after data acquisition.

[0033] For example, it is assumed that in this embodiment there are m base arms, and all possible combinations of base arms are S , a total of T Wheel test, then for the super arm , and the cumulative expected reward value is: (1) In formula (1), Indicates super arm The cumulative expected reward value is Indicates the reward value obtained by pulling the super arm in each round of trials, Indicates t The output of all base arms in the round test, t= 1,2,3,..., T , the randomness expected from the output of each basis arm.

[0034] If the offline algorithm can provide The approximate optimal solution satisfies For any input environment parameter Established, among which, For input The solution output by the offline algorithm is The environmental parameters are The highest expected return of all super arms is The approximate cumulative expected regret is defined as: (2) α = β=1 means that the offline algorithm can return the exact optimal solution. The approximate cumulative expected regret value is the true cumulative expected regret value.

[0035] Furthermore, offline algorithms are implemented based on the basic assumption that the input data is known before executing the algorithm.

[0036] S302, obtaining a data deviation degree of the feedback data compared to a preset standard curve; S303: Update the accumulated regret based on the degree of data deviation.

[0037] In a possible implementation, step S303 includes: optimizing the accumulated regret based on the CTS algorithm and the feedback of the magnitude of the data offset, and updating the regret upper bound.

[0038] Specifically, the process of the CTS algorithm is as follows: (1) Initialize all base arms first. For each base arm, set ; (2) Open loop statement: t←t+1, for each basis arm i, from the Beta distribution Random Sampling ,remember ; (3) Calculation ; (4) Execute action S , get observed ; (5) Update a i , b i and ; (6) End the loop.

[0039] Specifically, the Beta distribution is: (3) Specifically, the method of accumulating regret upper bound is: When the expected reward value of the super arm and the reward expectation of the base arm meet the Lipschitz continuity condition, the cumulative regret upper bound O (mKlogT / ), where K is the maximum number of basic arms in all super arms, is the minimum difference between the optimal solution and the suboptimal solution.

[0040] Specifically, the Lipschitz continuity condition states that if a function f ( x ) satisfies the Lipschitz continuity condition, then for the function f (x ) for every pair of points and , there exists a real number L , so that the absolute value of the slope of the straight line connecting the two points does not exceed L . That is, the function f ( x ) is limited to a fixed range, which is determined by the Lipschitz constant L Decide.

[0041] S104, selecting other basic arms that have not been pulled to continue updating the accumulated regret; S105. Repeat the above operation for several rounds to obtain the optimal reward value in each basic arm that makes the accumulated regret meet the preset conditions.

[0042] In a possible implementation, step S105 includes: obtaining an optimal reward value in each base arm that makes the accumulated regret reach a global minimum.

[0043] S106. Optimizing the water quality test results based on the optimal reward value.

[0044] In a possible implementation, step S106 includes: The optimal reward value is used as the compensation value to compensate the water quality test result to obtain the optimized water quality test result.

[0045] like Figure 4 The present invention further provides an electronic device 40, comprising: A memory 410, used for storing programs; The processor 420 is coupled to the memory 410 and is used to execute the program stored in the memory 410 to implement the steps in the water quality detection optimization method described in any one of the above method items.

[0046] Figure 4 Only some of the components of the electronic device 40 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0047] In some embodiments, the processor 420 may be a central processing unit (CPU), a microprocessor or other data processing chip, which is used to run the program code or process data stored in the memory 410, such as the water quality detection optimization method of the present invention.

[0048] In some embodiments, the processor 420 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 420 may be local or remote. In some embodiments, the processor 420 may be implemented in a cloud platform. In one embodiment, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-cloud, etc., or any combination thereof.

[0049] In some embodiments, the memory 410 may be an internal storage unit of the electronic device 40, such as a hard disk or memory of the electronic device 40. In other embodiments, the memory 410 may also be an external storage device of the electronic device 40, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 40.

[0050] Furthermore, the memory 410 may include both an internal storage unit of the electronic device 40 and an external storage device. The memory 410 is used to store application software installed in the electronic device 40 and various data.

[0051] In one embodiment, when the processor 420 executes the water quality detection optimization program in the memory 410, the following steps may be implemented: A number of reward values ​​are set in each basic arm representing different environmental factors affecting water quality detection data, and all possible combinations of basic arms are defined as super arms; Assign any one of the collected environmental factors to the selected basic arm, and assign the collected environmental factor data to each basic arm accordingly, and randomly pull a basic arm to obtain feedback data; Update the accumulated regret of the super arm based on the feedback data; Select other basic arms except the selected basic arms and repeat the above operation until the preset maximum number of tests is reached; Obtain the optimal reward value in each basic arm that makes the accumulated regret meet the preset conditions; Optimize water quality test results based on the optimal reward value.

[0052] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 40 mentioned, and the electronic device 40 may be a portable device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, etc. Exemplary embodiments of portable devices include but are not limited to portable devices equipped with IOS, Android, Microsoft or other operating systems. The above-mentioned portable devices may also be other portable devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 40 may not be a portable device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0053] The present invention also provides a storage medium for storing computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the water quality detection optimization method described in any one of the above-mentioned method items.

[0054] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer storage medium, wherein the computer storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.

[0055] The above is a detailed introduction to a water quality detection optimization method, electronic device and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present invention, there will be modifications in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A water quality detection optimization method, characterized in that: include: A number of reward values ​​are set in each basic arm respectively representing different environmental factors affecting water quality detection data; The collected environmental factor data are distributed to each base arm accordingly, and a base arm is randomly pulled to obtain feedback data; Update accumulated regret based on feedback data; Select other base arms that have not been pulled to continue updating the accumulated regret; Repeat the above operation for several rounds to obtain the optimal reward value in each basic arm that makes the accumulated regret meet the preset conditions; Optimize water quality test results based on the optimal reward value.

2. The water quality detection optimization method according to claim 1, characterized in that: The method of setting a plurality of reward values ​​in each basic arm respectively representing different environmental factors affecting the water quality detection data includes: Determine the confidence interval and reward expectation of each basic arm based on the offline algorithm; The number of reward values ​​are set based on the confidence interval.

3. The water quality detection optimization method according to claim 1, characterized in that: The step of setting the plurality of reward values ​​based on the confidence interval includes: The plurality of reward values ​​are distributed and set within the confidence interval based on Thompson sampling.

4. The water quality detection optimization method according to claim 1, characterized in that: The collected environmental factor data is correspondingly distributed to each base arm, and a base arm is randomly pulled to obtain feedback data, including: After pulling the base arm, a reward value is randomly obtained; The reward value is added to or subtracted from the water quality detection data to obtain feedback data.

5. The water quality detection optimization method according to claim 1, characterized in that: The updating of accumulated regret based on feedback data includes: The combination of all the base arms is taken as a super arm, and the accumulated regret of the super arm is defined; Obtain the degree of data deviation of the feedback data compared to the preset standard curve; The accumulated regret is updated based on the magnitude of the data deviation.

6. The water quality detection optimization method according to claim 5, characterized in that: The updating of accumulated regret based on the magnitude of the data deviation degree includes: optimizing accumulated regret based on the CTS algorithm and the magnitude of the data deviation degree feedback, and updating the regret upper bound.

7. The water quality detection optimization method according to claim 1, characterized in that: The obtaining of the optimal reward value in each basic arm that enables the accumulated regret to satisfy a preset condition comprises: Get the optimal reward value in each basis arm that makes the accumulated regret reach the global minimum.

8. The water quality detection optimization method according to claim 1, characterized in that: The optimization of the water quality test results based on the optimal reward value includes: The optimal reward value is used as a compensation value to compensate the water quality test result to obtain an optimized water quality test result.

9. An electronic device, characterized in that: include: Memory, used to store programs; A processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the water quality detection optimization method described in any one of claims 1-8 above.

10. A storage medium, characterized in that: Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps of the water quality detection optimization method described in any one of claims 1 to 8.