Lake and reservoir water quality monitoring and early warning method, device, storage medium and electronic equipment

The water quality warning model is constructed through the sliding window method and the stochastic forest algorithm, and combined with the weighted average Nemero index method, the existing water quality prediction model is solved, and efficient water quality monitoring, early warning and comprehensive evaluation are achieved.

CN114386658BActive Publication Date: 2025-01-14BEIJING TENGINE INNOVATION INSTR
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111465941.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-03
Publication Date
2025-01-14
Estimated Expiration
2041-12-03

AI Technical Summary

Technical Problem

The existing water quality prediction model has problems in the field of water quality monitoring, such as low accuracy, only learning linear relationships, high training complexity, and inability to characterize the comprehensive water quality situation.

Method used

The sliding window method is used to construct a water quality parameter data set containing time sequence information, and the water quality early warning model is trained based on the stochastic forest algorithm, and the weighted average Nemero index method is used to calculate the water quality comprehensive pollution index to achieve continuous prediction and comprehensive evaluation of future water quality parameter changes. .

Benefits of technology

It improves the accuracy of water quality prediction, reduces the cost and calculation of model training, can output comprehensive water quality indicators at the current and future moments, and enhances the comprehensiveness and real-time nature of water quality monitoring and early warning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114386658B_ABST
    Figure CN114386658B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of water quality monitoring technology, and discloses a lake water quality monitoring and early warning method, device, storage medium and electronic equipment, including: constructing a water quality parameter data set, training and optimizing a water quality early warning model based on a random forest algorithm, and deploying water quality early warning models of different water quality indicators to a water quality early warning platform; the water quality early warning platform sets water quality parameters and calls a matching water quality early warning model for prediction, and obtains corresponding water quality indicators within a future continuous preset time; calculates the pollution index of each water quality indicator, and uses a weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time. The present invention can continuously predict the changes in water quality parameters within the future preset time, and at the same time predict the comprehensive water quality indicators at the current and future moments; users can timely understand the changes in water quality parameters within the current and future time periods through the platform, so as to take necessary measures in time to avoid further deterioration of water quality.
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 monitoring, and in particular to a lake water quality monitoring and early warning method, device, storage medium and electronic equipment. Background Art

[0002] Water quality monitoring and early warning is one of the hot topics in the field of water environment research. A large amount of data is collected through online water quality analyzers, and the inherent laws of the data are learned based on artificial intelligence models to mine the value of the data, analyze and predict the future development trend of water quality. Commonly used water quality prediction models can be divided into traditional time series autoregressive models, machine learning algorithm models and deep learning algorithm models. The existing water quality prediction model combines artificial intelligence algorithms with the field of water quality monitoring to improve the efficiency of computer analysis and data processing, but it also has the following shortcomings:

[0003] The traditional time series autoregressive model has a simple structure, but requires the data to be stable or to be stable after differentiation. It can only capture linear relationships but cannot learn nonlinear relationships.

[0004] The deep learning model designs a multi-layer network structure, uses neurons and activation functions to perform linear or nonlinear transformations on the original semantic matrix, and optimizes the loss function to make the model learn optimally. However, this model often requires a large number of training samples and a large number of matrix operations, so the training complexity is high and the training time is long.

[0005] Moreover, in the field of water quality monitoring, the output results of existing water quality prediction models are independent predicted values ​​of various water quality parameters, which cannot represent the comprehensive water quality situation. Summary of the invention

[0006] The technical problem to be solved by the present invention is to provide a lake water quality monitoring and early warning method, device, storage medium and electronic equipment in view of the problems existing in the prior art.

[0007] To solve the above technical problems, an embodiment of the present invention provides a lake water quality monitoring and early warning method, comprising: deploying water quality early warning models of different water quality indicators to a water quality early warning platform based on a Django framework; wherein the water quality early warning model training and optimization process for different water quality indicators comprises: constructing a water quality parameter data set containing time series information using a sliding window method; training and optimizing a water quality early warning model based on a random forest algorithm (RF) using the water quality parameter data set that has undergone data preprocessing; the water quality early warning platform sets water quality parameters, and calls a matching water quality early warning model for prediction, to obtain corresponding water quality indicators within a future continuous preset time; calculating the pollution index of each water quality indicator, and using a weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time.

