Water quality monitoring method and system based on water quality prediction model library
By extracting multidimensional state fingerprint features and constructing a state pattern library through two-stage clustering, and dynamically activating the prediction sub-model, the problem of prediction accuracy under drastic changes in water quality in villages and towns in Inner Mongolia Autonomous Region was solved, and adaptive and efficient water quality prediction was achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 内蒙古自治区环境监测总站呼和浩特分站
- Filing Date
- 2026-06-01
- Publication Date
- 2026-07-07
AI Technical Summary
Traditional water quality monitoring methods are insufficient to accurately perceive the current state of water bodies and match suitable prediction models in rural areas of Inner Mongolia Autonomous Region due to drastic changes in water quality, leading to inaccurate predictions.
By extracting multidimensional state fingerprint features, including dynamic pulse fingerprints and ion ratio fingerprints, and combining them with two-stage clustering to construct a state pattern library, a targeted and optimized prediction sub-model library is established, and the most suitable sub-model is dynamically activated for prediction.
It enables accurate perception of the current state of water bodies under drastic fluctuations, improving the robustness and accuracy of predictions and overcoming the limitations of a single global model.
Smart Images

Figure CN122348010A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water quality monitoring technology, specifically to a water quality monitoring method and system based on a water quality prediction model library. Background Technology
[0002] The water bodies and water quality characteristics in the villages and towns of Inner Mongolia Autonomous Region exhibit highly unique regional characteristics. These villages and towns rely heavily on scattered wells, shallow groundwater, intercepting reservoirs, and seasonal rivers and lakes for their drinking water and industrial water supply. Controlled by the arid and semi-arid climate, the water quality of these water bodies exhibits drastic and non-stationary dynamic changes: spring snowmelt runoff triggers pulsed inputs of non-point source pollutants; continuous evaporation in summer leads to salinization and the concentration and enrichment of high fluoride risks; and long winters of ice cover cause a sharp drop in the water's reoxygenation capacity, creating a low-temperature, hypoxic, and strongly reducing environment. This water quality characteristic, which fluctuates dramatically with hydrological and meteorological conditions, means that any single natural water body will experience multiple distinctly different physicochemical states within an annual cycle. Traditional methods of water quality prediction relying on time points or single static models are often severely inaccurate in such regions.
[0003] Water quality monitoring at the village and township level generally employs two background technical solutions: The first is real-time sensor monitoring of limited indicators combined with periodic laboratory sampling and testing. While this solution can obtain basic physicochemical indicator measurements (such as water temperature, pH, conductivity, dissolved oxygen, etc.), it typically only uses these data for threshold alarms or simple trend extrapolation, without delving into the intrinsic pattern information contained within these physicochemical measurements that characterizes the stages of water body evolution. The second approach involves constructing a globally applicable data-driven prediction model, attempting to cover all possible future states of the water body with a single algorithmic structure. However, in the application scenarios of villages and townships in Inner Mongolia Autonomous Region, this one-size-fits-all modeling strategy encounters fundamental technical obstacles: a prediction model that performs well during the summer evaporation and concentration period almost inevitably fails during the dilution and abrupt changes in spring snowmelt runoff, because the physicochemical mechanisms causing water quality fluctuations are drastically different in the two periods. Limited historical training data makes it difficult to support a giant global model to accurately fit such a vast and diverse state space.
[0004] This widespread monitoring scheme also exposes a core contradiction that urgently needs to be addressed: how to move away from the crude prediction that relies solely on time tags when faced with the dramatic fluctuations in the same water body in villages and towns in Inner Mongolia Autonomous Region between different states such as snowmelt dilution, evaporation concentration, and ice-sealed oxygen deficiency, and instead to accurately perceive the current internal state pattern of the water body based on real-time and easily measurable physicochemical measurements, and thereby dynamically match the most suitable special prediction model for that state.
[0005] The information disclosed in the background section is only intended to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this invention is to provide a water quality monitoring method and system based on a water quality prediction model library to solve the problems mentioned in the background art.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A water quality monitoring method based on a water quality prediction model library, comprising the following steps: Step 1: Obtain the physicochemical index measurement values of the target water body within the preset sampling window, and extract the multidimensional state fingerprint features used to characterize the current state of the target water body; the multidimensional state fingerprint features include a dynamic pulse fingerprint constructed from the time-series change statistics of multiple physicochemical index measurement values, and an ion ratio fingerprint reflecting the change of water chemical type. Step 2: Perform similarity matching between the multidimensional state fingerprint features and multiple benchmark state patterns in the pre-built state pattern library to determine the membership degree of the target water body's current state to the benchmark state patterns; Step 3: Based on the membership degree, match and activate the corresponding target prediction sub-model from the pre-built water quality prediction model library; wherein, the water quality prediction model library includes multiple prediction sub-models, and each prediction sub-model is bound to a baseline state pattern in the state pattern library; Step 4: Input the measured values of the physicochemical indicators of the target water body at the current and historical times into the activated target prediction sub-model to obtain the water quality prediction results of the target water body within the preset prediction period.
[0008] Furthermore, the measured values of the physicochemical indicators include physical indicators and chemical indicators. The physical indicators include water temperature, pH, conductivity, dissolved oxygen, turbidity, redox potential, and ultraviolet-visible absorption spectrum. The chemical indicators include the concentrations of sodium ions, calcium ions, magnesium ions, chloride ions, and bicarbonate ions.
[0009] Furthermore, the method for constructing the dynamic pulse fingerprint is as follows: The preset sampling window contains multiple sampling points, each corresponding to a sampling time. The time interval between adjacent sampling times is recorded as the preset time interval. Conductivity and turbidity are selected as sensitive indicator parameters. The standard deviation of the fluctuation of the sensitive indicator parameters within the preset sampling window, the difference between the beginning and end of the window, and the proportion of outliers exceeding the preset stable range are calculated. The difference between the beginning and end of the window is the difference between the measured values of the sensitive indicator parameters at the end time and the beginning time of the preset sampling window. The standard deviation of fluctuation, the difference between the beginning and end of the window, and the proportion of outliers are used to construct a three-dimensional feature vector as a dynamic pulse fingerprint. The method for constructing the ion ratio fingerprint is as follows: based on the measured values of chemical indicators in the target water body, calculate the ratio of sodium ions to the sum of calcium and magnesium ions, and the ratio of chloride ions to bicarbonate ions; construct a two-dimensional feature vector from the above two ratios as the ion ratio fingerprint. The multidimensional state fingerprint feature is a feature vector composed of dynamic pulse fingerprint and ion ratio fingerprint.
[0010] Furthermore, historical water quality monitoring data of the target water body's basin over multiple complete hydrological years are collected, and the historical water quality monitoring data is sliced according to a preset time window. Multidimensional state fingerprint features are extracted for each slice of data. The sampling time interval of each sampling point in the historical water quality monitoring data is consistent with the preset time interval. Based on the feature vector set composed of multidimensional state fingerprint features of all slice data, unsupervised clustering analysis is performed. The clustering analysis adopts a two-stage strategy: the first stage uses ion ratio fingerprint as the main feature for clustering to distinguish different water chemical background types; the second stage uses dynamic pulse fingerprint as the main feature for secondary clustering within each background type divided in the first stage to distinguish different levels of hydrological disturbance intensity. The water quality state space is divided into several baseline state modes, and the cluster center vector of each baseline state mode is calculated. The cluster center vectors are stored in a one-to-one correspondence with the baseline state modes to form the state mode library. The baseline state modes include reduced state, high turbidity state, high salinity state, and steady state. The reduced state represents the water body freezing due to low temperature and hypoxia in winter, the high turbidity state represents the water body pulse input by snowmelt runoff in spring, the high salinity state represents the water body high salinity state caused by evaporation and concentration in summer, and the steady state represents the groundwater base flow during undisturbed periods. The multidimensional state fingerprint features extracted in step 1 are compared one by one with the cluster center vectors of each benchmark state pattern in the state pattern library to calculate the distance. The benchmark state pattern with the smallest distance is taken as the matching pattern. The membership degree of the target water body to the matching pattern is calculated based on the distance. The membership degree is negatively correlated with the distance. If the distance exceeds the preset state judgment distance threshold, the membership degree is set to zero and the target water body is determined to be in an unknown state.
[0011] Furthermore, the specific methods for constructing the water quality prediction model library include: According to the baseline state patterns defined in the state pattern library, historical water quality monitoring data are categorized into the corresponding patterns to form a dedicated training dataset for each baseline state pattern. The input feature of each training data is a time series composed of physicochemical index measurements at multiple consecutive times, and the output label is the target pollutant concentration value within a preset future prediction period. The target pollutant includes at least one of fluoride, arsenic, or chloride, and the target pollutant concentration value is obtained through laboratory analysis. For each baseline state mode, a pre-defined feature weight vector is preset; the preset feature weight vector is a vector with the same length as the input feature dimension, wherein the value of each element is determined according to the sensitivity of the measured values of each physicochemical index to the change in the concentration of the target pollutant under the baseline state; Using the preset feature weight vector bound to each baseline state mode, perform element-wise multiplication on the feature vector of each input feature in the dedicated training dataset of the baseline state mode at each time step to generate a weighted training dataset. For each baseline state pattern, a prediction sub-model is independently trained using its weighted training dataset. Each prediction sub-model adopts a time series prediction model suitable for the data characteristics of that pattern. Specifically, if the baseline state is a reduced state, a statistical regression model is selected; if the baseline state is a highly turbid state, a gradient boosting tree model is selected; if the baseline state is a highly saline state, a long short-term memory network model is selected; and if the baseline state is a steady state, an autoregressive model is selected.
[0012] Furthermore, the preset feature weight vector is determined as follows: When the selected state mode is the reduced state, the weight values of water temperature, dissolved oxygen and redox potential in the preset feature weight vector are higher than the weight values of other feature values. When the selected state mode is high turbidity, the weight values of turbidity, conductivity and ultraviolet-visible absorption spectrum in the preset feature weight vector are higher than the weight values of other features. When the selected state mode is high salt state, the weight values of the corresponding conductivity, sodium ion concentration, calcium ion concentration, magnesium ion concentration, chloride ion concentration and bicarbonate ion concentration in the preset feature weight vector are higher than the weight values of other features. When the selected state mode is steady state, the weight values of each element in the preset feature weight vector are equal.
[0013] Furthermore, the specific logic for matching and activating the corresponding target prediction sub-model is as follows: Obtain the membership degree of the target water body to the matching pattern, and select the baseline state pattern with the highest membership degree and a distance not exceeding the preset state judgment distance threshold as the selected state pattern. The prediction sub-model bound to the selected state mode is retrieved as the target prediction sub-model and activated. If the target water body is determined to be in an unknown state, that is, the distances corresponding to all baseline state modes exceed the preset state determination distance threshold, then no sub-model bound to the baseline state mode in the water quality prediction model library is activated. Instead, the preset general conservative prediction strategy is triggered, and alarm information for marking the unknown state is generated.
[0014] Furthermore, the preset general conservative prediction strategy specifically includes: Retrieve a pre-specified default prediction sub-model, which is a prediction sub-model corresponding to the steady state in the water quality prediction model library; The physicochemical index values of the target water body at multiple consecutive time points are input into the default prediction sub-model to obtain the initial prediction values; Simultaneously, the measured concentration value of the target pollutant in the target water body at the current moment is obtained, and the relative deviation between the measured concentration value of the target pollutant and the average value of the target pollutant concentration value in a preset backtracking period before the current moment is calculated. The relative deviation is characterized by the coefficient of variation. If the deviation coefficient is positive, the initial predicted value is multiplied by the preset upper limit of the safety factor to obtain the final prediction result; if the deviation coefficient is negative, the absolute value of the deviation coefficient is further compared with the preset abnormally low threshold: if the absolute value of the deviation coefficient is greater than the abnormally low threshold, the initial predicted value is multiplied by the lower limit of the preset safety factor to obtain the final prediction result; otherwise, the initial predicted value is used as the final prediction result; both the upper and lower limits of the preset safety factor are greater than 1.
[0015] Furthermore, the input data of the target prediction sub-model is a time series composed of physicochemical index measurements at multiple consecutive times, and the feature dimension of the input data is consistent with the input feature dimension used when training the target prediction sub-model; When the target prediction sub-model is activated, the same preset feature weight vector used during model training is retrieved according to the selected state mode. The preset feature weight vector is applied to the feature vector at each time step in the input data sequence by element-wise multiplication to obtain a weighted input time series. The target prediction sub-model outputs the target pollutant concentration value within a preset prediction period based on the weighted input time series.
[0016] The present invention also provides a water quality monitoring system based on a water quality prediction model library, which is used to implement the above-mentioned water quality monitoring method based on a water quality prediction model library, including: The state fingerprint extraction module is used to acquire the physicochemical index measurement values of the target water body within a preset sampling window, and extract multidimensional state fingerprint features to characterize the current state of the target water body; the multidimensional state fingerprint features include a dynamic pulse fingerprint constructed from the time-series change statistics of multiple physicochemical index measurement values, and an ion ratio fingerprint reflecting the change of water chemical type. The state membership discrimination module is used to perform similarity matching between the multidimensional state fingerprint features and multiple benchmark state patterns in a pre-built state pattern library to determine the membership degree of the current state of the target water body to the benchmark state patterns. The model adaptive activation module is used to match and activate the corresponding target prediction sub-model from the pre-built water quality prediction model library based on the membership degree; wherein, the water quality prediction model library includes multiple prediction sub-models, and each prediction sub-model is bound to a baseline state pattern in the state pattern library respectively. The water quality prediction execution module is used to input the measured values of the physicochemical indicators of the target water body at the current and historical times into the activated target prediction sub-model to obtain the water quality prediction results of the target water body within a preset prediction period.
[0017] The technical effects and advantages provided by the present invention in the above technical solution are as follows: This invention extracts multidimensional state fingerprint features, consisting of dynamic pulse fingerprints and ion ratio fingerprints, from easily measurable physicochemical indicators. This enables precise perception of the current state pattern of a water body based on real-time monitoring data, overcoming the limitations of traditional methods that roughly divide prediction periods according to calendar time. A state pattern library constructed based on two-stage clustering scientifically divides the annual cycle evolution of the same water body into four baseline states: reducing state, high turbidity state, high salinity state, and steady state. This ensures high homogeneity of the physicochemical mechanisms within each pattern, laying the foundation for accurate prediction. By establishing a prediction sub-model library bound to each baseline state and with targeted algorithm optimization, the invention overcomes the dilemma of a single global model needing to cover mutually exclusive mechanisms. During runtime, the most suitable sub-model is dynamically activated based on real-time membership, achieving adaptive prediction with multiple models for a single water body and adapting to different states. This significantly improves the robustness and accuracy of predictions under drastic state fluctuations. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the overall method flow of the present invention; Figure 2 This is a schematic diagram of the first-stage clustering results in this invention; Figure 3 This is a schematic diagram of the second-stage clustering results in this invention; Figure 4 This is a schematic diagram of the system structure of the present invention. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0020] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0021] Example: Please see Figures 1 to 3 The present invention provides a technical solution: A water quality monitoring method based on a water quality prediction model library, comprising the following steps: Step 1: Obtain the physicochemical index measurements of the target water body within a preset sampling window, and extract multidimensional state fingerprint features to characterize the current state of the target water body; the multidimensional state fingerprint features include a dynamic pulse fingerprint constructed from the time-series change statistics of multiple physicochemical index measurements, and an ion ratio fingerprint reflecting changes in water chemistry type.
[0022] In this embodiment, the measured values of the physicochemical indicators include both physical and chemical indicators. The physical indicators include water temperature, pH, conductivity, dissolved oxygen, turbidity, redox potential, and UV-Vis absorption spectrum. The chemical indicators include the concentrations of sodium ions, calcium ions, magnesium ions, chloride ions, and bicarbonate ions. Specifically, the physical indicators of water temperature, pH, conductivity, dissolved oxygen, turbidity, and redox potential are obtained by collecting data at preset time intervals using a multi-parameter water quality probe deployed in the target water body. The multi-parameter water quality probe is deployed by fixing a multi-parameter probe, which integrates sensors for water temperature, pH, conductivity, dissolved oxygen, turbidity, and redox potential, at a representative monitoring section of the target water body. The probe installation depth should be determined based on the hydrological characteristics of the water body. Preferably, for groundwater channels or nearshore areas of lakes and reservoirs with a water depth of less than 2 meters, the probe is installed at the mid-depth of the water body (i.e., 0.5 to 1 times the water depth below the surface); for water bodies with a depth greater than 2 meters, the probe is installed at a depth of 1.5 to 2 meters below the water surface. This depth effectively avoids interference from surface floating matter and oil films while also allowing for good mixing of the water quality characteristics of the mixing zone. Ultraviolet-visible absorption spectra are acquired by an immersion spectrometer at the preset time intervals. The concentrations of each ion are obtained by interpolation after analysis using an ion-selective electrode or periodic sampling in a laboratory, with the timestamps aligned with the preset time intervals.
[0023] The preset time interval is determined based on the rate of change of water temperature in the target water body and actual monitoring needs. For different types of water bodies such as rivers and lakes, and for different time periods such as high water season and low water season, the preset time interval can be selected within the range of 15 minutes to 4 hours. Preferably, for small and medium-sized rivers, the preset time interval is set to 1 hour; for large lakes and reservoirs, the preset time interval is set to 2 hours. A 1-hour sampling interval can achieve a balance between capturing short-term pulse disturbances (such as rainstorm runoff) and reducing data redundancy, thereby ensuring that the calculation of dynamic pulse fingerprints has sufficient statistical sample size and timeliness. At the same time, in order to ensure the real-time performance of subsequent feature extraction, the preset sampling window is preferably 12 to 48 hours, more preferably 24 hours. A 24-hour window can cover a complete diurnal cycle, thereby effectively filtering out the interference of diurnal fluctuations such as light and water temperature on the state determination, while also being able to respond promptly to short-term changes in water quality events.
[0024] In this embodiment, the method for constructing the dynamic pulse fingerprint is as follows: conductivity and turbidity are selected as sensitive indicator parameters; conductivity comprehensively reflects the total amount of dissolved ions in the water body and responds quickly to events such as snow melting agent input, agricultural non-point source pollution, or industrial wastewater discharge; turbidity directly indicates the concentration of suspended particulate matter and is extremely sensitive to soil erosion caused by rainfall and the input of particulate pollutants; the combination of the two can effectively capture the signals of most hydrological disturbance events.
[0025] The preset sampling window contains multiple sampling points, each corresponding to a sampling time. The time interval between adjacent sampling times is recorded as the preset time interval. The standard deviation of the fluctuation of the sensitive indicator parameter within the preset sampling window, the difference between the beginning and end of the window, and the proportion of outliers exceeding the preset stable interval are calculated. The difference between the beginning and end of the window is the difference between the measured values of the sensitive indicator parameter at the end time and the beginning time of the preset sampling window.
[0026] The preset stable interval is determined by statistical analysis of historical baseflow monitoring data of the target water body under conditions of no precipitation and no snowmelt disturbance. Specifically, the determination method is as follows: First, select a continuous period within at least one complete hydrological year in the watershed where the target water body is located, during which there is no effective precipitation (e.g., daily rainfall less than 0.5 mm) and it is not the snowmelt period, as the historical baseflow period; then, extract the 5th to 95th percentiles of conductivity and turbidity monitoring data within this baseflow period, and use the upper and lower limits of this interval to constitute the preset stable interval. For example, the stable conductivity interval of a certain river during the baseflow period is 280 to 350. The turbidity stability range is 2.5 to 8.0 NTU. Using the 5th to 95th percentiles to define the stability range can eliminate the interference of a very small number of outliers and statistically robustly characterize the range of baseline fluctuations that truly represent undisturbed fluctuations.
[0027] The standard deviation of fluctuation, the difference between the beginning and end of the window, and the proportion of outliers are used to construct a three-dimensional feature vector as a dynamic pulse fingerprint, where: The formula for calculating the standard deviation of the fluctuation is: in, This represents the standard deviation of the fluctuation of conductivity or turbidity within a preset sampling window. This refers to the measured value of the index at the nth sampling time within the preset sampling window. The average value of the indicator within the preset sampling window is N, the number of sampling points within the preset sampling window is N, and the sampling time index is n within the preset sampling window. The standard deviation of fluctuation quantifies the overall fluctuation range of the water quality indicator within the window and is the core indicator characterizing the intensity of the disturbance.
[0028] The formula for calculating the difference between the beginning and end of the window is: in, The difference between the beginning and end of the window. This is the measured value at the last sampling time within the preset sampling window. This is the measured value at the initial sampling time of the preset sampling window. The difference between the beginning and end of the window can reflect the overall trend and direction of water quality changes. A positive value indicates that the indicator is continuously increasing (such as continuous input of pollutants), and a negative value indicates that the indicator is continuously decreasing (such as the dilution process).
[0029] The formula for calculating the percentage of outliers is: in, The percentage of outliers. This represents the number of sampling points whose measured values exceed the preset stable interval within a preset sampling window. The outlier percentage quantifies the duration of the disturbance over time, and when combined with the standard deviation of the fluctuation, it can distinguish between two different scenarios: short-term shocks and sustained disturbances.
[0030] Taking electrical conductivity as an example, if data is collected once per hour within a 24-hour sampling window, resulting in 24 conductivity measurements, then n=24. =24. If the conductivity values at 5 of these times exceed the steady-state range (280-350), ),but =5, outlier percentage R≈0.208. Meanwhile, if the standard deviation of these 24 values... The calculated value is 42.3. The conductivity at the end of the window is 390. The starting point is 305. The difference between the beginning and end of the window The final dynamic pulse fingerprint component corresponding to the conductivity of the window is obtained as a three-dimensional vector [42.3, 85, 0.208]. Similarly, a three-dimensional vector is also calculated for the turbidity index. Finally, the three-dimensional vectors corresponding to conductivity and turbidity are concatenated into a six-dimensional vector, which together constitute the dynamic pulse fingerprint.
[0031] The method for constructing the ion ratio fingerprint is as follows: based on the measured values of chemical indicators in the target water body, the ratio of sodium ions to the sum of calcium and magnesium ions, and the ratio of chloride ions to bicarbonate ions are calculated; the specific calculation formula is as follows: in, This represents the ratio of sodium ions to the sum of calcium and magnesium ions. This represents the ratio of chloride ions to bicarbonate ions. These represent the molar concentrations (in mmol / L) of sodium, calcium, magnesium, chloride, and bicarbonate ions, respectively. If the original data is in mass concentration (mg / L), it must be converted to molar concentration before calculation to ensure the stoichiometric significance of the ratios.
[0032] The reason for choosing these two ratios is that the ratio of sodium ions to the sum of calcium and magnesium ions can effectively distinguish between groundwater recharge (usually this ratio is low due to the balance between groundwater and aquifer minerals) and surface runoff or anthropogenic input (such as the large input of NaCl from snow-melting agents, which will significantly increase this ratio); the ratio of chloride ions to bicarbonate ions can indicate the degree of salinization and pollution sources in natural water bodies. Anions usually dominate, but when domestic sewage or industrial wastewater is input... This can rise abnormally, causing the ratio to increase significantly. Together, they characterize changes in water chemistry from both cation and anion perspectives.
[0033] The two ratios mentioned above are used to construct a two-dimensional feature vector, which serves as the ion ratio fingerprint.
[0034] The multidimensional state fingerprint feature is a feature vector composed of a dynamic pulse fingerprint and an ion ratio fingerprint. In this embodiment, the ion ratio fingerprint is calculated based on the concentration values of each ion at the end of a preset sampling window. The dynamic pulse fingerprint reflects the temporal dynamic changes within the entire window, while the ion ratio fingerprint represents the instantaneous water chemical composition at the end of the window. This combination of process and state features captures both the dynamic characteristics of water quality disturbances and solidifies the static properties of the current water chemical background, providing complementary input for subsequent two-stage clustering.
[0035] Step 2: Perform similarity matching between the multidimensional state fingerprint features and multiple benchmark state patterns in the pre-built state pattern library to determine the membership degree of the target water body's current state to the benchmark state patterns.
[0036] In this embodiment, historical water quality monitoring data of the target water body's basin over multiple complete hydrological years are collected. The historical water quality monitoring data is sliced according to a preset time window, and multidimensional state fingerprint features are extracted for each slice. The sampling time interval of each sampling point in the historical water quality monitoring data is consistent with the preset time interval.
[0037] The historical water quality monitoring data are identical to the physicochemical index measurements described in step 1 in terms of the type and sampling specifications of the physicochemical indicators. The multiple complete hydrological years are preferably no less than three complete hydrological years. Data from three hydrological years typically cover typical hydrological scenarios such as high-water years, normal-water years, and low-water years, ensuring the representativeness and generalization ability of the constructed state pattern library. The preset time window is consistent with the preset sampling window used in step 1 for extracting multidimensional state fingerprint features, preferably 24 hours. Adjacent windows can be sliced using an overlapping sliding method with a sliding step size of 1 to 6 hours to expand the sample size and capture the transition process of state transitions. For example, for three years of historical monitoring data, if the sampling interval is 1 hour, the window length is 24 hours, and the sliding step size is 3 hours, approximately 8760 window slice samples can be obtained, which is sufficient to support stable cluster analysis.
[0038] Based on the feature vector set composed of multidimensional state fingerprint features of all slice data, unsupervised clustering analysis is performed on it. The clustering analysis adopts a two-stage strategy: the first stage uses ion ratio fingerprint as the main feature for clustering to distinguish different hydrochemical background types; the second stage uses dynamic pulse fingerprint as the main feature within each background type divided in the first stage for secondary clustering to distinguish different hydrological disturbance intensity levels.
[0039] The hydrochemical background of the target water body's basin typically exhibits significant spatial differences and temporal evolution, which forms the basis for the first stage of clustering based primarily on ion ratio fingerprints. Specifically: in terms of geological background, the upstream areas of the basin are mostly composed of carbonate rock strata, with groundwater recharge primarily from... and The main thing is that Typically below 0.5, Typically below 0.3; however, downstream plains may contain evaporite (such as gypsum, rock salt) strata or areas of soil salinization, leading to... Rise above 1 The level rose to above 0.8. Regarding human impacts, the extensive use of de-icing agents (mainly NaCl) on roads during winter will cause water bodies to... and Concentration surged simultaneously. and All values significantly deviated from natural background values; agricultural irrigation tailwater may cause... The level increases due to cation exchange. These differences in water chemistry background from different sources can be fingerprinted using ion ratio fingerprinting. and Effective capture and quantification are crucial. If samples with different water chemistry backgrounds are mixed for single-stage clustering, the strong variance of water chemistry types will mask subtle differences in perturbation intensity, leading to mixed physical meanings in the clustering results and poor homogeneity of subsequent predictive sub-model training data. Therefore, dividing the data according to water chemistry background type in the first stage is a key step to ensure the clear physical interpretability of the entire state pattern library.
[0040] The second stage involves secondary clustering within the various background levels identified in the first stage, using dynamic pulse fingerprints as the primary feature. This is necessary because even with the same hydrochemical background type, water quality change patterns, pollutant migration mechanisms, and concentration response characteristics differ fundamentally under different hydrological disturbance intensities (such as light rain runoff, torrential rain peaks, and snowmelt pulses). The three dimensions of the dynamic pulse fingerprint—fluctuation standard deviation, window head-to-tail difference, and outlier percentage—can quantify the disturbance intensity from three aspects: fluctuation amplitude, direction of change, and duration, thereby effectively distinguishing different disturbance intensity levels under the same hydrochemical background.
[0041] The number of clusters in the first stage (i.e., the number of hydrochemical background types) and the number of clusters within each category in the second stage (i.e., the number of hydrological disturbance intensity levels) were both objectively determined using quantitative methods, rather than being pre-set. Specifically, the optimal number of clusters was selected using the silhouette coefficient method combined with the elbow rule. Taking the first-stage ion ratio fingerprint clustering as an example, for candidate cluster numbers k=2,3,4,…,10, the K-means clustering algorithm is executed respectively, and the silhouette coefficient of the clustering result corresponding to each k value is calculated. The formula for calculating the silhouette coefficient S is: in, Represents the silhouette coefficient of the i-th sample. Let i be the average distance between sample i and all other samples in the same cluster. S(i) represents the average distance between sample i and all samples in its nearest neighboring clusters. Here, all distances are calculated using Euclidean distance. i represents the sample index, which is the multidimensional state fingerprint feature vector corresponding to each slice of data. The average value of S(i) for all samples is the overall silhouette coefficient of the clustering result, which ranges from [-1, 1]. The closer it is to 1, the more compact the clustering result and the better the separation.
[0042] Simultaneously, the sum of squared intra-cluster errors corresponding to each k value is calculated, and a curve showing the sum of squared intra-cluster errors as a function of k values is plotted. The elbow position, where the rate of descent of the curve changes from steep to gentle, is selected as the reference number of clusters. Combining the k value corresponding to the maximum silhouette coefficient and the k value indicated by the elbow rule, the final number of clusters in the first stage, K1, is determined.
[0043] For example, cluster analysis of the ion proportion fingerprint of three years of historical monitoring data for a certain watershed showed that the silhouette coefficient reached its maximum value of 0.72 at k=3, and the sum of squared errors within clusters curve showed a clear inflection point at k=3. Therefore, K1=3 was determined, indicating that there are three typical hydrochemical background types in this watershed. These correspond to: Type-A, natural carbonate baseflow type (…). Approximately 0.3-0.6, Approximately 0.1-0.4); Type-B, evaporation-concentration / salting-affected type ( Approximately 1-2.5, Approximately 0.6-1.5); Type-C, considered to be NaCl input type (such as the influence of de-icing agents, Approximately 2.5, (Approximately 1.5).
[0044] In the second stage, for samples within each hydrochemical background type, using dynamic pulse fingerprints as input features, the same silhouette coefficient combined with the elbow rule clustering analysis method is performed to determine the optimal perturbation intensity level K2 for that background type. For example, analysis within Type-A determines K2=3, corresponding to three levels: low perturbation (baseflow steady state), medium perturbation (general runoff), and high perturbation (rainstorm peak). Therefore, Type-A hydrochemical background type is divided into three sub-state patterns, whose combinations can be represented as A-1, A-2, and A-3. Similarly, Type-B and Type-C also use the same quantitative method to determine their respective perturbation intensity levels, thus obtaining the total number of baseline state patterns in the entire watershed water quality state space.
[0045] The number of disturbance intensity levels within different hydrochemical background types can be unequal. For example, Type-A, dominated by natural baseflows, has relatively simple disturbance event types and may be divided into 3 levels; while Type-C, influenced by anthropogenic factors, may be affected by multiple types of anthropogenic activities, making 4 levels more reasonable. This asymmetric clustering method can more precisely adapt to the hydrological response characteristics of different hydrochemical backgrounds, avoiding information loss caused by a one-size-fits-all pre-set cluster number.
[0046] Based on the results of two-stage unsupervised clustering analysis, several baseline state patterns and their corresponding cluster center vectors are determined. Each baseline state pattern is associated with and stored with its cluster center vector to form the state pattern library. The baseline state patterns include reduced state, high turbidity state, high salinity state, and steady state. The reduced state represents the freezing of water bodies due to low temperature and hypoxia in winter, the high turbidity state represents the water pulse input from snowmelt runoff in spring, the high salinity state represents the high salinity state of water bodies caused by evaporation and concentration in summer, and the steady state represents the groundwater base flow during periods of no disturbance.
[0047] The cluster center vector is calculated as follows: for the multidimensional state fingerprint feature vectors of all samples belonging to the same baseline state pattern after clustering, the arithmetic mean is calculated in each feature dimension, and the mean values of each dimension are combined into a vector with the same multidimensional state fingerprint feature dimension, which is the cluster center vector of the baseline state pattern.
[0048] In a state pattern library example, the final derived baseline state pattern and its cluster center vector (taking an 8-dimensional vector as an example, the first 6 dimensions are dynamic pulse fingerprints, and the last 2 dimensions are ion ratio fingerprints) are as follows: The baseline state model M1 (steady-state / basic-current type, such as Type-A-1) has cluster centers of [2.8, 5.2, 0.05, 1.9, 3.5, 0.04, 0.45, 0.25], characterized by small fluctuations in all dimensions, and the ion ratio indicating the recharge of natural carbonate groundwater. The baseline state mode M2 (high turbidity / spring snow melting pulse type, such as Type-C-3) has cluster centers of [85.6,210.3,0.72,156.8,320.5,0.68,3.25,2.1], characterized by drastic fluctuations in turbidity and conductivity, a high proportion of outliers, and ion ratios indicating the input of snow melting agents. The baseline state pattern M3 (high salinity / summer evaporation and concentration type, such as Type-B-2) has cluster centers of [12.4, 45.8, 0.22, 10.6, 38.2, 0.19, 1.85, 1.15], characterized by moderate fluctuations and ion ratios indicating salinization background. Baseline state mode M4 (reduced state / winter frozen type, such as Type-A-3): cluster centers are [1.5,3.1,0.02,0.8,2.2,0.0.1,0.52,0.28], characterized by extremely low fluctuation indicators and the water body being in a near-stagnant state.
[0049] The names of the reduced state, high turbidity state, high salinity state, and steady state are semantic labels assigned artificially after clustering is completed, based on the actual physicochemical characteristics and hydrological and meteorological background of each type of sample, so as to facilitate understanding and interaction by operation and management personnel; the label naming does not affect the clustering process itself.
[0050] The multidimensional state fingerprint features extracted in step 1 are compared one by one with the cluster center vectors of each benchmark state pattern in the state pattern library to calculate the distance. The benchmark state pattern with the smallest distance is taken as the matching pattern. The membership degree of the target water body to the matching pattern is calculated based on the distance. The membership degree is negatively correlated with the distance. If the distance exceeds the preset state judgment distance threshold, the membership degree is set to zero and the target water body is determined to be in an unknown state.
[0051] The distance is preferably a Euclidean distance, and its calculation formula is as follows: Where D is the Euclidean distance between the multidimensional state fingerprint features extracted in step 1 and the cluster center vector of a certain baseline state pattern. The value of the extracted multidimensional state fingerprint feature in the j-th dimension, Let j be the value of the cluster center vector of the baseline state pattern in the j-th dimension. The summation is performed across all 8 dimensions of the multidimensional state fingerprint feature, where j is the dimension index.
[0052] The formula for calculating the membership degree is: Where M is the membership degree of the current state of the target water body to a certain baseline state model; this formula ensures that the membership degree takes values in the range of (0, 1]. When the distance D = 0 (complete overlap), the membership degree M = 1; the larger the distance D, the closer the membership degree M is to 0. This negative correlation function form has the characteristics of smoothness, continuity, and no parameter mutation, which is beneficial to the stability of subsequent model matching and weighted fusion.
[0053] The method for determining the preset state determination distance threshold is as follows: For each baseline state pattern in the state model library, calculate the Euclidean distance from all historical samples belonging to that pattern to the cluster center vector of that pattern, and take the 95th percentile of these distances as the candidate distance threshold for that pattern; then take the maximum value among all candidate distance thresholds of the baseline state patterns as the globally unified preset state determination distance threshold. Using the 95th percentile instead of the maximum distance can eliminate the excessive influence of a very small number of outlier samples on the threshold setting, ensuring that the threshold has statistical robustness; taking the maximum value of the candidate thresholds of each pattern as the globally unified threshold is to avoid the normal fluctuations of some patterns being misjudged as unknown states due to differences in compactness within different patterns.
[0054] For example, in a certain monitoring, the distances between the multidimensional state fingerprint features extracted in step 1 and the cluster centers of each benchmark state pattern in the state pattern library are as follows: D1 (steady state) = 6.25, D2 (high turbidity state) = 5.87, D3 (high salinity state) = 7.13, and D4 (reduced state) = 8.02. The minimum distance is D2 = 5.87, which exceeds the preset state judgment distance threshold of 5. Therefore, all membership degrees are set to zero, and the target water body is determined to be in an unknown state. Conversely, if the minimum distance is D1 = 2.1, which does not exceed the threshold, the matching pattern is M1 (steady state), and the membership degree M = 1 / (1+2.10) ≈ 0.323. This membership degree value will be used in step 3 to match and activate the corresponding target prediction sub-model.
[0055] This embodiment uses historical monitoring data from three consecutive complete hydrological years in the watershed where the target water body is located to construct a sample set for the state pattern library. The monitoring data sampling interval is 1 hour, the preset sampling window length is 24 hours, and the sliding step size is 3 hours, resulting in approximately 8760 window slice samples. For each sample, the data is extracted using... and The data consists of ion proportion fingerprints and dynamic pulse fingerprints, which are composed of the standard deviation of conductivity fluctuations, the difference between the beginning and end of the window, and the proportion of outliers. Tables 1 and 2 below show the typical sample data and their clustering results used for the first and second stage clustering analyses, respectively. Table 1 lists the ion proportion fingerprint characteristics and corresponding water chemistry background type classification results for 30 historical window samples. Table 2, taking samples within the Type-A background type as an example, lists the dynamic pulse fingerprint characteristics and their perturbation intensity level classification results for 30 samples. It should be noted that the data in the tables are representative samples randomly selected stratified according to the clustering results from all samples to clearly show the distribution pattern of samples in the feature space; specifically as follows: Table 1. Example table of clustering data in the first stage: Based on the data in Table 1 and Figure 2 The distribution pattern of the historical samples in the ion ratio feature space shows that the 30 sample points exhibit three distinct cluster structures: Type-A samples are clustered in... Approximately 0.29-0.55 The low-value region of approximately 0.15-0.38, with cluster centers at (0.45, 0.25), represents a natural baseflow-type hydrochemical background primarily fed by carbonate groundwater; Type-B samples cluster in... Approximately 1.25-2.15 The median range of approximately 0.55–1.32, with cluster centers at (1.85, 1.15), represents a high salt background influenced by evaporation concentration or soil salinization; Type-C samples clustered in... Approximately 2.55-3.48 The high-value region of approximately 1.48–2.35, with its cluster center at (3.25, 2.10), represents a pollution background dominated by anthropogenic inputs of NaCl, such as de-icing agents. The three sample types show no spatial overlap and have clear boundaries, indicating that the ion ratio fingerprint can effectively capture and quantify the essential differences in water chemistry sources, providing clear physical separability for the first-stage clustering.
[0056] Table 2. Example table of clustering data in the second stage: Table 2 data and Figure 3This further demonstrates the distribution pattern of Type-A background samples in the dynamic pulse fingerprint space. Figure 3 Using the standard deviation of conductivity fluctuation as the X-axis, the difference between the beginning and end of the window as the Y-axis, and the proportion of outliers as the Z-axis, the 30 sample points also exhibit three distinct clusters in three-dimensional space: Sample A-1 (low disturbance / baseflow steady state) is tightly clustered near the origin, with its cluster center at (2.8, 5.2, 0.05). The values in all three dimensions are extremely small, indicating that water quality fluctuations are weak, there are no significant trends, and there are almost no outliers under this condition, consistent with the steady-state characteristics of the baseflow recharge period; Sample A-2 (medium disturbance / The general runoff sample is distributed in the middle region of the three-dimensional space, with a cluster center of (20.1, 38.5, 0.25). The values of the three dimensions are moderate, representing the mild disturbance caused by general rainfall runoff. The A-3 sample (high disturbance / rainstorm peak) is significantly far away from the origin and is distributed in the high value region, with a cluster center as high as (85.6, 210.3, 0.72). Its fluctuation amplitude, change trend and abnormal persistence are far greater than the former two, accurately depicting the dynamic characteristics of the violent water quality fluctuation during the rainstorm peak.
[0057] The data in Tables 1 and 2 demonstrate the significant advantages of the proposed two-stage clustering strategy: The first stage uses ion ratio fingerprints as the primary feature for clustering, effectively decoupling different background types at the water chemistry source level and avoiding the variance-dominated effect caused by background differences, thus providing clear physical interpretability for state division. The second stage performs secondary clustering within each background level using dynamic pulse fingerprints as the primary feature, sensitively distinguishing different intensities of hydrological disturbances under the same water chemistry background, achieving a refined characterization of water quality status from two orthogonal dimensions: static source and dynamic process. Both stages of clustering exhibit compact intra-cluster structures and clear inter-cluster separation in their respective feature spaces, providing robust and quantifiable state boundaries for subsequent state membership calculations and predictive sub-model matching.
[0058] Step 3: Based on the membership degree, match and activate the corresponding target prediction sub-model from the pre-built water quality prediction model library; wherein, the water quality prediction model library includes multiple prediction sub-models, and each prediction sub-model is bound to a baseline state pattern in the state pattern library.
[0059] In this embodiment, the construction method of the water quality prediction model library specifically includes: According to the baseline state patterns defined in the state pattern library, historical water quality monitoring data are categorized into the corresponding patterns to form a dedicated training dataset for each baseline state pattern. The input feature of each training data is a time series composed of physicochemical index measurements at multiple consecutive times, and the output label is the target pollutant concentration value within a preset future prediction period. The target pollutant includes at least one of fluoride, arsenic, or chloride, and the target pollutant concentration value is obtained through laboratory analysis.
[0060] The length of the time series spanning multiple consecutive time points, i.e., the historical backtracking step size of the input features, is preferably a value that matches the preset sampling window length in step 1. For example, if the preset sampling window in step 1 is 24 hours and the sampling interval is 1 hour, then the multiple consecutive time points are 24 time points (i.e., a 24-hour backtracking window). Setting this backtracking step size ensures that the amount of input information of the model is consistent with the amount of information identified in state recognition in step 1, ensuring the continuity of information from state recognition to prediction execution.
[0061] The preset prediction period is determined based on the lead time for water quality warnings and the response characteristics of the target pollutants, and is preferably between 4 and 72 hours. For example, for turbidity-related pollutants with relatively rapid responses (such as particulate arsenic), the preset prediction period is set to 6 hours; for dissolved pollutants with slower migration and transformation processes (such as fluorides and chlorides), the preset prediction period is set to 24 hours. Differentiating the prediction periods for different pollutants allows for better matching of their respective migration and transformation kinetics.
[0062] The output label is obtained by analyzing the target pollutant concentration value obtained from the historical water quality monitoring data at the end of the preset prediction period or within that period using standard laboratory methods. If the preset prediction period is 24 hours, the label is the maximum value in the target pollutant concentration sequence collected at preset time intervals and analyzed by the laboratory within that 24-hour period (used for early warning of the worst-case scenario), or the concentration value at the end of that period (used for continuous trend prediction). Preferably, the concentration value at the end of the period is used as the label to ensure the causal consistency of the time series prediction.
[0063] For each baseline state mode, a pre-defined feature weight vector is preset; the preset feature weight vector is a vector with the same length as the input feature dimension, wherein the value of each element is determined according to the sensitivity of the measured values of each physicochemical index to the change in the concentration of the target pollutant under the baseline state.
[0064] Specifically, the response sensitivity is determined in the following way: For each baseline state mode, physicochemical indicators and corresponding target pollutant concentrations of all samples in its dedicated training dataset are collected; the weighted average of Pearson correlation coefficient and random forest feature importance score (each accounting for 50%) is used as the comprehensive sensitivity score; the indicators with the highest comprehensive sensitivity are defined as high-sensitivity indicators, with their weights set to 1-1.2, and the weights of the remaining indicators are set to 0.3-0.6; on the validation set, the weights are fine-tuned with the goal of minimizing the root mean square error of prediction, but the relative relationship between high-sensitivity indicators and non-sensitivity indicators is not changed.
[0065] For example, in a high-turbidity state, the combined sensitivity scores of turbidity, conductivity, and UV-Vis absorption spectroscopy are significantly higher than other indicators, so their weights are set to 1-1.2; in a reduced state, water temperature, dissolved oxygen, and redox potential are highly sensitive indicators, with a weight of 1.
[0066] In addition, the feature weight vector can also be determined in a data-driven manner: based on the dedicated training dataset of each benchmark state mode, with the goal of minimizing the prediction error under the weighted input time series, the Bayesian optimization algorithm is used to directly optimize in the weight space, and finally outputs the weight vector that minimizes the prediction error of the validation set.
[0067] Using the preset feature weight vector bound to each baseline state mode, perform element-wise multiplication on the feature vector of each input feature in the dedicated training dataset of that baseline state mode at each time step to generate a weighted training dataset.
[0068] The element-wise multiplication operation specifically involves the following: For a given training data input feature time series, this time series consists of feature vectors at 24 consecutive time points. The dimension of the feature vector at each time point is equal to the number of types of physicochemical index measurements. In this embodiment, the physicochemical indexes include water temperature, pH, conductivity, dissolved oxygen, turbidity, redox potential, UV-Vis absorption spectrum, sodium ion concentration, calcium ion concentration, magnesium ion concentration, chloride ion concentration, and bicarbonate ion concentration, plus the absorbance values of the UV-Vis absorption spectrum at several characteristic wavelengths, collectively denoted as d-dimensional features. At each of the 24 time points, a preset feature weight vector is used to perform element-wise multiplication with the d-dimensional feature vector at that time point, resulting in the weighted feature vector at time t. ,in, , These represent the eigenvector after feature weighting at time t and the original eigenvector, respectively, where t is the time index. For the preset feature weight vector, This represents element-wise multiplication. After weighting, the overall dimension of the input time series remains unchanged (still 24×d), but different feature dimensions are assigned different importance, thus allowing subsequent model training to focus on the features most relevant to the current baseline state pattern.
[0069] For each baseline state pattern, a prediction sub-model is independently trained using its weighted training dataset. Each prediction sub-model adopts a time series prediction model suitable for the data characteristics of that pattern.
[0070] If the baseline state is a reduced state, a statistical regression model is selected. In a reduced state (such as during the winter ice-covered period), the aquatic environment is relatively closed, with slow and limited changes in parameters such as water temperature and dissolved oxygen, and relatively stable linear or weakly nonlinear relationships between various physicochemical indicators. Under these data characteristics, statistical regression models (such as multiple linear regression or ridge regression) have the advantages of simple structure, efficient training, and low risk of overfitting. Specifically, a ridge regression model with L2 regularization can be selected, where the regularization coefficient is determined through cross-validation. The search determines the outcome. Taking a weighted input of d-dimensional features at 24 time points as an example, the 24×d-dimensional features are flattened into a long vector as the input independent variable of the regression model, and the output dependent variable is the concentration value of the target pollutant within the preset prediction period.
[0071] If the baseline state is a high-turbidity state, then a gradient boosting tree model should be selected. High-turbidity states are typically triggered by short-duration, strong disturbances such as heavy rain runoff or snowmelt pulses. Indicators such as turbidity, conductivity, and UV-Vis absorption spectra undergo drastic, nonlinear changes within a short period, and there are complex threshold effects and interactions between particulate pollutant concentrations and these indicators. Gradient boosting tree models (such as XGBoost or LightGBM) excel at handling nonlinear relationships, feature interactions, and outliers, making them highly suitable for this data characteristic. Specifically, the XGBoost model can be chosen, with the following key hyperparameter settings: the number of trees is determined on the validation set using early stopping, and the maximum tree depth is [value missing]. Searching in the middle, the learning rate is The search is performed with a subsampling ratio of 0.8 to prevent overfitting. The input features are processed in the same way as the regression model described above, that is, the weighted 24×d-dimensional features are flattened before input.
[0072] If the baseline state is high salinity, a Long Short-Term Memory (LSTM) network model is selected. Evaporation and concentration under high salinity is a typical time-cumulative effect; the current ion concentration depends not only on current meteorological and hydrological conditions but also on the cumulative evaporation and ion enrichment history over a past period. LSM networks, due to their built-in gating mechanisms (forget gate, input gate, output gate), can effectively capture long-range dependencies in time series, making them suitable for modeling water quality evolution processes with memory effects. Specifically, a two-layer LSTM structure can be used, with 64 or 128 hidden units per layer, determined by the validation set. A fully connected layer is added after the LSTM layer as the regression output layer; ReLU is used as the activation function; Adam is used as the optimizer, with an initial learning rate of 0.001 and cosine annealing scheduling; the batch size is set to 32, the maximum number of training epochs is set to 200, and early stopping is implemented. The input is a weighted 24×d-dimensional time series, which does not need to be flattened; the time dimension is retained before being fed into the LSTM layer.
[0073] If the baseline state is steady-state, an autoregressive model is selected. Under steady-state conditions, the water body is in a baseflow recharge state, and the time series of target pollutant concentrations exhibits strong autocorrelation characteristics. Future concentration values mainly depend on historical concentration values from several past moments. The autoregressive model is simple in form, requires less computation, and can efficiently capture the inherent patterns of such stationary time series. Specifically, the AR(p) model can be used, where the order p is determined by partial autocorrelation function analysis combined with the Akaike information criterion, and p is typically taken as 2 to 5. The model input is only the historical concentration time series of the target pollutant itself (not all physicochemical indicators), with a length of p moments. If it is necessary to integrate other physicochemical indicator information into the model, it can be extended to an ARIMAX model.
[0074] In this embodiment, the process for determining the preset feature weight vector is as follows: The determination of weight values follows the general principle of "combining prior settings based on domain knowledge with posterior correction based on data". First, domain experts give a prior ranking and relative importance ratio of the sensitivity of each physicochemical table to changes in the concentration of target pollutants based on the hydrogeochemical excitation of each benchmark state model. Then, through the dedicated training dataset of the benchmark state model, the prior weights are verified and fine-tuned using the feature importance analysis method, and finally a preset feature weight vector is formed that takes into account both the rationality of the mechanism and the adaptability of the data.
[0075] When the selected state mode is the reduced state, the weight values of water temperature, dissolved oxygen, and redox potential in the preset feature weight vector are higher than the weight values of other feature values. Specifically, in the reduced state, the redox conditions of the water body are the dominant factors controlling the form and concentration of target pollutants (especially redox-sensitive elements such as arsenic and fluoride). Dissolved oxygen concentration directly determines the redox potential level of the water body, while water temperature indirectly regulates the redox state by affecting microbial activity and chemical reaction rates. Redox potential is the most direct chemical thermodynamic characterization. These three factors play a core controlling role in the evolution of water quality in the reduced state.
[0076] In one specific embodiment, the values of each element in the preset feature weight vector corresponding to the reduced state are as follows: water temperature weight = 0.8, pH weight = 0.3, conductivity weight = 0.3, dissolved oxygen weight = 1, turbidity weight = 0.2, redox potential weight = 1, UV-Vis absorption spectrum (average of each band) weight = 0.2, bicarbonate ion concentration weight = 0.2, calcium ion concentration weight = 0.2, magnesium ion concentration weight = 0.2, chloride ion concentration weight = 0.2, and bicarbonate ion concentration weight = 0.3. These weights were verified by normalizing the XGBoost feature importance scores on the dedicated training dataset for this reduced state. The sum of the importance scores for water temperature, dissolved oxygen, and redox potential accounted for 62% of the total feature importance scores, validating the rationality of the high weight settings. If the data validation results deviate significantly from the prior settings (for example, a feature has a high prior weight but a very low actual importance score), the actual data feedback will be used as the basis for correction, but the correction range shall not exceed ±50% of the original weight, in order to prevent the statistical randomness of a single dataset from causing weight instability.
[0077] When the selected state mode is high turbidity, the weight values of turbidity, conductivity, and UV-Vis absorption spectrum in the preset feature weight vector are higher than the weight values of other features. In high turbidity, a sharp increase in turbidity is the most direct indicator of a disturbance event; fluctuations in conductivity reflect the synchronous input or dilution process of dissolved pollutants; and UV-Vis absorption spectrum can effectively indicate changes in the concentration of colored dissolved organic matter and specific pollutants. These three together constitute the core parameter set for tracking the source and transport process of pollutants in high turbidity.
[0078] In one specific embodiment, the preset feature weight vector corresponding to the high turbidity state has the following values for each element: water temperature weight = 0.3, pH weight = 0.3, conductivity weight = 1, dissolved oxygen weight = 0.4, turbidity weight = 1.2, redox potential weight = 0.3, UV-Vis absorption spectrum (average of each band) weight = 1, sodium ion concentration weight = 0.4, calcium ion concentration weight = 0.3, magnesium ion concentration weight = 0.3, chloride ion concentration weight = 0.4, and bicarbonate ion concentration weight = 0.3. The turbidity weight is set to the highest value of 1.2, the conductivity and spectral weights are set to 1, and the weights of the remaining features are between 0.3 and 0.4.
[0079] When the selected state mode is high salinity, the weight values of conductivity, sodium ion concentration, calcium ion concentration, magnesium ion concentration, chloride ion concentration, and bicarbonate ion concentration in the preset feature weight vector are higher than the weight values of other features. Under high salinity, evaporation and concentration are the main controlling mechanisms of water quality changes, and the concentrations of all major ions are simultaneously enriched. At the same time, conductivity, as a substitute indicator of total ion concentration, increases accordingly. Therefore, conductivity and the concentrations of the six major ions are highly sensitive features and should be assigned higher weights.
[0080] In one specific embodiment, the values of each element in the preset feature weight vector corresponding to high salinity are as follows: water temperature weight = 0.4, pH weight = 0.3, conductivity weight = 1, dissolved oxygen weight = 0.3, turbidity weight = 0.2, redox potential weight = 0.3, UV-Vis absorption spectrum weight = 0.3, sodium ion concentration weight = 0.9, calcium ion concentration weight = 0.8, magnesium ion concentration weight = 0.8, chloride ion concentration weight = 0.9, and bicarbonate ion concentration weight = 0.8. Conductivity, as a comprehensive indicator, is assigned the highest weight of 1. The weights of the six main ion concentrations are all between 0.8 and 0.9, and non-ionic features are assigned lower weights.
[0081] When the selected state mode is steady state, the weight values of each element in the preset feature weight vector are equal. Under steady state conditions, the various physicochemical indicators of the water body fluctuate narrowly within their stable ranges, and there are no significant abnormal changes in one or several types of indicators. The contributions of all features to the prediction of the target pollutant concentration are relatively balanced. Therefore, equal weighting is adopted. In a specific embodiment, all elements of the preset feature weight vector corresponding to steady state are set to 0.5. The equal weighting here does not mean that there is no difference at all, but rather that all features are assigned the same non-zero coefficient, which ensures that each feature participates equally in model training, and allows for overall adjustment of the weighting degree by coefficient scaling when necessary.
[0082] The values of each feature weight vector mentioned above have been verified through backtesting of the feature importance of the corresponding dedicated training dataset to ensure their rationality and data adaptability. The specific values given above are only the optimal values for the current embodiment. When actually deployed in different watersheds, they can be appropriately adjusted around the above values according to the specific hydrogeochemical background and data distribution of the target water body. The adjustment principle is to keep the relative weight ratio of features within the same category unchanged.
[0083] In this embodiment, the specific logic for matching and activating the corresponding target prediction sub-model is as follows: Obtain the membership degree of the target water body to the matching pattern, and select the baseline state pattern with the highest membership degree and a distance not exceeding the preset state judgment distance threshold as the selected state pattern.
[0084] The prediction sub-model bound to the selected state mode is retrieved as the target prediction sub-model and activated. If the target water body is determined to be in an unknown state, that is, the distances corresponding to all baseline state modes exceed the preset state determination distance threshold, then no sub-model bound to the baseline state mode in the water quality prediction model library is activated. Instead, the preset general conservative prediction strategy is triggered, and alarm information for marking the unknown state is generated.
[0085] For example, the membership degrees (i.e., the corresponding Euclidean distances) of the target water body to the four baseline state modes obtained from step 2 are as follows: membership degree to M1 (steady state) 0.323 (D=2.1), membership degree to M2 (high turbidity state) 0.167 (D=5), membership degree to M3 (high salinity state) 0.123 (D=7.13), and membership degree to M4 (reduced state) 0.111 (D=8.02); the preset state determination distance threshold is set to 5.
[0086] First, the baseline state patterns whose distance does not exceed the preset state judgment distance threshold are selected. The distance of M1 is 2.1 < 5, which meets the condition; the distance of M2 is 5, which does not exceed (or is equal to) the threshold, which meets the condition; the distances of M3 and M4 are 7.13 and 8.02 respectively, which both exceed 5, and do not meet the condition.
[0087] Then, among M1 and M2 that meet the conditions, the membership degree is compared; M1 membership degree 0.323 > M2 membership degree 0.167, so M1 (steady state) is selected as the selected state mode.
[0088] Finally, the prediction sub-model bound to M1, i.e. the autoregressive model corresponding to the steady state, is retrieved and activated as the target prediction sub-model.
[0089] If, during a monitoring session, the distance between all baseline state patterns exceeds 5, no bound sub-models will be activated, and a general conservative prediction strategy will be triggered. Simultaneously, an alarm message will be generated, containing at least the following: a timestamp, the distance and membership values of each baseline state pattern, the judgment result (unknown state), and recommended actions (triggering the conservative prediction strategy, monitoring for potential new pollution events). The alarm message can be pushed to operations and maintenance personnel via system interface, SMS, or email.
[0090] The preset state determination distance threshold is determined as follows: The statistical upper bound method based on cluster cohesion is used. For each baseline state pattern in the state pattern library, all historical samples that were assigned to that pattern in the two-stage clustering are obtained. The Euclidean distance from the multidimensional state feature vector of each of these historical samples to the cluster center vector of that pattern is calculated, which characterizes the natural dispersion of samples within the baseline state pattern. For the distance set under each baseline state pattern, the Pth percentile is taken as the candidate distance threshold for that pattern. The maximum value among all candidate distance thresholds is set as the globally unified preset state determination distance threshold. Here, the percentile P is a key preset parameter. In this embodiment, the value of P is preferably 95. This value is to avoid setting the threshold too loosely due to individual extreme outliers (e.g., abnormal fingerprints caused by momentary sensor failure or unscreened accidental contamination events).
[0091] The rationale for setting the maximum value as the preset state determination distance threshold lies in the inherent differences in the internal compactness of different baseline state modes. For example, in a steady-state mode, water quality fluctuations are small and internal convergence is high, so its 95th percentile distance may be very small (e.g., 1.5); while in a high-turbidity mode, turbidity pulses of different magnitudes are contained, resulting in high sample dispersion and a naturally larger 95th percentile distance (e.g., 4.8). If a small value (e.g., the average of the thresholds for each mode) is chosen as the global threshold, normal strong pulses will be frequently falsely reported as unknown states in high-turbidity states, leading to an excessively high false alarm rate and rendering the system useless. Therefore, setting the maximum value ensures that the state determination boundary can effectively cover the natural dispersion range of all known modes.
[0092] Step 4: Input the measured values of the physicochemical indicators of the target water body at the current and historical times into the activated target prediction sub-model to obtain the water quality prediction results of the target water body within the preset prediction period.
[0093] In this embodiment, the input data of the target prediction sub-model is a time series composed of the measured values of physicochemical indicators at multiple consecutive times, and the feature dimension of the input data is consistent with the input feature dimension used when training the target prediction sub-model.
[0094] To ensure that the feature dimensions of the input data during prediction are strictly consistent with those during training, the system must perform the same data preprocessing procedure on the real-time collected physicochemical index measurements as the training data before executing prediction. Specifically, this includes: handling missing values: if an index is missing at individual moments in a time series spanning multiple consecutive moments, linear interpolation is used to fill in the missing values; if more than three consecutive moments are missing, a data quality alarm is triggered and prediction is paused; handling outliers: if an index value exceeds the [0.1, 99.9th] percentile range of its historical monitoring data, it is replaced with the corresponding percentile boundary value to prevent unreasonable extreme values caused by occasional sensor malfunctions from interfering with the prediction results; and normalization: if standardization or normalization operations (such as Z-score standardization or Min-Max normalization) were performed on the data during training the target prediction sub-model, the mean and standard deviation (or minimum and maximum values) parameters saved during training must be used during prediction to perform a completely consistent transformation on the real-time input data.
[0095] When the target prediction sub-model is activated, the same preset feature weight vector used during model training is retrieved according to the selected state mode.
[0096] The preset feature weight vector is applied to the feature vectors at each time point in the input data sequence by element-wise multiplication to obtain a weighted input time series.
[0097] The output of the target prediction sub-model depends on the label format defined during model training. In one specific embodiment of step 3, the training label is the target pollutant concentration value at the end of a preset prediction period, and the model output is a single concentration prediction value at the end of the preset prediction period. In another embodiment, the training label is a sequence of target pollutant concentration values at each sampling time within the preset prediction period, and the model output is a concentration prediction time series curve.
[0098] Taking the most commonly used single concentration prediction value as an example: assuming the preset prediction period is 24 hours and the current time is T0, the model input is a weighted input time series consisting of physicochemical index measurements from time (T0-23) to time T0 (24 consecutive times). The model output is the predicted fluoride concentration at time (T0+24), in mg / L. If this predicted value exceeds the preset water quality standard limit (such as the Class III standard limit of 1.0 mg / L for fluoride in the "Surface Water Environmental Quality Standard"), the system automatically generates an early warning message to prompt operation and maintenance personnel to take countermeasures in advance.
[0099] In a preferred embodiment, for the high-turbidity prediction sub-model using a gradient boosting tree model, the confidence interval of the predicted value can be output using quantile regression or bootstrap sampling; for the high-salinity prediction sub-model using a long short-term memory network model, the mean and variance can be output simultaneously at the network output layer, or the distribution of the predicted value can be calculated after multiple forward propagations using the Monte Carlo dropout method. The quantification results of the prediction uncertainty can be presented on the user interface along with the point predicted values for reference in risk decision-making.
[0100] The target prediction sub-model outputs the target pollutant concentration value within a preset prediction period based on the weighted input time series.
[0101] In this embodiment, the preset general conservative prediction strategy is specifically as follows: The default prediction sub-model is retrieved from the water quality prediction model library, which is the prediction sub-model corresponding to the steady state.
[0102] The physicochemical parameters of the target water body at multiple consecutive times are input into the default prediction sub-model to obtain the initial prediction values.
[0103] The input data construction method of the default prediction sub-model is completely consistent with that of the normally activated target prediction sub-model in step 4. Specifically, if the input of the target prediction sub-model in step 4 is a weighted time series of 24 consecutive time points, then a weighted time series of 24 consecutive time points is also constructed here, and element-wise weighted using the preset feature weight vector (all elements are 0.5) corresponding to the steady state. The weighted time series is fed into the autoregressive model corresponding to the steady state, and the initial predicted value within the preset prediction period is output. This design ensures that even in an unknown state, the system can still provide a benchmark reference prediction using the most robust steady-state baseflow model, rather than outputting a completely blank value.
[0104] Simultaneously, the measured concentration value of the target pollutant in the target water body at the current moment is obtained, and the relative deviation between the measured concentration value of the target pollutant and the average value of the target pollutant concentration value in a preset backtracking period before the current moment is calculated. The relative deviation is characterized by the coefficient of variation.
[0105] The formula for calculating the coefficient of variation is: in, The coefficient of variation (dimensionless). This refers to the measured concentration of the target pollutant in the target water body at the current moment, obtained through laboratory analysis (the unit is consistent with the target pollutant, such as mg / L). This is a sequence composed of the target pollutant concentration values at various points within a pre-defined backtesting period prior to the current time. This is the arithmetic mean of the target pollutant concentrations during the retrospective period.
[0106] The duration of the preset backtesting period is determined comprehensively based on the hydrological response characteristics of the target water body and the migration and transformation cycle of the target pollutants. If the backtesting period is too short, the baseline mean will be unstable and greatly affected by random fluctuations; if the backtesting period is too long, samples with different water quality states may be mixed in, and the baseline mean will lose its reference value. In a specific embodiment, the preset backtesting period is set to 48 to 168 hours (i.e., 2 to 7 days) prior to the current time, preferably 72 hours (3 days). A 3-day backtesting window can cover a complete hydrological response process in most water bodies, while avoiding interference from seasonal trend changes on the baseline mean.
[0107] For example, suppose the measured concentration of the target pollutant fluoride at the current moment is 1.85 mg / L, and the arithmetic mean of the fluoride concentration sequence over a pre-set 72-hour backtest period is 1.2 mg / L, then the deviation coefficient... This positive value indicates that the current measured concentration is 54.2% higher than the recent baseline average, suggesting that the target water body may be on a path of increasing pollutant concentration.
[0108] The reason for using the coefficient of variation (COP) instead of the absolute difference to characterize the relative degree of deviation is that the COP undergoes normalization, which can eliminate the influence of differences in background levels of different target pollutant concentrations on the deviation determination. For example, a deviation of 0.65 mg / L is significant when the fluoride background is approximately 1.2 mg / L, while a deviation of 0.65 mg / L is considered normal fluctuation when the chloride background is 50 mg / L. COPs of 0.542 and 0.013 accurately reflect the essential difference in the degree of deviation between the two.
[0109] If the deviation coefficient is positive, the initial predicted value is multiplied by the preset upper limit of the safety factor to obtain the final prediction result; if the deviation coefficient is negative, the absolute value of the deviation coefficient is further compared with the preset abnormally low threshold: if the absolute value of the deviation coefficient is greater than the abnormally low threshold, the initial predicted value is multiplied by the lower limit of the preset safety factor to obtain the final prediction result; otherwise, the initial predicted value is used as the final prediction result; both the upper and lower limits of the preset safety factor are greater than 1.
[0110] For example: Scenario 1: (Current measured concentration is higher than the recent baseline average); this situation indicates that the target pollutant concentration is on an upward trend, while the steady-state model, based on the assumption of a stable baseflow, may underestimate future concentration peaks. Therefore, the initial predicted value is multiplied by a preset safety factor upper limit SU to obtain the final prediction result, thus covering the potential risk of underestimation with a safety margin.
[0111] Scenario 2: (The current measured concentration is lower than the recent baseline average); in this case, it is necessary to further determine whether this low level is abnormally low: Sub-case 2A: (That is, the level of contamination is lower than the preset abnormally low threshold). This situation may indicate sensor malfunction, sampling error, or a sudden dilution event (such as a large influx of clean water), rather than a natural decrease in the actual contaminant concentration. Directly using the initial predicted value may lead to a false alarm risk (the actual concentration may rebound rapidly). Therefore, the initial predicted value is multiplied by the preset safety factor lower limit SL to obtain the final prediction result, retaining a certain conservative margin.
[0112] Sub-case 2B: (That is, the lower amplitude is within the normal fluctuation range). This situation is considered to be a normal baseflow fluctuation in water quality, and the prediction results of the steady-state model have high reliability. Therefore, the initial prediction value is directly used as the final prediction result.
[0113] The preset safety factor upper limit SU, the preset safety factor lower limit SL, and the preset abnormally low threshold are... The specific values are as follows: The preset safety factor upper limit value: SU ranges from 1.2 to 2, preferably 1.5. It is determined by: retrospectively analyzing all cases in historical data that were initially classified as unknown but later converted to steady-state prediction, and statistically analyzing the distribution of the ratio between the actual peak pollutant concentration during the preset prediction period and the initial prediction value of the steady-state model. The 85th percentile of this ratio distribution is taken as the recommended value for SU. In one embodiment, the 85th percentile is 1.48, so SU is rounded down to 1.5. The upper limit coefficient of 1.5 can cover most extreme cases while avoiding overestimation leading to frequent false alarms.
[0114] The preset safety factor lower limit (SL) ranges from 1.05 to 1.3, preferably 1.15. Its determination is based on a similar criterion as (SU), but specifically on cases where the measured concentration was abnormally low in historical data and then rapidly rebounded. The 70th percentile of the ratio of the peak value after the actual concentration rebound to the initial predicted value in these cases is taken as the recommended value for SL. In one embodiment, this 70th percentile is 1.12, rounded up to 1.15. The value of SL is significantly lower than SU because the risk of a rebound after an abnormally low concentration is generally less than the risk of a continued increase when the concentration is already rising.
[0115] Preset abnormally low threshold: The value ranges from 0.3 to 0.6, preferably 0.5. Its physical meaning is: when the current measured concentration is more than 50% lower than the recent baseline average, it is considered abnormally low. This threshold is determined based on the 95th percentile of the absolute value of the coefficient of variation during historical normal baseflow fluctuations. In one embodiment, statistical analysis of 3 years of historical steady-state data showed that the 95th percentile of the absolute value of the coefficient of variation was 0.47, therefore, it was rounded down. =0.5. This setting allows the vast majority of normal base current fluctuations (approximately 95%) to be categorized into sub-case 2B, using the original forecast value, thereby reducing unnecessary conservative corrections.
[0116] The logic in this embodiment is that in the field of water quality safety early warning, the risk of underreporting pollutant concentration exceeding the standard is far higher than the risk of falsely reporting concentrations below the standard. Therefore, under unknown conditions where the model's cognitive ability is limited, the design principle of the strategy is to err on the side of overestimating the risk rather than underestimating it.
[0117] This strategy produces a refined asymmetric response to different concentration deviation directions: When the coefficient of variation is positive (indicating an upward trend in concentration), the current measured concentration is already higher than the recent baseline, indicating that the water quality is deviating from the steady-state assumption and may be in the early or developing stages of a pollution input event. In this case, the greatest risk is that the model, lacking experience with this new state, will severely underestimate the upcoming peak concentration. Therefore, multiplying the predicted value by a coefficient significantly greater than 1 (SU=1.5) to proactively adjust it upwards is to compensate for the potential risk of underestimation.
[0118] When the coefficient of variation is negative and considered abnormally low, the sudden drop in the measured concentration may be a dangerous false alarm under unknown conditions. It could be caused by non-representative events such as sensor malfunction or localized abnormal dilution at the sampling point, while the actual risk of water pollution remains unresolved. If this falsely low data is input into the model, the model may give an excessively low prediction, even below the detection limit. If the pollution event is still developing at this time, it will result in extremely dangerous underreporting. Therefore, multiplying by a relatively mild but still greater than 1 coefficient (SL=1.15) pulls the predicted value back from an abnormally low level to a more conservative one.
[0119] When the coefficient of variation is negative and within the normal range, the concentration drop is a normal fluctuation in the base current, the steady-state assumption is basically valid, the model has high credibility, and no safety bias correction is required.
[0120] Please see Figure 4 The present invention also provides a water quality monitoring system based on a water quality prediction model library. This system is used to implement the aforementioned water quality monitoring method based on a water quality prediction model library, and includes: The state fingerprint extraction module is used to acquire the physicochemical index measurement values of the target water body within a preset sampling window, and extract multidimensional state fingerprint features to characterize the current state of the target water body; the multidimensional state fingerprint features include a dynamic pulse fingerprint constructed from the time-series change statistics of multiple physicochemical index measurement values, and an ion ratio fingerprint reflecting the change of water chemical type. The state membership discrimination module is used to perform similarity matching between the multidimensional state fingerprint features and multiple benchmark state patterns in a pre-built state pattern library to determine the membership degree of the current state of the target water body to the benchmark state patterns. The model adaptive activation module is used to match and activate the corresponding target prediction sub-model from the pre-built water quality prediction model library based on the membership degree; wherein, the water quality prediction model library includes multiple prediction sub-models, and each prediction sub-model is bound to a baseline state pattern in the state pattern library respectively. The water quality prediction execution module is used to input the measured values of the physicochemical indicators of the target water body at the current and historical times into the activated target prediction sub-model to obtain the water quality prediction results of the target water body within a preset prediction period.
[0121] The above formulas are all dimensionless calculations. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters in the formulas are set by those skilled in the art according to the actual situation.
[0122] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented in software, the above embodiments can be implemented, in whole or in part, as a computer program product. Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution.
[0123] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0124] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A water quality monitoring method based on a water quality prediction model library, characterized in that, The specific steps include: Step 1: Obtain the physicochemical index measurement values of the target water body within the preset sampling window, and extract the multidimensional state fingerprint features used to characterize the current state of the target water body; the multidimensional state fingerprint features include a dynamic pulse fingerprint constructed from the time-series change statistics of multiple physicochemical index measurement values, and an ion ratio fingerprint reflecting the change of water chemical type. Step 2: Perform similarity matching between the multidimensional state fingerprint features and multiple benchmark state patterns in the pre-built state pattern library to determine the membership degree of the target water body's current state to the benchmark state patterns; Step 3: Based on the membership degree, match and activate the corresponding target prediction sub-model from the pre-built water quality prediction model library; wherein, the water quality prediction model library includes multiple prediction sub-models, and each prediction sub-model is bound to a baseline state pattern in the state pattern library; Step 4: Input the measured values of the physicochemical indicators of the target water body at the current and historical times into the activated target prediction sub-model to obtain the water quality prediction results of the target water body within the preset prediction period.
2. The water quality monitoring method based on a water quality prediction model library according to claim 1, characterized in that, The measured values of the physicochemical indicators include physical indicators and chemical indicators. The physical indicators include water temperature, pH, conductivity, dissolved oxygen, turbidity, redox potential and ultraviolet-visible absorption spectrum. The chemical indicators include the concentrations of sodium ions, calcium ions, magnesium ions, chloride ions and bicarbonate ions.
3. The water quality monitoring method based on a water quality prediction model library according to claim 2, characterized in that, The method for constructing the dynamic pulse fingerprint is as follows: The preset sampling window contains multiple sampling points, each corresponding to a sampling time. The time interval between adjacent sampling times is recorded as the preset time interval. Conductivity and turbidity are selected as sensitive indicator parameters. The standard deviation of the fluctuation of the sensitive indicator parameters within the preset sampling window, the difference between the beginning and end of the window, and the proportion of outliers exceeding the preset stable range are calculated. The difference between the beginning and end of the window is the difference between the measured values of the sensitive indicator parameters at the end time and the beginning time of the preset sampling window. The standard deviation of fluctuation, the difference between the beginning and end of the window, and the proportion of outliers are used to construct a three-dimensional feature vector as a dynamic pulse fingerprint. The method for constructing the ion ratio fingerprint is as follows: based on the measured values of chemical indicators in the target water body, calculate the ratio of sodium ions to the sum of calcium and magnesium ions, and the ratio of chloride ions to bicarbonate ions; construct a two-dimensional feature vector from the above two ratios as the ion ratio fingerprint. The multidimensional state fingerprint feature is a feature vector composed of dynamic pulse fingerprint and ion ratio fingerprint.
4. The water quality monitoring method based on a water quality prediction model library according to claim 3, characterized in that, Historical water quality monitoring data of the target water body's basin over multiple complete hydrological years are collected. The historical water quality monitoring data is sliced according to a preset time window, and multidimensional state fingerprint features are extracted for each slice. The sampling time interval of each sampling point in the historical water quality monitoring data is consistent with the preset time interval. Based on the feature vector set composed of multidimensional state fingerprint features of all slice data, unsupervised clustering analysis is performed. The clustering analysis adopts a two-stage strategy: the first stage uses ion ratio fingerprint as the main feature for clustering to distinguish different water chemical background types; the second stage uses dynamic pulse fingerprint as the main feature for secondary clustering within each background type divided in the first stage to distinguish different levels of hydrological disturbance intensity. The water quality state space is divided into several baseline state modes, and the cluster center vector of each baseline state mode is calculated. The cluster center vectors are stored in a one-to-one correspondence with the baseline state modes to form the state mode library. The baseline state modes include reduced state, high turbidity state, high salinity state, and steady state. The reduced state represents the water body freezing due to low temperature and hypoxia in winter, the high turbidity state represents the water body pulse input by snowmelt runoff in spring, the high salinity state represents the water body high salinity state caused by evaporation and concentration in summer, and the steady state represents the groundwater base flow during undisturbed periods. The multidimensional state fingerprint features extracted in step 1 are compared one by one with the cluster center vectors of each benchmark state pattern in the state pattern library to calculate the distance. The benchmark state pattern with the smallest distance is taken as the matching pattern. The membership degree of the target water body to the matching pattern is calculated based on the distance. The membership degree is negatively correlated with the distance. If the distance exceeds the preset state judgment distance threshold, the membership degree is set to zero and the target water body is determined to be in an unknown state.
5. A water quality monitoring method based on a water quality prediction model library according to claim 4, characterized in that, The specific methods for constructing the water quality prediction model library include: According to the baseline state patterns defined in the state pattern library, historical water quality monitoring data are categorized into the corresponding patterns to form a dedicated training dataset for each baseline state pattern. The input feature of each training data is a time series composed of physicochemical index measurements at multiple consecutive times, and the output label is the target pollutant concentration value within a preset future prediction period. The target pollutant includes at least one of fluoride, arsenic, or chloride, and the target pollutant concentration value is obtained through laboratory analysis. For each baseline state mode, a pre-defined feature weight vector is preset; the preset feature weight vector is a vector with the same length as the input feature dimension, wherein the value of each element is determined according to the sensitivity of the measured values of each physicochemical index to the change in the concentration of the target pollutant under the baseline state; Using the preset feature weight vector bound to each baseline state mode, perform element-wise multiplication on the feature vector of each input feature in the dedicated training dataset of the baseline state mode at each time step to generate a weighted training dataset. For each baseline state pattern, a prediction sub-model is independently trained using its weighted training dataset. Each prediction sub-model adopts a time series prediction model suitable for the data characteristics of that pattern. Specifically, if the baseline state is a reduced state, a statistical regression model is selected; if the baseline state is a highly turbid state, a gradient boosting tree model is selected; if the baseline state is a highly saline state, a long short-term memory network model is selected; and if the baseline state is a steady state, an autoregressive model is selected.
6. A water quality monitoring method based on a water quality prediction model library according to claim 5, characterized in that, The preset feature weight vector is determined as follows: When the selected state mode is the reduced state, the weight values of water temperature, dissolved oxygen and redox potential in the preset feature weight vector are higher than the weight values of other feature values. When the selected state mode is high turbidity, the weight values of turbidity, conductivity and ultraviolet-visible absorption spectrum in the preset feature weight vector are higher than the weight values of other features. When the selected state mode is high salt state, the weight values of the corresponding conductivity, sodium ion concentration, calcium ion concentration, magnesium ion concentration, chloride ion concentration and bicarbonate ion concentration in the preset feature weight vector are higher than the weight values of other features. When the selected state mode is steady state, the weight values of each element in the preset feature weight vector are equal.
7. A water quality monitoring method based on a water quality prediction model library according to claim 5, characterized in that, The specific logic for matching and activating the corresponding target prediction sub-model is as follows: Obtain the membership degree of the target water body to the matching pattern, and select the baseline state pattern with the highest membership degree and a distance not exceeding the preset state judgment distance threshold as the selected state pattern. Retrieve the prediction sub-model bound to the selected state mode as the target prediction sub-model and activate it; If the target water body is determined to be in an unknown state, that is, the distances corresponding to all baseline state modes exceed the preset state determination distance threshold, then no sub-models in the water quality prediction model library that are bound to the baseline state modes will be activated. Instead, the preset general conservative prediction strategy will be triggered, and alarm information will be generated to mark the unknown state.
8. A water quality monitoring method based on a water quality prediction model library according to claim 7, characterized in that, The preset general conservative prediction strategy is specifically as follows: Retrieve a pre-specified default prediction sub-model, which is a prediction sub-model corresponding to the steady state in the water quality prediction model library; The physicochemical index values of the target water body at multiple consecutive time points are input into the default prediction sub-model to obtain the initial prediction values; Simultaneously, the measured concentration value of the target pollutant in the target water body at the current moment is obtained, and the relative deviation between the measured concentration value of the target pollutant and the average value of the target pollutant concentration value in a preset backtracking period before the current moment is calculated. The relative deviation is characterized by the coefficient of variation. If the deviation coefficient is positive, the initial predicted value is multiplied by the preset upper limit of the safety factor to obtain the final prediction result; if the deviation coefficient is negative, the absolute value of the deviation coefficient is further compared with the preset abnormally low threshold: if the absolute value of the deviation coefficient is greater than the abnormally low threshold, the initial predicted value is multiplied by the preset lower limit of the safety factor to obtain the final prediction result; otherwise, the initial predicted value is used as the final prediction result. The upper and lower limits of the preset safety factor are both greater than 1.
9. A water quality monitoring method based on a water quality prediction model library according to claim 8, characterized in that, The input data for the target prediction sub-model is a time series consisting of measured values of physicochemical indicators at multiple consecutive times, and the feature dimension of the input data is consistent with the input feature dimension used when training the target prediction sub-model. When the target prediction sub-model is activated, the same preset feature weight vector used during model training is retrieved according to the selected state mode. The preset feature weight vector is applied to the feature vector at each time step in the input data sequence by element-wise multiplication to obtain a weighted input time series. The target prediction sub-model outputs the target pollutant concentration value within a preset prediction period based on the weighted input time series.
10. A water quality monitoring system based on a water quality prediction model library, characterized in that, The water quality monitoring system based on a water quality prediction model library is used to implement the water quality monitoring method based on a water quality prediction model library as described in any one of claims 1-9, including: The state fingerprint extraction module is used to acquire the physicochemical index measurement values of the target water body within a preset sampling window, and extract multidimensional state fingerprint features to characterize the current state of the target water body; the multidimensional state fingerprint features include a dynamic pulse fingerprint constructed from the time-series change statistics of multiple physicochemical index measurement values, and an ion ratio fingerprint reflecting the change of water chemical type. The state membership discrimination module is used to perform similarity matching between the multidimensional state fingerprint features and multiple benchmark state patterns in a pre-built state pattern library to determine the membership degree of the current state of the target water body to the benchmark state patterns. The model adaptive activation module is used to match and activate the corresponding target prediction sub-model from the pre-built water quality prediction model library based on the membership degree; wherein, the water quality prediction model library includes multiple prediction sub-models, and each prediction sub-model is bound to a baseline state pattern in the state pattern library respectively. The water quality prediction execution module is used to input the measured values of the physicochemical indicators of the target water body at the current and historical times into the activated target prediction sub-model to obtain the water quality prediction results of the target water body within a preset prediction period.