Water quality safety monitoring and early warning method based on big data
By combining the support vector machine model with time series analysis and spatiotemporal kriging interpolation, the problem that existing water quality assessment models cannot capture parameter coupling relationships has been solved. This has enabled accurate evaluation of water quality parameters and precise location of pollution sources, thereby improving the accuracy of water quality safety monitoring and early warning, as well as the efficiency of treatment.
Patent Information
- Application Number
- CN202511703884.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-02-10
AI Technical Summary
Existing big data-based water quality safety monitoring and early warning methods cannot capture the coupling relationship between parameters, and fixed proportional coefficients cannot dynamically match these correlation effects, making it difficult for evaluation results to reflect the true water quality status.
A support vector machine-based improved model was adopted, combined with time series analysis and spatiotemporal kriging interpolation. The model parameters were optimized using information gain and slime mold optimization algorithms to construct a nonlinear water quality evaluation model. The attribution analysis module was used to identify key pollution sources and pollution diffusion paths, and a multivariate collaborative interpolation prediction method was used to simulate pollution diffusion.
It enables precise evaluation of water quality parameters and accurate location of pollution sources, improves the accuracy of pollution early warning and treatment efficiency, shortens the time for investigating the causes of pollution, and enhances the precision and efficiency of water quality management.
Smart Images