[0008] The beneficial effects of the present invention are as follows: the present invention utilizes a sliding window method to construct a water quality parameter data set containing time series information, and trains a water quality prediction model based on a random forest algorithm, which can continuously predict changes in water quality parameters within a preset time in the future, overcoming the shortcomings of a traditional time series autoregressive model that has low prediction accuracy and can only learn linear relationships, and the model has fast training speed, small amount of calculation, and low training cost; and can output a comprehensive water quality index WQI at current and future times, thereby improving the comprehensiveness of water quality monitoring and early warning; users can use the platform to timely understand changes in water quality parameters within the current and future time periods, and thus take necessary measures in a timely manner to avoid water quality deterioration.

[0009] Based on the above technical solution, the present invention can also be improved as follows.

[0010] Furthermore, the water quality parameter data set containing time series information is constructed using the sliding window method, including: each water quality indicator within a preset time period is called a first water quality parameter, and each water quality indicator before the preset time period is called a second water quality parameter. Water quality parameter data sets for each water quality indicator are constructed based on the first water quality parameter data and the second water quality parameter data.

[0011] The beneficial effect of adopting the above further scheme is to transform the time series into supervised learning, use the sliding window method to construct a water quality parameter data set containing time series information, and then realize the training and optimization of the water quality early warning model.

[0012] Furthermore, the above technical solution also includes data preprocessing of the water quality parameter data set, specifically including: using a box plot to identify outliers in the water quality parameter data set and removing the outliers, and using the median to fill in missing values ​​in the water quality parameter data set.

[0013] The beneficial effect of adopting the above further scheme is that, through data preprocessing, outliers in the water quality parameter data set are eliminated, missing values ​​in the water quality parameter data set are filled, and the correctness and completeness of the water quality parameter data set are improved.

[0014] Furthermore, the above technical solution also includes feature engineering of the water quality parameter data set that has undergone data preprocessing, specifically including: deleting redundant features by analyzing the correlation coefficients between features, and saving the water quality parameter data set into an npy file after the feature engineering process is completed.

[0015] The beneficial effect of adopting the above further scheme is that redundant features can be deleted by analyzing the correlation coefficients between feature attributes, the water quality parameter data set can be simplified, and the amount of calculation can be reduced.

[0016] Furthermore, the water quality warning model based on the random forest algorithm is trained and optimized, including: the random forest algorithm generates multiple training subsets through the Bootstrap sampling method, multiple decision trees are obtained by parallel training using the generated multiple training subsets, the multiple decision trees obtain the final prediction result through the averaging method or the weighted averaging method, the optimal parameters of the water quality warning model are determined by the grid search algorithm, and after the model training and optimization are completed, the pickle library is called to solidify the water quality warning model.

[0017] The beneficial effect of adopting the above further scheme is that random forest is an integrated learning model with higher model accuracy compared with a single machine learning model; RF is composed of multiple decision trees, and there is no correlation between each decision tree in the forest, and the final output of the model is jointly determined by multiple decision trees; random forest generates multiple training subsets through the Bootstrap sampling method, which randomly generates data subsets, thereby improving the generalization ability of the model.

[0018] Furthermore, the formula for using the weighted average Nemerow index method to characterize the comprehensive water quality pollution index WQI within the current and future continuous preset time is as follows:

[0019]

[0020] Among them, max(I i ) is the maximum value of the pollution index of n water quality indicators; n is the number of water quality indicators; I i It is the pollution index of a single water quality indicator, which refers to the ratio of the measured value of the water quality indicator to the water quality concentration limit of the corresponding water body function category; wavg(I i ) is the weighted average of the pollution index of n water quality indicators, and the calculation formula is as follows:

[0021]

[0022] Among them, W i is the weight of the i-th water quality index, also known as the pollution contribution rate, that is, the weight is determined according to the single pollution index of each water quality index. The calculation formula is as follows:

[0023]

[0024] The beneficial effect of adopting the above further scheme is that the weighted average Nemerow index method is used to characterize the comprehensive water quality pollution index within the current and future continuous preset time, thereby improving the comprehensiveness of water quality detection and early warning.

[0025] Furthermore, during the operation of the water quality early warning platform, the newly generated data is used to regularly fine-tune the water quality early warning model, and the trained water quality early warning model is used to predict the pollution index of various water quality indicators.

[0026] The beneficial effect of adopting the above further solution is that after the model training is completed, a self-learning mechanism is introduced, which can re-learn the newly generated data, thereby improving the model's prediction accuracy and generalization ability.

[0027] In order to solve the above technical problems, an embodiment of the present invention provides a lake water quality monitoring and early warning device, comprising: a model deployment module, a model calling module and a comprehensive pollution index determination module;

[0028] Model deployment module, used to deploy water quality warning models with different water quality indicators to the water quality warning platform built based on the Django framework;

[0029] The training and optimization process of the water quality early warning model for different water quality indicators includes: constructing a water quality parameter data set containing time series information using a sliding window method; training and optimizing a water quality early warning model based on a random forest algorithm using the water quality parameter data set that has undergone data preprocessing;

[0030] The model calling module is used to set water quality parameters and call the matching water quality early warning model for prediction to obtain the corresponding water quality indicators within the future continuous preset time;

[0031] The comprehensive pollution index determination module is used to calculate the pollution index of various water quality indicators and use the weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time.

[0032] In order to solve the above technical problems, an embodiment of the present invention provides a computer-readable storage medium, including instructions. When the instructions are executed on a computer, the computer executes the lake water quality monitoring and early warning method according to the above technical solution.

[0033] To solve the above technical problems, an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the lake water quality monitoring and early warning method described in the above technical solution when executing the program.

[0034] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A flow chart of a lake water quality monitoring and early warning method provided by an embodiment of the present invention;

[0036] Figure 2 A structural diagram of a lake and reservoir water quality monitoring and early warning system provided by an embodiment of the present invention;

[0037] Figure 3 A structural diagram of a lake water quality monitoring and early warning device provided by an embodiment of the present invention;

[0038] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0039] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. 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 disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.

[0040] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.

[0041] Figure 1 Flow chart of the lake water quality monitoring and early warning method provided by the embodiment of the present invention. Figure 1 As shown, the method includes:

[0042] S110, deploy water quality early warning models with different water quality indicators to build a water quality early warning platform based on the Django framework;

[0043] Among them, the water quality early warning model training optimization process of different water quality indicators includes:

[0044] The overall process of water quality model training mainly includes steps such as dataset construction, data preprocessing, feature engineering, machine learning model training and preservation.

[0045] Dataset construction: The sliding window method is used to construct a water quality parameter dataset containing time series information. Model prediction parameters include but are not limited to water quality indicators such as temperature, pH value, dissolved oxygen, conductivity and turbidity.

[0046] Specifically, each water quality index within the preset time period is called the first water quality parameter, and each water quality index before the preset time period is called the second water quality parameter. The water quality parameter data set of each water quality index is constructed according to the first water quality parameter data and the second water quality parameter data. Taking water quality indicators such as temperature, pH value, dissolved oxygen, conductivity and turbidity as examples, the second water quality parameter data includes the feature space formed by the above five water quality indicators at t-1, t-2, ... t-8, and the first water quality parameter data can be the learning target formed by the above five water quality indicators at t+1, t+2, ... t+12, where t refers to a certain hour in the historical data.

[0047] Data preprocessing: Use box plots to identify and remove outliers in the water quality parameter data set, and use the median to fill in missing values ​​in the water quality parameter data set. Data preprocessing removes outliers in the water quality parameter data set, fills in missing values ​​in the water quality parameter data set, and improves the accuracy and completeness of the water quality parameter data set.

[0048] The water quality parameter data set that has undergone data preprocessing is subjected to feature engineering. The feature engineering process includes: removing redundant features by analyzing the correlation coefficients between feature attributes. After the feature engineering process is completed, the water quality parameter data set is saved as an npy file. Among them, npy is a file format used to store data. By analyzing the correlation coefficients between feature attributes, redundant features are removed, the water quality parameter data set is simplified, and the amount of calculation is reduced.

[0049] A water quality warning model based on a random forest algorithm (RF) is trained and optimized, including: the random forest algorithm generates multiple training subsets through a Bootstrap sampling method, multiple decision trees are obtained by parallel training using the generated multiple training subsets, the final prediction results are obtained by using an averaging method or a weighted averaging method for the multiple decision trees, the optimal parameters of the water quality warning model are determined using a grid search algorithm, and after the model training and optimization are completed, the pickle library is called to persist the water quality warning model.