Figure CN121499762A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of monitoring and early warning engineering, specifically to a water quality safety monitoring and early warning method based on big data. Background Technology
[0002] With the increasing complexity of issues such as industrial wastewater discharge and agricultural non-point source pollution, water pollution is characterized by a complex interplay of multiple factors, correlation of multiple parameters, and dynamic changes across multiple scenarios. Big data, by integrating multi-source data such as water quality sensors, meteorological and hydrological data, and pollution source tracing, and subsequently connecting with model analysis, enables real-time assessment and risk prediction of water quality status. This not only allows for timely identification of pollution hazards and blocking of diffusion paths but also provides data support for pollution control, making it a key technological direction for improving water environment management.
[0003] Existing big data-based water quality safety monitoring and early warning methods primarily rely on collecting basic parameters affecting water quality and calculating a comprehensive water quality value using a linear weighting formula with fixed proportional coefficients. The safety of the water quality is then judged based on a comparison between this comprehensive water quality value and a preset threshold. The main problem with these existing big data-based methods is that the water quality assessment model is overly simplistic. The linear weighting formula only reflects the independent contribution of parameters and fails to capture the coupling relationships between them. Furthermore, the fixed proportional coefficients cannot dynamically match these correlated effects, making it difficult for the assessment results to reflect the true state of water quality. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a water quality safety monitoring and early warning method based on big data, which solves the problems of being unable to capture the coupling relationship between parameters and the inability of fixed proportional coefficients to dynamically match these correlation effects.
[0005] To achieve the above objectives, the present invention provides a water quality safety monitoring and early warning method based on big data, comprising the following steps: Step S1: Divide the sampling points according to the area, set scene labels for the sampling points, and deploy sensors at the sampling points based on the scene labels to obtain water quality information through the sensors; Step S2: Establish a water quality evaluation model based on the improved model of support vector machine, input the water quality information into the water quality evaluation model, output the water quality category, and divide the sampling points into normal sampling points and key sampling points according to the water quality category; Step S3: Based on the water quality information of the normal sampling points, use the time series analysis method LSTM to predict the water quality safety of the normal sampling points, obtain the prediction results, and carry out graded early warning according to the prediction results; Step S4: Based on the water quality information of the key sampling points, the pollution source of the key sampling points is located using the spatiotemporal kriging interpolation method to obtain the pollution source location. Based on the pollution source location, the pollution diffusion path is simulated using the multivariate collaborative interpolation prediction method to obtain the simulated pollution diffusion path. Step S5: Based on the graded early warning results of the normal sampling points and the simulated pollution diffusion path of the key sampling points, the water quality safety monitoring and early warning results are obtained.
[0006] Preferably, sampling points are divided according to the region, and scene labels are set for the sampling points, including: Based on the geographical features and functional zoning of the water area, the main channel of the river, the confluence of tributaries, the drinking water source protection area, the downstream of industrial sewage outlets, and the agricultural non-point source pollution area are distinguished. The sampling area is divided using a systematic grid method, and each sampling point is assigned a scene label to distinguish the industrial impact area, the agricultural non-point source area, and the ecologically sensitive area.
[0007] Preferably, sensors are deployed at sampling points based on the scene labels, and water quality information is obtained through the sensors, including: Based on the scene labels of the sampling points, differentiated sensors are deployed at the sampling points. For data specific to the scene labels, differentiated parameters are collected. In industrial impact areas, heavy metal sensors are added, and inductively coupled plasma mass spectrometry is used to monitor lead and chromium concentrations online. In agricultural non-point source areas, nitrate sensors are installed to detect nitrogen pollution based on ultraviolet absorption. In ecologically sensitive areas, chlorophyll a sensors are added, and fluorescence probes are used to monitor algal biomass.
[0008] Preferably, the water quality assessment model includes: The water quality assessment model consists of two core modules connected in series: the water quality assessment module and the attribution analysis module. The water quality assessment module is based on the IG-ISMA-SVM classification model. The water quality assessment module first uses information gain IG to perform feature selection, and selects the key water quality parameters that have the greatest impact on water quality assessment from all water quality parameters obtained in step S1. IG is calculated based on the reduction of information entropy, and its formula is as follows:
[0009]
[0010] in, is the information gain of feature A; the larger the value, the more important the feature is for classification. S is the training dataset containing water quality parameters and category labels. Feature A is a specific water quality parameter, whose possible values include total nitrogen and pH. Entropy(S) is the information entropy of dataset S, representing a measure of its overall uncertainty. is the proportion of the k-th type of sample in S; K is the number of categories, from water quality categories I to V; These are all possible values for attribute A; It is a subset of attribute A with a value of v in S; by calculating the IG value of each attribute, the module selects the top N indicators with higher IG values as input features; typical feature selection results include, but are not limited to, total phosphorus TP, permanganate index CODMn, pH, heavy metal chromium Cr, total nitrogen TN, and nitrate NO3-N. These determined representative parameters can effectively reflect the pollution characteristics of different scenarios and serve as inputs for subsequent SVM models. Next, the module uses the ISMA algorithm, which incorporates multiple strategies to improve the slime mold optimization algorithm, to optimize the parameters of the support vector machine (SVM). The formula for calculating the fitness weight coefficient is as follows:
[0011] Where W is the fitness weight coefficient; It is the fitness value of the i-th slime mold; and These are the current best and worst fitness values, respectively; when S(i) is better than the average fitness value of the population, that is, when the value of S(i) is less than the average fitness value, then... We assign weights greater than 1, i.e., W>1; when S(i) is worse than or equal to the average fitness value of the population, i.e., the value of S(i) is greater than or equal to the average fitness value, we use... To assign a weight less than 1, i.e., W < 1; The ISMA algorithm position update formula is:
[0012] in, This represents the location of the slime mold in the current iteration, corresponding to the SVM parameters; This is the current optimal position; and It is a random parameter. ∈[-a,a], ∈[-1,1], a is an adaptive parameter used to control the convergence of the search range with iteration, a= t is the current iteration number; T is the maximum iteration number; r is a random number in the range [0,1]; p is a probability threshold that controls whether the algorithm performs exploration or development. At this time, a development strategy is executed, meaning the algorithm considers the current region to have great potential and performs a local search to find the optimal point within that region, thus enhancing the algorithm's local search capability; r At time p, an exploration strategy is executed, performing a large-scale search in the global search space, which enhances the algorithm's global search capability; ISMA obtains the optimal parameter combination by optimizing the penalty factor C of SVM and the radial basis kernel function parameter g. and ; The formula for calculating the probability threshold p is as follows:
[0013] Where DF is the currently known optimal fitness value; It is the fitness value of the i-th slime mold; After optimization, the SVM model is used for classification. For the C-SVM model, the calculation formula is:
[0014] Where w is the normal vector of the hyperplane; b is the bias term; is a slack variable; m is the total number of samples in the training dataset; C is the penalty factor, obtained by ISMA optimization; The constraints are as follows:
[0015] in, It is the input feature vector, i.e., the filtered water quality parameters; This is a water quality category label, using radial basis function kernels to handle nonlinear problems. The kernel function calculation formula is:
[0016] in, is the kernel function, which maps the data to a high-dimensional space for linear partitioning; g is the kernel parameter, obtained by ISMA optimization. The decision function formula is:
[0017] in, It is the optimal solution of the Lagrange multipliers obtained by ISMA optimization; This is the optimal bias; the module outputs water quality category labels. For example, Class I, Class II; n is the number of support vectors; The water quality assessment module provides a preliminary water quality category output, but in order to gain a deeper understanding of the causes of water quality conditions, especially for sampling points with poor assessments, further attribution analysis is needed. Therefore, the model will then activate the attribution analysis module. The attribution analysis module analyzes the causes of water pollution. This module aims to identify key parameters and pollution sources leading to poor water quality. It first calculates the Comprehensive Water Quality Index (WQI) to assess the overall water quality. The formula for calculating the WQI is as follows:
[0018]
[0019] in, It is the comprehensive water quality index, and the higher the value, the better the water quality; n is the number of water quality parameters involved in the evaluation. The parameters involved in the calculation include the key parameters selected by IG features, as well as other auxiliary parameters. It is the normalized value of the i-th parameter, obtained by comparing the measured value with the limit value of the "Surface Water Environmental Quality Standard" and then performing linear normalization. It is the measured value of the i-th parameter. and These are the minimum and maximum limits for this parameter in the standard; This is the weight of the i-th parameter. The weight is determined with reference to the relevant requirements in the "Surface Water Environmental Quality Standard". The WQI value ranges from 0 to 100. The higher the value, the better the water quality. Usually, WQI < 60 indicates poor water quality, corresponding to Class III or below. For sampling points with WQI < 60, the module calculates the contribution rate of each water quality parameter to the polluted water quality. The calculation formula is as follows:
[0020] in, It is the contribution rate of the i-th parameter to water pollution; It is the normalized value of the i-th parameter in the dataset. The sample frequency is less than 60, which means the number of times the parameter exceeds the standard; m is the total number of water quality parameters, and the parameter with the highest contribution rate is identified as the main pollutant; The attribution analysis module provides in-depth insights into the underlying causes of water quality conditions, thus offering a more comprehensive basis for the classification of sampling points; Ultimately, the model integrates the outputs of the two modules to make a decision, and the model will use the category output by the water quality assessment module. The WQI value and attribution conclusions output by the attribution analysis module are integrated.
[0021] Preferably, the sampling points are divided into normal sampling points and key sampling points, including: Normal sampling points, if Water classified as Class I or Class II with a WQI ≥ 60 indicates good water quality and no significant pollution. Key sampling points, if If the water quality is Class III or below, or WQI < 60, it indicates poor water quality and is marked as a key sampling point, with an attribution analysis report attached, including the main contributing parameters and pollution source types.
[0022] Preferably, based on the water quality information of the normal sampling points, the water quality safety of the normal sampling points is predicted using the time series analysis method LSTM, and the prediction results include: Historical water quality data from normal sampling points are preprocessed to form the time-series samples required for the model; assuming a certain sampling point has continuous time points... , , ..., The water quality parameter vector sequence is X=( , , ..., ), where the input vector at each time step ∈ The model includes measured values of water quality parameter d; it employs a supervised learning format with multivariate input and multivariate output; and it introduces a dynamic time window mechanism, where the window length T can be dynamically adjusted according to the frequency of water pollution events. The adjustment strategy is as follows: During periods of high-frequency events, when the system detects that the frequency of pollution warnings has exceeded the threshold in the past week, it automatically shortens T to a smaller value. This aims to focus on water quality data that has changed drastically in the past, quickly capture the characteristics of sudden pollution, and improve the model's response speed to acute events. During periods of low-frequency stability, when the frequency of pollution events is below the threshold, T is extended to a larger value. This aims to utilize historical data over a longer period of time to capture the long-term trends and periodic patterns of slow changes in water quality and improve the ability to predict slow-onset pollution. This mechanism enables the model to be adaptive, rather than relying on a single fixed scale; The LSTM network structure contains two hidden layers, with 64 and 32 neurons per layer, respectively, and uses a Dropout layer with a dropout rate of 0.2 to prevent overfitting. Based on the original Dropout layer, a temporal attention mechanism layer is introduced after the two LSTM hidden layers and before the final output layer. This improvement effectively enhances the ability to capture temporal features of key contamination parameters. The specific workflow of this attention mechanism is as follows: This layer first automatically learns and computes the hidden state at each time step of the second-layer LSTM output. Importance weight Its calculation formula is ,in, It is a score calculated by a feedforward neural network, reflecting the criticality of the information at that time step to the current prediction task; it generates a context vector containing the hidden states of all time steps. According to its corresponding attention weight A weighted summation is performed to generate a context vector c that incorporates all key information. Finally, this context vector c is used as a more informative feature representation and input into the final fully connected output layer to predict water quality for the next k=24 hours. The sequence was divided into training and testing sets and normalized to eliminate the influence of dimensions. The normalization formula is:
[0023] in, It is the original measured value of a certain water quality parameter; μ and σ are the mean and standard deviation of each feature in the training set, respectively, obtained through statistical calculation. The LSTM model captures long-term dependencies in a sequence through its gating mechanism; for each time step t, the updates of the cell state and hidden state are jointly controlled by the input gate, forget gate, and output gate; the specific calculation process is as follows:
[0024]
[0025]
[0026]
[0027]
[0028]
[0029] In the above formula, It's the forgetting gate, which determines the state of the previous cell. What information is discarded? It is the input gate, which controls the degree to which the current input information updates the cell state; It is a candidate cell state; This is the result of cell state update; It is the output gate, which determines the output in the current hidden state; This is the final hidden state; It is the input data at time t, that is, the normalized water quality parameter vector; It represents the hidden state at time t-1 and is one of the memory carriers of LSTM; σ represents the sigmoid activation function, and tanh is the hyperbolic tangent activation function; , , , and , , , These are the weight matrix and bias vector for each gate, respectively. These parameters are learned by the model through the training process; ∘ represents element-wise multiplication; This means concatenating vectors together; The model learns parameters to minimize prediction error through training, and its training objective is to predict water quality parameter values for the next k steps:
[0030] in, It is the predicted value at time point t. ∈ ; and These are the weights and biases of the output layer, which are also training parameters. The model uses the mean squared error (MSE) as the loss function, calculated as follows:
[0031] in, is the loss value, representing the magnitude of the prediction error; N is the number of samples; It is the actual value; It is the model's prediction of the i-th sample. All parameters are iteratively optimized through the backpropagation algorithm to minimize the loss function. After the model is trained, it is applied to the latest normal sampling point time series data to output the prediction results, namely the predicted sequence of water quality parameters for k time points in the future. .
[0032] Preferably, the tiered early warning based on the prediction results includes: Based on the prediction results, tiered early warnings are issued. The predicted values are compared with the water quality safety threshold, namely the Class III water standard limit in the "Surface Water Environmental Quality Standard," and multi-level early warning thresholds are set. The judgment rules are as follows: A blue alert is issued when one or more predicted parameters consistently approach the standard limit, reaching 80% of the limit but not exceeding it, indicating a potential risk to water quality that requires close monitoring. A yellow alert is issued when one or more predicted parameters exceed the standard limit, reaching 100%-120% of the limit, indicating that the water quality has exceeded the standard and there is a risk of slight pollution, requiring an investigation. An orange alert is issued when the predicted value of one or more important parameters significantly exceeds the standard, reaching 120%-150% of the limit, indicating a high risk of water quality deterioration and requiring preparation for intervention measures. A red alert is issued when multiple key parameters are predicted to exceed the limits by 150%, indicating a significant risk of a water quality safety incident and requiring immediate activation of the emergency response.
[0033] Preferably, based on the water quality information of the key sampling points, the pollution source at the key sampling points is located using spatiotemporal kriging interpolation. The pollution source location includes: Based on a complete water quality dataset, spatiotemporal kriging interpolation is used to locate pollution sources at key sampling points. This method models the co-variance characteristics of space and time through a spatiotemporal variability function, which is defined as:
[0034] in, It is the value of the spatiotemporal variogram, representing the distance in space. Time distance is Under these conditions, the average difference between water quality observations is half; the larger the value, the weaker the correlation between the two points. Spatial lag distance refers to the straight-line spatial distance between two sampling points; It is the time lag distance, which refers to the time interval between two sampling points; This corresponds to the number of point pairs within the lag distance, which is the number of points in all observed data, with a spatial distance of approximately [missing information]. And the time distance is approximately The total number of valid point pairs (i,j); In position ,time Observed values of water quality parameters; By optimizing the weighting coefficients The following formula is used to solve the Kriging equations:
[0035] in, It is a spacetime variogram; These are Lagrange multipliers used to satisfy the constraints of unbiased estimation; The number of key sampling points is known; These are the spatial coordinates of the point to be estimated, i.e., the location of the suspected pollution source; It is a timestamp, i.e., the time when the pollution occurred; weighting coefficient. It is obtained by solving a system of linear equations; Location of final pollution source The estimated value is calculated by weighted summation:
[0036] in, At the point to be estimated Estimated pollutant concentrations; It is the weight assigned to the i-th known monitoring point; It is the actual pollutant concentration value measured at the i-th known monitoring point; This process maximizes the spatial-temporal correlation to invert the extreme regions of the pollution concentration field, thereby achieving precise location of pollution sources.
[0037] Preferably, the pollution diffusion path is simulated using a multivariate collaborative interpolation prediction method, and the simulated pollution diffusion path includes: After obtaining the pollution source location results, the pollution diffusion path was simulated using a multivariate collaborative interpolation prediction method. By introducing auxiliary variables, flow velocity and wind direction, a cross-variability function was constructed. The spatiotemporal correlation among multiple variables is quantified using the following formula:
[0038] in, It is the cross-variogram value, used to measure the core pollutant. with auxiliary variables At a specific spatiotemporal distance The larger the value of the covariance, the more dramatic the covariance of the two variables at that spatiotemporal scale. It refers to the measured concentration value of the core pollution indicator at spatial location s and time point t; The spatial distance from point (s,t) is Time distance is The measured values of auxiliary environmental variables at another point; It is a covariance operator used to measure the linear correlation between two random variables. It predicts the concentration distribution on the diffusion path through multivariate co-interpolation, generates a spatiotemporally continuous pollution diffusion simulation field, and obtains the simulated pollution diffusion path.
[0039] Preferably, based on the graded early warning results of the normal sampling points and the simulated pollution diffusion paths of the key sampling points, the water quality safety monitoring and early warning results include: The graded early warning results of normal sampling points are analyzed. These early warning results include different warning levels, each corresponding to a specific risk level. Blue warnings indicate potential risks, and red warnings indicate major risks. At the same time, key information such as the diffusion range, concentration distribution, movement direction, and temporal evolution of pollutants are extracted from the simulated pollution diffusion paths of key sampling points. These paths are generated based on the spatiotemporal kriging interpolation method, which can visualize the dynamic spread of pollution in space and time. Next, spatial overlay and temporal alignment techniques are used to match the warning area with the diffusion path. Specifically, the warning map of normal sampling points is overlaid with the pollution diffusion simulation map of key sampling points to identify high-risk overlapping areas. If a normal sampling point is in a red warning state and its location coincides with the high concentration area of the pollution diffusion path, the area is marked as an "emergency risk area". The matching process takes into account the time dimension to ensure that the warning and the diffusion path are synchronized within the same time window to avoid false alarms. Based on the matching results, a water quality safety monitoring and early warning result is generated. The water quality safety monitoring and early warning result includes the following content: The overall safety status report describes the water quality conditions across the entire area, such as "generally safe," "locally polluted," or "widespread risk," along with the main affected indicators. The risk classification output details the risk levels of different areas: "Low-risk area" (blue warning with no overlapping diffusion), "Medium-risk area" (yellow warning overlapping with mild diffusion, mild diffusion is defined as an area where the concentration value exceeds the standard limit but is less than twice the limit), and "High-risk area" (orange or red warning overlapping with high diffusion, high diffusion is defined as an area where the concentration value exceeds twice the standard limit). Anomaly event log is used to identify and record anomaly events based on the risk classification output results and the simulated pollution diffusion path; the anomaly events include pollution hotspot events and abrupt changes in diffusion trends; each anomaly event log includes at least the following fields: event type, occurrence time, occurrence location, abnormal values of one or more associated water quality parameters, and the cause of the anomaly determined based on the output of the attribution analysis module.
[0040] This invention provides a water quality safety monitoring and early warning method based on big data, involving machine learning and deep learning technologies, which has the following beneficial effects: (1) This big data-based water quality safety monitoring and early warning method breaks through the limitations of traditional linear weighting by optimizing the model parameter weights through ISMA. It constructs a nonlinear water quality evaluation model by combining the coupling relationship between water quality parameters and environmental parameters. It quantifies the correlation effect of "water temperature-dissolved oxygen" and "flow velocity-phosphorus content" by introducing interaction terms. At the same time, it uses the information gain algorithm to remove redundant features, thereby improving the accuracy of water quality evaluation. It solves the problem of insufficient accuracy caused by the simplicity of the model and unreasonable parameter weights in the existing technology, and provides a precise data foundation for pollution early warning.
[0041] (2) This big data-based water quality safety monitoring and early warning method incorporates an attribution analysis module into the water quality evaluation model. After calculating the comprehensive water quality index (WQI) and screening out polluted samples with WQI < 60, it further quantifies the contribution rate of each water quality parameter to pollution, accurately identifying the main pollutants. Simultaneously, by combining sampling point scene labels with pollution source types, it overcomes the limitation of existing technologies that can only determine water quality anomalies but cannot trace the source. This design eliminates the need for maintenance personnel to blindly check all parameters, allowing them to directly formulate treatment plans for key pollutants, shortening the time for investigating pollution causes, avoiding waste of treatment resources, and significantly improving the accuracy and efficiency of pollution control.
[0042] (3) This big data-based water quality safety monitoring and early warning method can trace the contribution ratio of key pollution parameters in reverse through high-precision water quality evaluation results, and locate the main pollution sources by combining spatiotemporal distribution data; at the same time, it can match targeted governance strategies for different types of pollution, improve the efficiency of resource input for pollution control, and form a closed-loop system of "precise evaluation - source tracing and location - efficient governance".
[0043] (4) This big data-based water quality safety monitoring and early warning method addresses the problem of high data loss caused by sensor failure and environmental interference in water quality monitoring. Before spatiotemporal kriging interpolation, it uses the Convolutional Transformer Inference Network (CTIN) to fill in the data, captures the local contextual relationships of water quality data using 1D convolutional layers, models global spatiotemporal dependence using a multi-head self-attention mechanism, and introduces learnable timestamps to encode absolute time information to avoid data bias caused by existing technologies, providing a high-quality data foundation for subsequent spatiotemporal kriging interpolation. Ultimately, it reduces the deviation in pollution source location, improves the matching degree between pollution diffusion simulation and actual working conditions, and ensures the reliability of source tracing and diffusion analysis. Attached Figure Description
[0044] Figure 1 This is a flowchart of a water quality safety monitoring and early warning method based on big data proposed in this invention.
[0045] Figure 2 This invention presents a hierarchical diagram for distinguishing sampling points in a water quality safety monitoring and early warning method based on big data.
[0046] Figure 3 This is a hierarchical diagram of water quality evaluation and anomaly warning obtained in a water quality safety monitoring and early warning method based on big data proposed in this invention. Detailed Implementation
[0047] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Please see Figure 1 This invention provides a technical solution: a water quality safety monitoring and early warning method based on big data. Specifically, the following water quality safety monitoring and early warning method based on big data is provided; please refer to [link / reference]. Figure 1 The method includes the following steps: Step S1: Divide the sampling points according to the area, set scene labels for the sampling points, deploy sensors at the sampling points based on the scene labels, and obtain water quality information through the sensors.
[0049] First, based on the geographical characteristics and functional zoning of the water area, the main river channel, tributary confluences, drinking water source protection areas, downstream areas of industrial discharge outlets, and agricultural non-point source pollution areas were distinguished. A systematic grid method was used to divide the sampling area, and a scene label was assigned to each sampling point, differentiating between industrial impact areas, agricultural non-point source areas, and ecologically sensitive areas. The labeling must be based on remote sensing image interpretation and field survey results to ensure it conforms to the actual environmental characteristics.
[0050] During the data collection phase, a basic sensor network was first deployed at all sampling points to collect common parameters for all scenarios. This included collecting hydrogen ion concentration using a pH sensor (measurement range 0-14, accuracy ±0.1), obtaining water oxygen content using a dissolved oxygen sensor (based on fluorescence principle, range 0-20 mg / L), and monitoring phosphorus content using a total phosphorus sensor (using ammonium molybdate spectrophotometry, detection limit 0.01 mg / L). This data was automatically collected hourly and uploaded to the cloud platform via IoT terminals.
[0051] Based on the scene labels of the sampling points, differentiated sensors are deployed at the sampling points. For data specific to each scene label, additional differentiated parameters are collected. For example, heavy metal sensors are added in industrial impact areas, using inductively coupled plasma mass spectrometry to monitor lead and chromium concentrations online; nitrate sensors are installed in agricultural non-point source pollution areas to detect nitrogen pollution using ultraviolet absorption; and chlorophyll a sensors are added in ecologically sensitive areas, using fluorescence probes to monitor algal biomass. The collection rules for specific data are synchronized with the general parameters, but the sampling frequency needs to be adjusted according to the scene risk level: once every 30 minutes in high-risk areas and once every 2 hours in low-risk areas.
[0052] All raw data needs to be preprocessed to improve data quality. First, a sliding window method is used for outlier removal. The window size is defined as 5 consecutive sampling periods. If a data point deviates from the median within the window by more than 3 times the absolute median deviation (MAD), it is marked as an outlier and removed. The mathematical expression is as follows:
[0053]
[0054] in, X is the abnormal threshold; X is the data sequence within the window. This is the original data value that is currently being examined; It is the median of the sample data within the window, that is, the middle value after all data points in the window are sorted by size; It is the absolute median, which is the median of the absolute values of the deviations of all data points from their median. This is a sensitivity constant used to control the strictness of outlier detection. Subsequently, spatiotemporal co-imputation is performed on the missing data. An imputation model based on Kriging interpolation is constructed, with the following expression:
[0055] in, The position to be interpolated The estimated value at that location; These are weighting coefficients, assigned to the i-th known monitoring point. The weighting coefficients are determined through optimization using a variogram model; It is at the i-th known monitoring point The actual measured values at each location. Finally, a standardized dataset with unified timestamps and quality identifiers is generated for subsequent analysis.
[0056] Step S1, as the data foundation stage of the entire water quality monitoring and early warning process, plays a crucial role in constructing a standardized, multi-dimensional, and high-quality raw water quality database. Through a systematic regional division and scene labeling system, not only is scientific spatial coverage of sampling points achieved, but more importantly, it provides a data classification basis for subsequent differentiated analysis. The pollution characteristic identifiers of industrial and agricultural areas directly determine the direction of model selection and parameter optimization in S2. Simultaneously, the outlier removal and spatiotemporal interpolation algorithms used in the data preprocessing stage significantly improve the reliability and consistency of the data. This plays a decisive role in the accuracy of the water quality evaluation model in S2 (such as SVM classification accuracy) and the reliability of time-series prediction and diffusion simulation in S3-S4. Essentially, the structured dataset output from S1 is both the input foundation for the entire big data analysis and a core prerequisite for ensuring the accuracy of the final early warning and the effectiveness of source tracing.
[0057] Step S2: Establish a water quality evaluation model based on the improved model of support vector machine, input the water quality information into the water quality evaluation model, output the water quality category, and divide the sampling points into normal sampling points and key sampling points according to the water quality category.
[0058] This step aims to construct a comprehensive water quality assessment model based on an improved support vector machine model. This model processes the input water quality information from sampling points, outputs water quality categories, and completes the classification of sampling points. The model consists of two core modules connected in series: a water quality assessment module and an attribution analysis module.
[0059] The water quality assessment module, based on the IG-ISMA-SVM classification model, first utilizes Information Gain (IG) for feature selection, filtering out the key water quality parameters with the greatest impact on the assessment from all water quality parameters obtained in step S1. The calculation of IG is based on the reduction of information entropy, and its formula is as follows:
[0060]
[0061] in, is the information gain of feature A; the larger the value, the more important the feature is for classification. S is the training dataset containing water quality parameters and category labels. Feature A is a specific water quality parameter, whose possible values include total nitrogen and pH. Entropy(S) is the information entropy of dataset S, representing a measure of its overall uncertainty. is the proportion of the k-th type of sample in S; K is the number of categories, from water quality categories I to V; These are all possible values for attribute A; This is a subset of attribute A in S with a value of v. By calculating the IG value of each attribute, the module selects the top N indicators with higher IG values as input features. Typical feature selection results include, but are not limited to, total phosphorus (TP), permanganate index (CODMn), pH, heavy metal chromium (Cr), total nitrogen (TN), and nitrate (NO3-N). These determined representative parameters can effectively reflect the pollution characteristics of different scenarios (such as industrial and agricultural areas) and serve as inputs for subsequent SVM models.
[0062] Next, the module uses the ISMA algorithm, which incorporates multiple strategies to improve the slime mold optimization algorithm, to optimize the parameters of the support vector machine (SVM).
[0063] The formula for calculating the fitness weight coefficient is as follows:
[0064] Where W is the fitness weight coefficient; It is the fitness value of the i-th slime mold; and These are the current best and worst fitness values, respectively; when S(i) is better than the average fitness value of the population, that is, when the value of S(i) is less than the average fitness value, then... We assign weights greater than 1, i.e., W>1; when S(i) is worse than or equal to the average fitness value of the population, i.e., the value of S(i) is greater than or equal to the average fitness value, we use... We assign weights less than 1, i.e., W < 1.
[0065] The ISMA algorithm position update formula is:
[0066] in, This represents the location of the slime mold in the current iteration, corresponding to the SVM parameters; This is the current optimal position; and It is a random parameter. ∈[-a,a], ∈[-1,1], a is an adaptive parameter used to control the convergence of the search range with iteration, a= ; t is the current iteration number; T is the maximum iteration number, when At this time, a development strategy is executed, meaning the algorithm considers the current region to have great potential and performs a local search to find the optimal point within that region, thus enhancing the algorithm's local search capability; r When p is reached, an exploration strategy is executed, performing a large-scale search in the global search space, enhancing the algorithm's global search capability; r is a random number in the range [0,1]; p is a probability threshold that controls whether the algorithm performs exploration or development. ISMA obtains the optimal parameter combination by optimizing the penalty factor C of SVM and the radial basis kernel function parameter g. and .
[0067] The formula for calculating the probability threshold p is as follows:
[0068] Where DF is the currently known optimal fitness value; It is the fitness value of the i-th slime mold.
[0069] After optimization, the SVM model is used for classification. For the C-SVM model, the calculation formula is:
[0070] Where w is the normal vector of the hyperplane; b is the bias term; is a slack variable; m is the total number of samples in the training dataset; C is the penalty factor, obtained by ISMA optimization. The constraints are as follows:
[0071] in, It is the input feature vector, i.e., the filtered water quality parameters; This is a water quality category label. Radial basis function kernels are used to handle nonlinear problems; the kernel function calculation formula is:
[0072] in, is the kernel function, which maps the data to a high-dimensional space for linear partitioning; g is the kernel parameter, obtained through ISMA optimization. The decision function formula is:
[0073] in, It is the optimal solution of the Lagrange multipliers obtained by ISMA optimization; This is the optimal bias. This module outputs water quality category labels. , such as Class I, Class II, etc.; n is the number of support vectors.
[0074] The water quality assessment module provides preliminary water quality category output, but to gain a deeper understanding of the causes of water quality conditions, especially for sampling points with poor assessments, further attribution analysis is needed. Therefore, the model then initiates the attribution analysis module.
[0075] The attribution analysis module analyzes the causes of water pollution, aiming to identify key parameters and pollution sources contributing to poor water quality. This module first calculates the Comprehensive Water Quality Index (WQI) to assess the overall water quality. The formula for calculating the WQI is as follows:
[0076]
[0077] in, It is the comprehensive water quality index, and the higher the value, the better the water quality; n is the number of water quality parameters involved in the evaluation. The parameters involved in the calculation include the key parameters selected by IG features, as well as other auxiliary parameters. It is the normalized value of the i-th parameter, obtained by comparing the measured value with the limit value of the "Surface Water Environmental Quality Standard" and then performing linear normalization. It is the measured value of the i-th parameter. and These are the minimum and maximum limits for this parameter in the standard; This is the weight of the i-th parameter, and the weight assignment is determined with reference to the relevant requirements in the "Surface Water Environmental Quality Standard". The WQI value ranges from 0 to 100, with a higher value indicating better water quality; generally, WQI < 60 indicates poor water quality, corresponding to Class III or below.
[0078] For sampling points with WQI < 60, the module calculates the contribution rate of each water quality parameter to the polluted water quality. Contribution Rate The calculation formula is as follows:
[0079] in, It is the contribution rate of the i-th parameter to water pollution; It is the normalized value of the i-th parameter in the dataset. The sample frequency is less than 60, which represents the number of times the parameter exceeds the standard; m is the total number of water quality parameters. The parameter with the highest contribution rate is identified as the main pollutant.
[0080] The attribution analysis module provides a deeper understanding of the underlying causes of water quality conditions, thus offering a more comprehensive basis for classifying sampling points. Finally, the model integrates the outputs of both modules to make a decision.
[0081] The model will output the categories from the water quality assessment module. The WQI value and attribution conclusions output by the attribution analysis module are integrated. The preset classification decision rules are as follows: Normal sampling points, if Water classified as Class I or Class II with a WQI ≥ 60 indicates good water quality and no significant pollution. Key sampling points, if If the water quality is Class III or below, or WQI < 60, it indicates poor water quality and is marked as a key sampling point, with an attribution analysis report attached, including the main contributing parameters and pollution source types.
[0082] The core function of this step is to build and run an intelligent integrated model for water quality assessment and attribution analysis. This model serves not only as the core computing engine in the entire water quality monitoring process but also as a crucial bridge connecting data and decision-making. By integrating machine learning classification algorithms (IG-ISMA-SVM) with an attribution analysis module, this step achieves in-depth analysis of the water quality at sampling points, moving from "current status assessment" to "causal analysis." The output classification results (normal / key sampling points) and detailed attribution reports (such as the determination of major pollutants and their sources) provide direct and scientific evidence for the differentiated governance measures to be implemented later. For example, it lays the data foundation for precise control of key sampling points, pollution source tracing, and the formulation of governance strategies, enabling subsequent regulatory actions to be targeted and significantly improving the pertinence and efficiency of the entire water quality management work.
[0083] Step S3: Based on the water quality information of the normal sampling points, use the time series analysis method LSTM to predict the water quality safety of the normal sampling points, obtain the prediction results, and carry out graded early warning based on the prediction results.
[0084] The core objective of this step is to predict water quality safety trends at classified normal sampling points and implement tiered early warning systems based on the prediction results, thereby achieving proactive prevention and control of water quality risks. This process primarily relies on the LSTM (Laser-Based Time Measurement) model to model and predict water quality parameters over time; the technical workflow is as follows.
[0085] First, historical water quality data from normal sampling points are preprocessed to form the time-series samples required for the model. Let a sampling point be defined at consecutive time points... , , ..., The water quality parameter vector sequence is X=( , , ..., ), where the input vector at each time step ∈ This includes measured values of water quality parameter d. The model employs a supervised learning format with multivariate input and multivariate output. A dynamic time window mechanism is introduced, where the window length T is dynamically adjusted based on the frequency of water pollution events. The adjustment strategy is as follows: During periods of high-frequency events, when the system detects that the frequency of pollution warnings has exceeded the threshold in the past week, it automatically shortens T to a smaller value (e.g., T=24 hours) to focus on water quality data that has changed drastically recently, quickly capture the characteristics of sudden pollution, and improve the model's response speed to acute events. During periods of low-frequency stability, when the frequency of pollution events is below the threshold, T is extended to a larger value (e.g., T=120 hours) to utilize historical data over a longer period to capture the long-term trends and periodic patterns of slow water quality changes and improve the ability to predict slow-onset pollution.
[0086] This mechanism enables the model to be adaptive, rather than relying on a single fixed scale.
[0087] The LSTM network structure contains two hidden layers, with 64 and 32 neurons per layer, respectively, and uses a Dropout layer with a dropout rate of 0.2 to prevent overfitting. Based on the original Dropout layer, a temporal attention mechanism layer is introduced after the two LSTM hidden layers and before the final output layer. This improvement effectively enhances the ability to capture temporal features of key contamination parameters. The specific workflow of this attention mechanism is as follows: This layer first automatically learns and computes the hidden state at each time step of the second-layer LSTM output. Importance weight Its calculation formula is ,in, It is a score calculated by a feedforward neural network, reflecting the criticality of the information at that time step to the current prediction task; it generates a context vector containing the hidden states of all time steps. According to its corresponding attention weight A weighted summation is performed to generate a context vector c that incorporates all key information. Finally, this context vector c is used as a more informative feature representation and input into the final fully connected output layer to predict water quality for the next k=24 hours.
[0088] The sequence was divided into training and testing sets and normalized to eliminate the influence of dimensions. The normalization formula is:
[0089] in, It is the original measured value of a certain water quality parameter; μ and σ are the mean and standard deviation of each feature in the training set, respectively, obtained through statistical calculation.
[0090] The LSTM model captures long-term dependencies in a sequence through its gating mechanism. For each time step t, the updates to the cell state and hidden state are jointly controlled by the input gate, forget gate, and output gate. The specific calculation process is as follows:
[0091]
[0092]
[0093]
[0094]
[0095]
[0096] In the above formula, It's the forgetting gate, which determines the state of the previous cell. What information is discarded? It is the input gate, which controls the degree to which the current input information updates the cell state; It is a candidate cell state; This is the result of cell state update; It is the output gate, which determines the output in the current hidden state; This is the final hidden state; It is the input data at time t, that is, the normalized water quality parameter vector; It represents the hidden state at time t-1 and is one of the memory carriers of LSTM; σ represents the sigmoid activation function, and tanh is the hyperbolic tangent activation function; , , , and , , , These are the weight matrix and bias vector for each gating, respectively. These parameters are learned by the model through the training process; ∘ represents element-wise multiplication (Hadamard product). This indicates that vectors are concatenated together.
[0097] The model learns parameters through training to minimize prediction error. Its training objective is to predict water quality parameter values for the next k steps.
[0098] in, It is the predicted value at time point t. ∈ ; and These are the weights and biases of the output layer, which are also training parameters. The model uses the mean squared error (MSE) as the loss function, calculated as follows:
[0099] in, is the loss value, representing the magnitude of the prediction error; N is the number of samples; It is the actual value; This is the model's prediction for the i-th sample. All parameters are iteratively optimized using the backpropagation algorithm to minimize the loss function.
[0100] After the model is trained, it is applied to the latest normal sampling point time series data to output the prediction results, namely the predicted sequence of water quality parameters for k time points in the future. .
[0101] Finally, tiered early warnings are issued based on the prediction results. The predicted values are compared with the water quality safety threshold, namely the Class III water standard limit in the "Surface Water Environmental Quality Standard". Multi-level early warning thresholds are set, and the judgment rules are as follows: A blue alert is issued when one or more predicted parameters consistently approach the standard limit, reaching 80% of the limit but not exceeding it, indicating a potential risk to water quality that requires close monitoring. A yellow alert is issued when one or more predicted parameters exceed the standard limit, reaching 100%-120% of the limit, indicating that the water quality has exceeded the standard and there is a risk of slight pollution, requiring an investigation. An orange alert is issued when the predicted value of one or more important parameters significantly exceeds the standard, reaching 120%-150% of the limit, indicating a high risk of water quality deterioration and requiring preparation for intervention measures. A red alert is issued when multiple key parameters are predicted to exceed the limits by 150%, indicating a significant risk of a water quality safety incident and requiring immediate activation of the emergency response.
[0102] The core function of this step is to achieve a leap from passive monitoring to proactive early warning. It uses LSTM time series analysis to deeply mine the hidden patterns and long-term dependencies in historical water quality data from normal sampling points, accurately predicting future water quality change trends. By comparing the predicted values with safety thresholds at multiple levels, the generated graded early warning signals not only provide a forward-looking and differentiated decision-making basis for subsequent risk response and resource allocation, but also construct a dynamic prediction mechanism, enabling subsequent water quality management to shift from "post-event treatment" to "pre-event prevention," significantly improving the sensitivity and reliability of the entire water quality monitoring.
[0103] Step S4: Based on the water quality information of the key sampling points, the pollution source of the key sampling points is located using the spatiotemporal kriging interpolation method to obtain the pollution source location. Based on the pollution source location, the pollution diffusion path is simulated using the multivariate collaborative interpolation prediction method to obtain the simulated pollution diffusion path.
[0104] The core method for locating pollution sources and simulating diffusion paths at key sampling points in this step is based on the spatiotemporal kriging interpolation method (STKriging), combined with the convolutional Transformer inference network (CTIN) to process water quality data with high missing rates, forming a complete technical framework. The input data required for this step includes two parts: firstly, water quality information from key sampling points obtained in step S2; and secondly, environmental dynamic parameters obtained from external meteorological and hydrological databases, mainly including flow velocity and wind direction. These parameters are used to construct a co-kriging model to accurately simulate the diffusion paths of pollutants.
[0105] First, to address the high missing value rate in the monitoring data, the CTIN model is used for data imputation. This model constructs fused input features using a missing label matrix, timestamp information, and the original sequence. It captures local contextual information using a one-dimensional convolutional layer with a kernel width of 3 and models global dependencies through a multi-head self-attention mechanism. The model also introduces learnable timestamp embedding vectors to encode absolute temporal information and employs a missing value-aware mask to ensure that attention calculations are not affected by missing values. Its missing value initialization process can be represented as follows:
[0106] in, This is the data matrix after initial filling; X is a binary mask matrix, where 1 represents a position where data exists and 0 represents a position where data is missing; X is the original water quality data matrix, containing missing values; Δ is the time interval matrix. It is element-wise multiplication; This is a vector concatenation operation; Φ is the ReLU activation function; W and b are trainable parameters. Preliminary estimates are generated by fusing spatiotemporal features and missing patterns, providing a complete data foundation for subsequent kriging interpolation.
[0107] After data imputation, spatiotemporal kriging interpolation was used to locate pollution sources at key sampling points based on the complete water quality dataset. This method models the coordinated spatial and temporal variations using a spatiotemporal variability function, which is defined as:
[0108] in, This is the value of the spatiotemporal variability function. It represents the distance in space as... Time distance is Under these conditions, the average difference between water quality observations is half; the larger the value, the weaker the correlation between the two points. Spatial lag distance refers to the straight-line spatial distance between two sampling points; It is the time lag distance, which refers to the time interval between two sampling points; This corresponds to the number of point pairs within the lag distance, which is the number of points in all observed data, with a spatial distance of approximately [missing information]. And the time distance is approximately The total number of valid point pairs (i,j); In position ,time Observed water quality parameters.
[0109] By optimizing the weighting coefficients The following formula is used to solve the Kriging equations:
[0110] in, It is a spacetime variogram; These are Lagrange multipliers used to satisfy the constraints of unbiased estimation; The number of key sampling points is known; These are the spatial coordinates of the point to be estimated, i.e., the location of the suspected pollution source; It is a timestamp, i.e., the time when the pollution occurred; weighting coefficient. It is obtained by solving a system of linear equations.
[0111] Location of final pollution source The estimated value is calculated by weighted summation:
[0112] in, At the point to be estimated Estimated pollutant concentrations; It is the weight assigned to the i-th known monitoring point; It is the actual pollutant concentration value measured at the i-th known monitoring point.
[0113] This process maximizes the spatial-temporal correlation to invert the extreme regions of the pollution concentration field, thereby achieving precise location of pollution sources.
[0114] After obtaining the pollution source location results, the pollution diffusion path was simulated using a multivariate collaborative interpolation prediction method. A cross-variable function was constructed by introducing auxiliary variables such as flow velocity and wind direction. The spatiotemporal correlation among multiple variables is quantified using the following formula:
[0115] in, This is the crossover variogram value. It is used to measure the core pollutant. with auxiliary variables At a specific spatiotemporal distance The larger the value of the covariance, the more dramatic the covariance of the two variables at that spatiotemporal scale. It refers to the measured concentration value of the core pollution indicator at spatial location s and time point t; The spatial distance from point (s,t) is Time distance is The measured values of auxiliary environmental variables at another point; This is the covariance operator. It is used to measure the linear correlation between two random variables. Through multivariate co-interpolation, it predicts the concentration distribution along the diffusion path, generates a spatiotemporally continuous pollution diffusion simulation field, and obtains the simulated pollution diffusion path.
[0116] This step integrates the Convolutional Transformer Inference Network (CTIN) to process water quality data with high missing rates and applies the Spatiotemporal Kriging (STKriging) method for precise location of pollution sources and simulation of diffusion paths. The core function of this step is to utilize multivariate spatiotemporal correlation to invert extreme regions of the pollution concentration field, thereby dynamically generating a reliable pollution distribution map. This not only provides a data-driven scientific basis for the subsequent formulation of pollution control strategies, environmental risk assessment, and optimization of remediation measures, but also enhances the practicality and accuracy of the entire study in real-time monitoring and decision support, laying a solid foundation for subsequent policy recommendations and engineering applications.
[0117] Step S5: Based on the graded early warning results of the normal sampling points and the simulated pollution diffusion path of the key sampling points, the water quality safety monitoring and early warning results are obtained.
[0118] Based on the outputs of the first four steps, the tiered early warning results of normal sampling points from the LSTM time-series analysis in step S3 and the simulated pollution diffusion paths of key sampling points from the spatiotemporal kriging interpolation pollution source localization in step S4 are comprehensively matched and fused to generate comprehensive water quality safety monitoring results and corresponding water quality management strategies. The core of this step lies in integrating spatiotemporal data and early warning information to achieve the transition from data-driven to decision support, ensuring the accuracy and timeliness of water quality management. The process is as follows: First, the tiered early warning results from normal sampling points are analyzed. These results include different warning levels (e.g., blue, yellow, orange, and red), each corresponding to a specific level of risk; for example, a blue warning indicates potential risk, and a red warning indicates significant risk. Simultaneously, key information is extracted from simulated pollution diffusion paths at key sampling points, such as the pollutant's diffusion range, concentration distribution, direction of movement, and the temporal evolution of the affected area. These paths are generated based on spatiotemporal kriging interpolation, enabling visualization of the dynamic propagation of pollution in space and time.
[0119] Next, spatial overlay and temporal alignment techniques are used to match the warning areas with the diffusion paths. Specifically, the warning map of normal sampling points (showing the spatial distribution of different risk levels) is overlaid with the pollution diffusion simulation map of key sampling points to identify high-risk overlapping areas. For example, if a normal sampling point is under a red warning and its location coincides with a high-concentration area of the pollution diffusion path, this area is marked as an "emergency risk zone." The matching process considers the time dimension to ensure that the warning and the diffusion path are synchronized within the same time window to avoid false alarms.
[0120] Based on the matching results, a water quality safety monitoring and early warning result is generated. The water quality safety monitoring and early warning result includes the following content: The overall safety status report describes the water quality conditions across the entire area, such as "generally safe," "locally polluted," or "widespread risk," along with the main affected indicators. The risk classification output details the risk level of different areas, such as "low-risk area" (blue warning with no spread overlap), "medium-risk area" (yellow warning overlapping with mild spread, mild spread is defined as an area where the concentration value exceeds the standard limit but is less than twice the limit), and "high-risk area" (orange or red warning overlapping with high spread, high spread is defined as an area where the concentration value exceeds twice the standard limit). Anomaly event logging is used to identify and record anomalies based on the risk classification output and the simulated pollution diffusion path. These anomalies include pollution hotspots and abrupt changes in diffusion trends. Each anomaly event record includes at least the following fields: event type, occurrence time, occurrence location, anomaly values of one or more associated water quality parameters, and the cause of the anomaly determined based on the attribution analysis module output. Simultaneously, water quality management strategies are derived, and these strategies dynamically adapt to the monitoring results. Emergency response measures for high-risk areas include immediately activating emergency plans, temporarily shutting down pollution sources, increasing monitoring frequency, issuing public alerts, and deploying rapid response teams for on-site handling. Strategy priorities are based on risk index ranking to ensure efficient resource allocation.
[0121] For long-term governance, preventative measures are recommended for low- to medium-risk areas, such as optimizing wastewater treatment plant operations, strengthening non-point source pollution control in agriculture, or implementing ecological restoration projects. The strategy, combined with forecasts of diffusion pathways, suggests focusing on areas that may be affected in the future.
[0122] The collaborative management framework integrates data from multiple departments and promotes cross-domain collaboration through an information sharing platform. For example, it holds regular joint meetings to review the effectiveness of strategies and adjusts action plans based on real-time monitoring.
[0123] The technical architecture design process for the governance effectiveness evaluation module is as follows: The governance effectiveness evaluation module receives operational data from the governance measure implementation module and feedback data from the water quality monitoring network. It generates optimization signals using an effectiveness evaluation algorithm and transmits these signals back to the water quality evaluation model in stage S2 for parameter adjustment. The system architecture adopts a layered design, comprising a data acquisition layer, an evaluation and analysis layer, and a parameter optimization layer from top to bottom. The data acquisition layer is responsible for acquiring real-time records of governance measure implementation and subsequent water quality change data; the evaluation and analysis layer quantifies the governance effectiveness using a causal inference algorithm; and the parameter optimization layer adjusts the model parameters based on the evaluation results.
[0124] The governance response data acquisition submodule possesses multi-source data fusion capabilities, enabling it to simultaneously collect structured governance data and unstructured environmental data. Governance measure data includes engineering measures such as adjustments to wastewater treatment plant operating parameters and changes in chemical reagent dosage, and management measures such as temporary adjustments to discharge permits and production restriction / shutdown orders for key pollution sources. Water quality response data acquisition employs a sliding time window mechanism, establishing monitoring periods before and after the implementation of governance measures to create a complete time-series dataset. Data association utilizes spatiotemporal coding technology, with each data point including latitude and longitude coordinates, a timestamp, and data source identifiers, ensuring precise matching between governance measures and water quality changes.
[0125] The effectiveness quantification assessment submodule employs a combination of difference-inference models and causal inference. First, a counterfactual scenario is constructed, assuming the water quality change trend under no treatment measures, serving as the baseline for effectiveness evaluation. The counterfactual model comprehensively considers natural hydrological factors such as water temperature, flow velocity, and rainfall, as well as seasonal variation patterns. The average treatment effect is calculated using the difference-in-differences method, comparing the differences in water quality indicators between the treated and control areas. Statistical significance testing uses the bootstrap method to generate confidence intervals, ensuring the reliability of the assessment results. The effect magnitude is calculated using standardized mean differences, facilitating comparisons between different treatment measures.
[0126] The evaluation indicator system is designed with a three-level structure: the primary indicator is the overall score of the treatment effect (0-100 points); the secondary indicators include the immediate effect index, the sustainable effect index, and the stability index; and the tertiary indicators are the degree of improvement of specific water quality parameters. The weight allocation is determined using the analytic hierarchy process based on the importance of the indicators.
[0127] The model parameter optimization submodule employs an incremental learning mechanism, enabling dynamic adjustments to the model without system downtime. The optimization process consists of three steps: first, identifying features with significant governance effects; second, calculating the direction and magnitude of parameter adjustments; and finally, conducting validation tests to ensure improved model performance after optimization. The optimization trigger is set with a dual-condition rule: a time condition for monthly comprehensive optimization and an event condition for immediate triggering when the accumulated number of governance cases reaches a certain threshold or the effectiveness evaluation score falls below a threshold. The parameter adjustment range includes the kernel parameters of the SVM model, the penalty factor, and the weight coefficients from the feature selection phase.
[0128] The core function of this step is to integrate the outputs of the preceding steps: the graded early warning results from normal sampling points (from LSTM time-series prediction) and the simulated pollution diffusion paths from key sampling points (from spatiotemporal Kriging interpolation pollution source localization). Through data matching algorithms, comprehensive and dynamic water quality safety monitoring results and targeted management strategies are generated. This step not only realizes the transition from multi-source data to decision support, but also provides a scientific basis and an operational framework for actual water quality governance actions through risk area identification and strategy optimization. This ensures that the entire water quality management can respond to changes in a timely manner, reduce pollution risks, and improve governance efficiency.
[0129] This invention presents a water quality safety monitoring and early warning method based on big data. It achieves efficient monitoring and early warning through a full-process technical architecture of "sampling stratification - precise evaluation - time-series early warning - source tracing simulation - strategy output". First, sampling points are divided according to the geographical characteristics and functional zones of the water area and assigned scene labels. Basic and differentiated sensors are deployed to collect multi-dimensional data. After sliding window outlier removal and spatiotemporal kriging interpolation, a standardized dataset is generated. Next, an IG-ISMA-SVM nonlinear water quality evaluation model is constructed. Key parameters are selected through information gain, and the ISMA algorithm optimizes the penalty factor and kernel parameters of the SVM. Combined with the attribution analysis module, the WQI index and parameter contribution rate are calculated for precise evaluation. The system accurately identifies major pollutants and pollution source types, classifying sampling points into normal and key sampling points. For normal sampling points, an LSTM time series model combined with a four-level "blue-yellow-orange-red" early warning mechanism is used to predict risks. For key sampling points, a convolutional Transformer inference network is first used to fill in data with high missing rates. Then, spatiotemporal kriging interpolation is used to invert extreme pollution concentration regions to locate pollution sources. A cross-variable function is constructed by combining parameters such as flow velocity and wind direction, and multivariate collaborative interpolation is used to simulate pollution diffusion paths. Finally, the early warning results of normal sampling points and the diffusion paths of key sampling points are integrated to generate a comprehensive risk classification report, and emergency response and long-term governance strategies are matched to form a closed loop.
[0130] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, the phrase "comprising an element defined as..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0131] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their likenesses.
Claims
1. A water quality safety monitoring and early warning method based on big data, characterized in that, Includes the following steps: Step S1: Divide the sampling points according to the area, set scene labels for the sampling points, and deploy sensors at the sampling points based on the scene labels to obtain water quality information through the sensors; Step S2: Establish a water quality evaluation model based on the improved model of support vector machine, input the water quality information into the water quality evaluation model, output the water quality category, and divide the sampling points into normal sampling points and key sampling points according to the water quality category; Step S3: Based on the water quality information of the normal sampling points, use the time series analysis method LSTM to predict the water quality safety of the normal sampling points, obtain the prediction results, and carry out graded early warning according to the prediction results; Step S4: Based on the water quality information of the key sampling points, the pollution source of the key sampling points is located using the spatiotemporal kriging interpolation method to obtain the pollution source location. Based on the pollution source location, the pollution diffusion path is simulated using the multivariate collaborative interpolation prediction method to obtain the simulated pollution diffusion path. Step S5: Based on the graded early warning results of the normal sampling points and the simulated pollution diffusion path of the key sampling points, the water quality safety monitoring and early warning results are obtained.
2. The water quality safety monitoring and early warning method based on big data according to claim 1, characterized in that, Sampling points are divided according to the region, and scene labels are set for the sampling points, including: Based on the geographical features and functional zoning of the water area, the main channel of the river, the confluence of tributaries, the drinking water source protection area, the downstream of industrial sewage outlets, and the agricultural non-point source pollution area are distinguished. The sampling area is divided using a systematic grid method, and each sampling point is assigned a scene label to distinguish the industrial impact area, the agricultural non-point source area, and the ecologically sensitive area.
3. The water quality safety monitoring and early warning method based on big data according to claim 2, characterized in that, Sensors are deployed at sampling points based on the aforementioned scene labels to acquire water quality information, including: Based on the scene labels of the sampling points, differentiated sensors are deployed at the sampling points. For data specific to the scene labels, differentiated parameters are collected. In industrial impact areas, heavy metal sensors are added, and inductively coupled plasma mass spectrometry is used to monitor lead and chromium concentrations online. In agricultural non-point source areas, nitrate sensors are installed to detect nitrogen pollution based on ultraviolet absorption. In ecologically sensitive areas, chlorophyll a sensors are added, and fluorescence probes are used to monitor algal biomass.
4. The water quality safety monitoring and early warning method based on big data according to claim 3, characterized in that, Establish a water quality assessment model, including: The water quality assessment model consists of two core modules connected in series: the water quality assessment module and the attribution analysis module. The water quality assessment module is based on the IG-ISMA-SVM classification model. The water quality assessment module first uses information gain IG to perform feature selection, and selects the key water quality parameters that have the greatest impact on water quality assessment from all water quality parameters obtained in step S1. IG is calculated based on the reduction of information entropy, and its formula is as follows: ; ; in, is the information gain of feature A; the larger the value, the more important the feature is for classification. S is the training dataset containing water quality parameters and category labels. Feature A is a specific water quality parameter, whose possible values include total nitrogen and pH. Entropy(S) is the information entropy of dataset S, representing a measure of its overall uncertainty. is the proportion of the k-th type of sample in S; K is the number of categories, from water quality categories I to V; These are all possible values for attribute A; It is a subset of attribute A with a value of v in S; by calculating the IG value of each attribute, the module selects the top N indicators with higher IG values as input features; typical feature selection results include, but are not limited to, total phosphorus TP, permanganate index CODMn, pH, heavy metal chromium Cr, total nitrogen TN, and nitrate NO3-N. These determined representative parameters can effectively reflect the pollution characteristics of different scenarios and serve as inputs for subsequent SVM models. Next, the module uses the ISMA algorithm, which incorporates multiple strategies to improve the slime mold optimization algorithm, to optimize the parameters of the support vector machine (SVM). The formula for calculating the fitness weight coefficient is as follows: ; Where W is the fitness weight coefficient; It is the fitness value of the i-th slime mold; and These are the current best and worst fitness values, respectively; when S(i) is better than the average fitness value of the population, that is, when the value of S(i) is less than the average fitness value, then... We assign weights greater than 1, i.e., W>1; when S(i) is worse than or equal to the average fitness value of the population, i.e., the value of S(i) is greater than or equal to the average fitness value, we use... To assign a weight less than 1, i.e., W < 1; The ISMA algorithm position update formula is: ; in, This represents the location of the slime mold in the current iteration, corresponding to the SVM parameters; This is the current optimal position; and It is a random parameter. ∈[-a,a], ∈[-1,1], a is an adaptive parameter used to control the convergence of the search range with iteration, a= t is the current iteration number; T is the maximum iteration number; r is a random number in the range [0,1]; p is a probability threshold that controls whether the algorithm performs exploration or development. At this time, a development strategy is executed, meaning the algorithm considers the current region to have great potential and performs a local search to find the optimal point within that region, thus enhancing the algorithm's local search capability; r At time p, an exploration strategy is executed, performing a large-scale search in the global search space, which enhances the algorithm's global search capability; ISMA obtains the optimal parameter combination by optimizing the penalty factor C of SVM and the radial basis kernel function parameter g. and ; The formula for calculating the probability threshold p is as follows: ; Where DF is the currently known optimal fitness value; It is the fitness value of the i-th slime mold; After optimization, the SVM model is used for classification. For the C-SVM model, the calculation formula is: ; Where w is the normal vector of the hyperplane; b is the bias term; is a slack variable; m is the total number of samples in the training dataset; C is the penalty factor, obtained by ISMA optimization; The constraints are as follows: ; in, It is the input feature vector, i.e., the filtered water quality parameters; This is a water quality category label, using radial basis function kernels to handle nonlinear problems. The kernel function calculation formula is: ; in, is the kernel function, which maps the data to a high-dimensional space for linear partitioning; g is the kernel parameter, obtained by ISMA optimization. The decision function formula is: ; in, It is the optimal solution of the Lagrange multipliers obtained by ISMA optimization; This is the optimal bias; the module outputs water quality category labels. For example, Class I, Class II; n is the number of support vectors; The water quality assessment module provides a preliminary water quality category output, but in order to gain a deeper understanding of the causes of water quality conditions, especially for sampling points with poor assessments, further attribution analysis is needed. Therefore, the model will then activate the attribution analysis module. The attribution analysis module analyzes the causes of water pollution. This module aims to identify key parameters and pollution sources leading to poor water quality. It first calculates the Comprehensive Water Quality Index (WQI) to assess the overall water quality. The formula for calculating the WQI is as follows: ; ; in, It is the comprehensive water quality index, and the higher the value, the better the water quality; n is the number of water quality parameters involved in the evaluation. The parameters involved in the calculation include the key parameters selected by IG features, as well as other auxiliary parameters. It is the normalized value of the i-th parameter, obtained by comparing the measured value with the limit value of the "Surface Water Environmental Quality Standard" and then performing linear normalization. It is the measured value of the i-th parameter. and These are the minimum and maximum limits for this parameter in the standard; This is the weight of the i-th parameter. The weight is determined with reference to the relevant requirements in the "Surface Water Environmental Quality Standard". The WQI value ranges from 0 to 100. The higher the value, the better the water quality. Usually, WQI < 60 indicates poor water quality, corresponding to Class III or below. For sampling points with WQI < 60, the module calculates the contribution rate of each water quality parameter to the polluted water quality. The calculation formula is as follows: ; in, It is the contribution rate of the i-th parameter to water pollution; It is the normalized value of the i-th parameter in the dataset. The sample frequency is less than 60, which means the number of times the parameter exceeds the standard; m is the total number of water quality parameters, and the parameter with the highest contribution rate is identified as the main pollutant; The attribution analysis module provides in-depth insights into the underlying causes of water quality conditions, thus offering a more comprehensive basis for the classification of sampling points; Ultimately, the model integrates the outputs of the two modules to make a decision, and the model will use the category output by the water quality assessment module. The WQI value and attribution conclusions output by the attribution analysis module are integrated.
5. The water quality safety monitoring and early warning method based on big data according to claim 4, characterized in that, The sampling points are divided into normal sampling points and key sampling points, including: Normal sampling points, if Water classified as Class I or Class II with a WQI ≥ 60 indicates good water quality and no significant pollution. Key sampling points, if If the water quality is Class III or below, or WQI < 60, it indicates poor water quality and is marked as a key sampling point, with an attribution analysis report attached, including the main contributing parameters and pollution source types.
6. The water quality safety monitoring and early warning method based on big data according to claim 5, characterized in that, Based on the water quality information of the normal sampling points, the water quality safety of the normal sampling points is predicted using the time series analysis method LSTM, and the prediction results are as follows: Historical water quality data from normal sampling points are preprocessed to form the time-series samples required for the model; assuming a certain sampling point has continuous time points... , , ..., The water quality parameter vector sequence is X=( , , ..., ), where the input vector at each time step ∈ The model includes measured values of water quality parameter d; it employs a supervised learning format with multivariate input and multivariate output; and it introduces a dynamic time window mechanism, where the window length T can be dynamically adjusted according to the frequency of water pollution events. The adjustment strategy is as follows: During periods of high-frequency events, when the system detects that the frequency of pollution warnings has exceeded the threshold in the past week, it automatically shortens T to a smaller value. This aims to focus on water quality data that has changed drastically in the past, quickly capture the characteristics of sudden pollution, and improve the model's response speed to acute events. During periods of low-frequency stability, when the frequency of pollution events is below the threshold, T is extended to a larger value. This aims to utilize historical data over a longer period of time to capture the long-term trends and periodic patterns of slow changes in water quality and improve the ability to predict slow-onset pollution. This mechanism enables the model to be adaptive, rather than relying on a single fixed scale; The LSTM network structure contains two hidden layers, with 64 and 32 neurons per layer, respectively, and uses a Dropout layer with a dropout rate of 0.2 to prevent overfitting. Based on the original Dropout layer, a temporal attention mechanism layer is introduced after the two LSTM hidden layers and before the final output layer. This improvement effectively enhances the ability to capture temporal features of key contamination parameters. The specific workflow of this attention mechanism is as follows: This layer first automatically learns and computes the hidden state at each time step of the second-layer LSTM output. Importance weight Its calculation formula is ,in, It is a score calculated by a feedforward neural network, reflecting the criticality of the information at that time step to the current prediction task; it generates a context vector containing the hidden states of all time steps. According to its corresponding attention weight A weighted summation is performed to generate a context vector c that incorporates all key information. Finally, this context vector c is used as a more informative feature representation and input into the final fully connected output layer to predict water quality for the next k=24 hours. The sequence was divided into training and testing sets and normalized to eliminate the influence of dimensions. The normalization formula is: ; in, It is the original measured value of a certain water quality parameter; μ and σ are the mean and standard deviation of each feature in the training set, respectively, obtained through statistical calculation. The LSTM model captures long-term dependencies in a sequence through its gating mechanism; for each time step t, the updates of the cell state and hidden state are jointly controlled by the input gate, forget gate, and output gate; the specific calculation process is as follows: ; ; ; ; ; ; In the above formula, It's the forgetting gate, which determines the state of the previous cell. What information is discarded? It is the input gate, which controls the degree to which the current input information updates the cell state; It is the candidate cell state; This is the result of cell state update; It is the output gate, which determines the output in the current hidden state; This is the final hidden state; It is the input data at time t, that is, the normalized water quality parameter vector; It represents the hidden state at time t-1 and is one of the memory carriers of LSTM; σ represents the sigmoid activation function, and tanh is the hyperbolic tangent activation function; , , , and , , , These are the weight matrix and bias vector for each gate, respectively. These parameters are all learned by the model through the training process; ∘ represents element-wise multiplication; This means concatenating vectors together; The model learns parameters to minimize prediction error during training, with the training objective being to predict water quality parameter values for the next k steps. ; in, It is the predicted value at time point t. ∈ ; and These are the weights and biases of the output layer, which are also training parameters. The model uses the mean squared error (MSE) as the loss function, calculated as follows: ; in, is the loss value, representing the magnitude of the prediction error; N is the number of samples; It is the actual value; It is the model's prediction of the i-th sample. All parameters are iteratively optimized through the backpropagation algorithm to minimize the loss function. After the model is trained, it is applied to the latest normal sampling point time series data to output the prediction results, namely the predicted sequence of water quality parameters for k time points in the future. .
7. The water quality safety monitoring and early warning method based on big data according to claim 6, characterized in that, Based on the prediction results, a tiered early warning system is implemented, including: Based on the prediction results, tiered early warnings are issued. The predicted values are compared with the water quality safety threshold, namely the Class III water standard limit in the "Surface Water Environmental Quality Standard," and multi-level early warning thresholds are set. The judgment rules are as follows: A blue alert is issued when one or more predicted parameters consistently approach the standard limit, reaching 80% of the limit but not exceeding it, indicating a potential risk to water quality that requires close monitoring. A yellow alert is issued when one or more predicted parameters exceed the standard limit, reaching 100%-120% of the limit, indicating that the water quality has exceeded the standard and there is a risk of slight pollution, requiring an investigation. An orange alert is issued when the predicted value of one or more important parameters significantly exceeds the standard, reaching 120%-150% of the limit, indicating a high risk of water quality deterioration and requiring preparation for intervention measures. A red alert is issued when multiple key parameters are predicted to exceed the limits by 150%, indicating a significant risk of a water quality safety incident and requiring immediate activation of the emergency response.
8. The water quality safety monitoring and early warning method based on big data according to claim 7, characterized in that, Based on the water quality information of the key sampling points, the pollution source at the key sampling points is located using spatiotemporal kriging interpolation, resulting in the pollution source location, including: Based on a complete water quality dataset, spatiotemporal kriging interpolation is used to locate pollution sources at key sampling points. This method models the co-variance characteristics of space and time through a spatiotemporal variability function, which is defined as: ; in, It is the value of the spatiotemporal variability function, representing the distance in space as... Time distance is Under these conditions, the average difference between water quality observations is half; the larger the value, the weaker the correlation between the two points. It is the spatial lag distance, which refers to the straight-line spatial distance between two sampling points; It is the time lag distance, which refers to the time interval between two sampling points; This represents the number of point pairs within the corresponding lag distance, and is the number of points with a spatial distance of [value missing] across all observed data. And the time distance is The total number of valid point pairs (i,j); In position ,time Observed values of water quality parameters; By optimizing the weighting coefficients The following formula is used to solve the Kriging equations: ; in, It is a spacetime variogram; These are Lagrange multipliers used to satisfy the constraints of unbiased estimation; The number of key sampling points is known; These are the spatial coordinates of the point to be estimated, i.e., the location of the suspected pollution source; It is a timestamp, i.e., the time when the pollution occurred; weighting coefficient. It is obtained by solving a system of linear equations; Location of final pollution source The estimated value is calculated by weighted summation: ; in, At the point to be estimated Estimated pollutant concentrations; It is the weight assigned to the i-th known monitoring point; It is the actual pollutant concentration value measured at the i-th known monitoring point; This process maximizes the spatial-temporal correlation to invert the extreme regions of the pollution concentration field, thereby achieving precise location of pollution sources.
9. The water quality safety monitoring and early warning method based on big data according to claim 8, characterized in that, The pollution diffusion path was simulated using a multivariate collaborative interpolation prediction method, resulting in the simulated pollution diffusion path, including: After obtaining the pollution source location results, the pollution diffusion path was simulated using a multivariate collaborative interpolation prediction method. By introducing auxiliary variables, flow velocity and wind direction, a cross-variability function was constructed. The spatiotemporal correlation among multiple variables is quantified using the following formula: ; in, It is the cross-variogram value, used to measure the core pollutant. with auxiliary variables At a specific spatiotemporal distance The larger the value of the covariance, the more dramatic the covariance of the two variables at that spatiotemporal scale. It refers to the measured concentration value of the core pollution indicator at spatial location s and time point t; The spatial distance from point (s,t) is Time distance is The measured values of auxiliary environmental variables at another point; It is a covariance operator used to measure the linear correlation between two random variables. It predicts the concentration distribution on the diffusion path through multivariate co-interpolation, generates a spatiotemporally continuous pollution diffusion simulation field, and obtains the simulated pollution diffusion path.
10. A water quality safety monitoring and early warning method based on big data according to claim 9, characterized in that, Based on the graded early warning results of the normal sampling points and the simulated pollution diffusion paths of the key sampling points, water quality safety monitoring and early warning results are obtained, including: The graded early warning results of normal sampling points are analyzed. These early warning results include different warning levels, each corresponding to a specific risk level. Blue warnings indicate potential risks, and red warnings indicate major risks. At the same time, key information such as the diffusion range, concentration distribution, movement direction, and temporal evolution of pollutants are extracted from the simulated pollution diffusion paths of key sampling points. These paths are generated based on the spatiotemporal kriging interpolation method, which can visualize the dynamic spread of pollution in space and time. Next, spatial overlay and temporal alignment techniques are used to match the warning area with the diffusion path. Specifically, the warning map of normal sampling points is overlaid with the pollution diffusion simulation map of key sampling points to identify high-risk overlapping areas. If a normal sampling point is in a red warning state and its location coincides with the high concentration area of the pollution diffusion path, the area is marked as an "emergency risk area". The matching process takes into account the time dimension to ensure that the warning and the diffusion path are synchronized within the same time window to avoid false alarms. Based on the matching results, a water quality safety monitoring and early warning result is generated. The water quality safety monitoring and early warning result includes the following content: The overall safety status report describes the water quality condition of the entire area, such as "generally safe," "locally polluted," or "widespread risk," along with the main affected indicators. The risk classification output details the risk levels of different areas: "Low-risk area" is marked by a blue alert with no overlapping diffusion; "Medium-risk area" is marked by a yellow alert overlapping with mild diffusion, defined as an area where the concentration value exceeds the standard limit but is less than twice the limit; and "High-risk area" is marked by an orange or red alert overlapping with high diffusion, defined as an area where the concentration value exceeds twice the standard limit. Anomaly event log is used to identify and record anomaly events based on risk classification output results and simulated pollution diffusion paths; the anomaly events include pollution hotspot events and abrupt changes in diffusion trends; each anomaly event log includes at least the following fields: event type, occurrence time, occurrence location, abnormal values of one or more associated water quality parameters, and the cause of the anomaly determined based on the output of the attribution analysis module.
Citation Information
Cited By
Water supply plant production tail water risk identification and early warning method
CN121682543A
Mine water disaster intelligent alarm system responding to multidimensional physical field parameter abnormity
CN121686684A
Wastewater new pollutant early warning method and system, computer equipment and medium
CN122157842A