[0050] Random forest is an integrated learning model with higher model accuracy compared with a single machine learning model. RF consists of multiple decision trees, and there is no correlation between each decision tree in the forest. The final output of the model is determined by multiple decision trees. Random forest generates multiple training subsets through the Bootstrap sampling method. This method randomly generates data subsets, thereby improving the generalization ability of the model.

[0051] S120, the water quality early warning platform sets water quality parameters, and calls a matching water quality early warning model for prediction, to obtain corresponding water quality indicators within a future continuous preset time.

[0052] After the model optimization training and optimization are completed, the water quality warning platform is built based on the Django framework with the water quality warning model as the core. Users select the prediction parameters through the drop-down list, and the platform calls the model to output the prediction results and visualizes the results to the front-end interface. For example, if the user selects the three water quality indicators of temperature, pH value and dissolved oxygen through the drop-down list, the water quality warning platform will call the water quality warning model with the prediction parameter of temperature, the water quality warning model with the prediction parameter of pH value and the water quality warning model with the prediction parameter of dissolved oxygen respectively, and predict the water quality temperature, pH value and dissolved oxygen in the future continuous preset time according to the three water quality warning models.

[0053] S130, calculating the pollution index of various water quality indicators, and using the weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time.

[0054] The weighted average Nemerow index method is used to characterize the comprehensive water quality pollution index WQI formula within the current and future continuous preset time as follows:

[0055]

[0056] Among them, max(I i ) is the maximum value of the pollution index of n water quality indicators; n is the number of water quality indicators; I i It is the pollution index of a single water quality indicator, which refers to the ratio of the measured value of the water quality indicator to the water quality concentration limit of the corresponding water body function category; wavg(I i ) is the weighted average of the pollution index of n water quality indicators, and the calculation formula is as follows:

[0057]

[0058] Among them, W i is the weight of the i-th water quality index, also known as the pollution contribution rate, that is, the weight is determined according to the single pollution index of each water quality index. The calculation formula is as follows:

[0059]

[0060] In this embodiment, the relevant data of the prediction results of the three water quality indicators of temperature, pH value and dissolved oxygen can be substituted into the above formula to obtain the comprehensive evaluation results of the three water quality indicators of temperature, pH value and dissolved oxygen that characterize the water quality at the current moment and in the future, thereby improving the comprehensiveness of water quality monitoring and early warning.

[0061] In the above embodiment, a water quality parameter data set containing time series information is constructed using a sliding window method, and a water quality prediction model is trained based on a random forest algorithm, which can continuously predict changes in water quality parameters within a preset time in the future, overcoming the shortcomings of low prediction accuracy of traditional time series autoregressive models and only being able to learn linear relationships, and the model training speed is fast, the amount of calculation is small, and the training cost is low; a water quality early warning platform is built based on the Django framework, so that the model can run stably in actual data, and the platform can realize the visualization of the prediction results of water quality prediction parameters; and the platform can output the comprehensive water quality index WQI at the current and future moments, thereby improving the comprehensiveness of water quality monitoring and early warning; users can use the platform to timely understand the changes in water quality parameters in the current and future time periods, so as to take necessary measures in time to avoid water quality deterioration.

[0062] Optionally, the water quality early warning platform also uses newly generated data to regularly fine-tune the water quality early warning model during operation, and uses the trained water quality early warning model to predict the pollution index of various water quality indicators. After the model training is completed, a self-learning mechanism is introduced to re-learn the newly generated data, thereby improving the model's prediction accuracy and generalization ability.

[0063] like Figure 2 As shown, an embodiment of the present invention provides a lake water quality monitoring and early warning system, including a data terminal, a server, a database and a water quality early warning platform. The data terminal sends the monitored water quality parameter data to the server and stores it in the MySQL database. The core work of the project is to train the water quality prediction model, design and develop related interfaces and presentation forms of the online platform. The algorithm and water quality prediction model are trained and optimized by the data department. The data set is loaded by reading the MySQL database. After the preprocessing is completed, a suitable machine learning algorithm is selected to train and optimize the water quality prediction model. After the model optimization is completed, the model is deployed to the online platform. The interface mainly includes constructing the model input vector and calling the water quality prediction model. The online platform includes setting prediction parameters, prediction step size and visualization of water quality prediction results.

[0064] like Figure 3 As shown, an embodiment of the present invention further provides a lake water quality monitoring and early warning device 300, including: a model deployment module 310, a model calling module 320 and a comprehensive pollution index determination module 330.

[0065] The model deployment module 310 is used to deploy water quality early warning models of different water quality indicators to a water quality early warning platform built based on the Django framework;

[0066] The training and optimization process of the water quality early warning model for different water quality indicators includes: constructing a water quality parameter data set containing time series information using a sliding window method; training and optimizing a water quality early warning model based on a random forest algorithm using the water quality parameter data set that has undergone data preprocessing;

[0067] The model calling module 320 is used to set water quality parameters and call the matching water quality early warning model for prediction to obtain the corresponding water quality indicators within the future continuous preset time;

[0068] The comprehensive pollution index determination module 330 is used to calculate the pollution index of each water quality index, and use the weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time.

[0069] The lake and reservoir water quality monitoring and early warning device of the embodiment of the present invention can execute the lake and reservoir water quality monitoring and early warning method provided by the embodiment of the present invention. The implementation principle is similar. The actions performed by each module and unit in the lake and reservoir water quality monitoring and early warning device in each embodiment of the present invention correspond to the steps in the lake and reservoir water quality monitoring and early warning method in each embodiment of the present invention. For the detailed functional description of each module of the lake and reservoir water quality monitoring and early warning device, please refer to the description in the corresponding lake and reservoir water quality monitoring and early warning method shown in the previous text, which will not be repeated here.

[0070] Among them, the above-mentioned lake and reservoir water quality monitoring and early warning device can be a computer program (including program code) running in an electronic device, for example, the lake and reservoir water quality monitoring and early warning device is an application software; the device can be used to execute the corresponding steps in the method provided in an embodiment of the present invention.

[0071] In some embodiments, the lake and reservoir water quality monitoring and early warning device provided by the embodiment of the present invention can be implemented in a combination of software and hardware. As an example, the lake and reservoir water quality monitoring and early warning device provided by the embodiment of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the lake and reservoir water quality monitoring and early warning method provided by the embodiment of the present invention. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs) or other electronic components.

[0072] In other embodiments, the lake water quality monitoring and early warning device provided by the embodiment of the present invention can be implemented in a software manner. Figure 3A lake water quality monitoring and early warning device stored in a memory is shown, which can be software in the form of programs and plug-ins, and includes a series of modules, including a model deployment module 310, a model calling module 320 and a comprehensive pollution index determination module 330, for implementing the lake water quality monitoring and early warning method provided in an embodiment of the present invention.

[0073] The modules involved in the embodiments of the present invention may be implemented by software or hardware, wherein the name of a module does not limit the module itself in some cases.

[0074] Based on the same principle as the method shown in the embodiments of the present invention, an electronic device is also provided in the embodiments of the present invention, which may include but is not limited to: a processor and a memory; the memory is used to store a computer program; the processor is used to execute the method shown in any embodiment of the present invention by calling the computer program.

[0075] In an alternative embodiment, an electronic device is provided, such as Figure 4 As shown, Figure 4 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present invention.

[0076] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0077] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0078] The memory 4003 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0079] The memory 4003 is used to store the application code (computer program) for executing the solution of the present invention, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the application code stored in the memory 4003 to implement the content shown in the above method embodiment.

[0080] The electronic device may also be a terminal device. Figure 4 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0081] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding contents of the aforementioned method embodiment.

[0082] According to another aspect of the present invention, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the methods provided in the implementation modes of the above-mentioned various embodiments.

[0083] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0084] It should be understood that the flow charts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the module, the program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0085] The computer-readable storage medium provided by the embodiment of the present invention may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, device, or device.

[0086] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0087] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) by each other.

Claims

1. A lake water quality monitoring and early warning method, characterized in that: include: Deploy water quality warning models with different water quality indicators to build a water quality warning platform based on the Django framework; The training and optimization process of the water quality early warning model for different water quality indicators includes: constructing a water quality parameter data set containing time series information using a sliding window method; training and optimizing a water quality early warning model based on a random forest algorithm using the water quality parameter data set that has undergone data preprocessing; The water quality early warning model based on the random forest algorithm is trained and optimized, including: the random forest algorithm generates multiple training subsets through the Bootstrap sampling method, multiple decision trees are trained in parallel using the generated multiple training subsets, the multiple decision trees obtain the final prediction result through the averaging method or the weighted averaging method, the optimal parameters of the water quality early warning model are determined by the grid search algorithm, and after the model training and optimization are completed, the pickle library is called to solidify the water quality early warning model; The water quality early warning platform sets water quality parameters, and the user selects the prediction parameters through the drop-down list, and calls the matching water quality early warning model for prediction to obtain the corresponding water quality indicators within the future continuous preset time; Calculate the pollution index of various water quality indicators, and use the weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time; The platform calls the model to output the prediction results and visualizes the results on the front-end interface.

2. The method according to claim 1, characterized in that The method of constructing a water quality parameter data set containing time series information using a sliding window method includes: The water quality indicators within the preset time period are called first water quality parameters; the water quality indicators before the preset time period are called second water quality parameters, and water quality parameter data sets for each water quality indicator are constructed based on the first water quality parameters and the second water quality parameters.

3. The method according to claim 1, characterized in that The water quality parameter data set is also preprocessed, specifically including: The outliers in the water quality parameter data set are identified and removed using a box plot, and the missing values ​​in the water quality parameter data set are filled using the median.

4. The method according to claim 1, characterized in that: It also includes feature engineering of water quality parameter datasets after data preprocessing, including: Redundant features are deleted by analyzing the correlation coefficients between features. After feature engineering, the water quality parameter dataset is saved as an npy file.

5. The method according to any one of claims 1 to 4, characterized in that: The formula for using the weighted average Nemerow index method to characterize the comprehensive water quality pollution index WQI within the current and future continuous preset time is as follows: Among them, max(I i ) is the maximum value of the pollution index of n water quality indicators; n is the number of water quality indicators; I i It is the pollution index of a single water quality indicator, which refers to the ratio of the measured value of the water quality indicator to the water quality concentration limit of the corresponding water body function category; wavg(I i ) is the weighted average of the pollution index of n water quality indicators, and the calculation formula is as follows: Among them, W i is the weight of the i-th water quality index, also known as the pollution contribution rate, that is, the weight is determined according to the single pollution index of each water quality index. The calculation formula is as follows:

6. The method according to any one of claims 1 to 4, characterized in that: During the operation of the water quality early warning platform, the newly generated data is also used to regularly fine-tune the water quality early warning model, and the trained water quality early warning model is used to predict the pollution index of various water quality indicators.

7. A lake water quality monitoring and early warning device, characterized in that: include: Model deployment module, model calling module and comprehensive pollution index determination module; Model deployment module, used to deploy water quality warning models with different water quality indicators to the water quality warning platform built based on the Django framework; The training and optimization process of the water quality early warning model for different water quality indicators includes: constructing a water quality parameter data set containing time series information using a sliding window method; training and optimizing a water quality early warning model based on a random forest algorithm using the water quality parameter data set that has undergone data preprocessing; The water quality early warning model based on the random forest algorithm is trained and optimized, including: the random forest algorithm generates multiple training subsets through the Bootstrap sampling method, multiple decision trees are trained in parallel using the generated multiple training subsets, the multiple decision trees obtain the final prediction result through the averaging method or the weighted averaging method, the optimal parameters of the water quality early warning model are determined by the grid search algorithm, and after the model training and optimization are completed, the pickle library is called to solidify the water quality early warning model; The model calling module is used to set water quality parameters and call the matching water quality early warning model for prediction to obtain the corresponding water quality indicators within the future continuous preset time; A comprehensive pollution index determination module is used to calculate the pollution index of various water quality indicators and use the weighted average Nemerow index method to characterize the comprehensive water quality pollution index within the current and future continuous preset time; The user selects the prediction parameters through the drop-down list, and the platform calls the model to output the prediction results and visualizes the results on the front-end interface.

8. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on a computer, the computer is enabled to execute the lake water quality monitoring and early warning method according to any one of claims 1 to 6.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the lake water quality monitoring and early warning method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Comprehensive underground water quality early warning method

    CN106932549A

  • Long-short-term memory network water quality dynamic early warning method based on seasonal decomposition

    CN112215422A

  • Water quality monitoring and early warning system and method

    CN113125663A