A method, system, device and medium for online identification of water quality category changes based on inflection points
Through an inflection point-based online identification method for water quality category changes, spectral deconstruction and hidden Markov model are used to identify surface water quality category changes, which solves the problem of inaccurate identification of water quality category changes in existing technologies and achieves high-accuracy and stable water quality change monitoring.
Patent Information
- Application Number
- CN202510504043.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2024-11-06
- Filing Date
- 2025-04-22
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-04-22
AI Technical Summary
Existing technologies are unable to accurately identify changes in surface water quality categories, especially in complex environmental systems, which are easily affected by fluctuations in water quality concentration and changes within the system, leading to missed detections and underreporting.
An inflection point-based online identification method for water quality category changes is adopted. Through spectral deconstruction, the STL model of Loess kernel regression, the hidden Markov model and semantic water quality alarm information, the inflection points of water quality category changes are identified, a binary state hidden Markov model is constructed, the superior-inferior bipolar latent structure is set, the hidden state transition trajectory is inferred and the mutation point is anchored.
It significantly improves the accuracy and stability of water quality category transition identification, can accurately identify the time and status of water quality changes, and output semantic alarm information in a linked manner, enhancing dynamic modeling capabilities and decision-making reference value.
Smart Images

Figure CN120493051B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of surface water quality monitoring, and in particular to a water quality category change online identification method and system based on an inflection point, an equipment and a medium. BACKGROUND
[0002] Surface water quality category change identification is an important direction of environmental monitoring and management, and its core goal is to evaluate water quality change trends and classify them in real time and accurately to support pollution prevention and ecological protection decisions. However, due to the fact that the information implied in the monitoring data cannot be fully mined and mastered, the existing technology cannot accurately identify and dynamically manage the water quality category in a complex environmental system. For example, traditional data governance relies on abnormal water quality characteristics, but these abnormalities may be caused by internal changes in the system, such as water quality sensor failure, fluctuation in water demand or change in water source, rather than external pollution, resulting in insufficient governance results. In addition, water quality data features are complex and fluctuate greatly, which may cause missed detection and false reporting.
[0003] In order to solve the problem of low visibility of complex environmental water quality category, the existing technology mainly uses time series forecasting algorithms (such as support vector machines combined with chaos theory) to analyze water quality concentration changes, but this method is easily disturbed by random fluctuations in water quality concentration; there are also classification methods to detect changes in water quality data, but this method may misidentify similar changes as fundamental changes.
[0004] Therefore, it is urgent to solve the above problems. SUMMARY
[0005] The first object of the present application is to provide an online identification method for water quality category change based on an inflection point, which can identify the inflection point of surface water quality category change in real time and accurately.
[0006] The second object of the present application is to provide an online identification system for water quality category change based on an inflection point.
[0007] The third object of the present application is to provide an electronic device.
[0008] The fourth object of the present application is to provide a computer readable storage medium.
[0009] TECHNICAL SCHEME: In order to achieve the above objects, the present application discloses an online identification method for water quality category change based on an inflection point, comprising the following steps:
[0010] S1: Selecting a surface water quality historical monitoring sequence covering no less than one year to perform spectral deconstruction, extracting dominant periodic features, and determining a dynamic analysis window;
[0011] S2: Obtaining a water quality continuous monitoring time series x t, the STL model based on Loess kernel regression is used to process the water quality monitoring time series x t , the multi-scale structure is separated, the water quality change trend feature is extracted, and a change trend time series T t is obtained.
[0012] S3: interval mapping is performed on the change trend time series T t to obtain a discrete water quality category time series D t , and the water quality category is divided into six categories: class I, class II, class III, class IV, class V, and poor class V.
[0013] S4: a binary state hidden Markov model is constructed based on the discrete water quality category time series D t , a "good state-poor state" bipolar potential structure is set, the "good state-poor state" bipolar potential structure refers to good water quality and poor water quality, the good water quality represents water quality essence from class I to class III, and the poor water quality represents water quality essence from class IV to poor class V, and the hidden state transition trajectory is inferred through a probability propagation mechanism.
[0014] S5: the mutation point is anchored in the hidden state transition trajectory, that is, the mutation time when the water quality state changes from good state to poor state or from poor state to good state, and the dominant water quality category state before and after the mutation point is extracted based on the water quality category data in the time window before and after the mutation.
[0015] S6: according to the dominant water quality category state before and after the mutation point, it is determined whether the mutation point is an inflection point of radical change of water quality grade, and a semantic type water quality alarm information marking is triggered based on the determination result, and the alarm information includes the inflection point occurrence time, the dominant water quality category state before and after the mutation point, the determination result, and the state label type.
[0016] Optionally, the step S4 specifically includes the following steps:
[0017] S4.1: the definition form of the binary state hidden Markov model is as follows:
[0018] Model=(π,A,B)
[0019] Wherein π is an initial state probability vector, A is a state transition probability matrix, and B is an emission probability matrix; in the hidden Markov model, the observation set is an observation space O, and the observation space O is composed of a discrete water quality category time series D t ,
[0020] D t ∈{Ⅰclass,Ⅱclass,Ⅲclass,Ⅳclass,Ⅴclass,poorⅤclass}; in the binary state hidden Markov model, the hidden state set is a hidden state space Q, and the hidden state space Q is composed of two types of hidden states, a hidden state q good and a hidden state q bad .good The representative optimal water quality represents the substantial category of water quality as: I, II, III, i.e. better water quality category; the hidden state q bad Corresponding to the poor water quality, the poor water quality represents the substantial category of water quality as: IV, V, V, i.e. poor water quality category;
[0021] The initial state probability vector π represents the probability of water quality in each hidden state at the initial time, defined as follows:
[0022] π=(π good ,π bad )
[0023] Where: π good represents the probability of water quality as optimal water quality; π bad represents the probability of water quality as poor water quality;
[0024] State transition probability matrix A is used to describe the change rule between hidden states, defined as follows:
[0025]
[0026] Where, a 11 =P(q good →q good ), the probability of maintaining optimal water quality; a 12 =P(q good →q bad ), the probability of optimal water quality changing to poor water quality; a 21 =P(q bad →q good ), the probability of poor water quality improving to optimal water quality; a 22 =P(q bad →q bad ), the probability of maintaining poor water quality;
[0027] Emission probability matrix B describes the probability of hidden state generating observation water quality category, defined as follows:
[0028]
[0029] Where: b 11 =P(observe better category|q good ), the probability of observing better water quality category under optimal water quality hidden state; b 12 =P(observe poor category|q good ), the probability of observing poor water quality category under optimal water quality hidden state;
[0030] b 21 =P(observe better category|q bad), the probability of observing a better water quality class under the poor water quality hidden state;
[0031] b 22 = P(observe a better class | q bad ), the probability of observing a worse water quality class under the poor water quality hidden state;
[0032] S4.2: Calculate the initial state probability vector according to the water quality class data within 24 hours, sample every certain period of time, obtain m water quality monitoring data within a day, if the number of observations belonging to good water quality, i.e. water quality class I to III, is m1 times, and the number of observations belonging to poor water quality, i.e. water quality class IV to poor V, is m2 times, then the initial state probability vector is
[0033] S4.3: Map the water quality class time series D t According to the preset hidden state definition rule, the water quality class time series is one-to-one mapped to the explicit hidden state sequence, the state transition during continuous observation is counted in the explicit hidden state sequence, the state transition probability is calculated according to the counting result, and the state transition probability matrix A is obtained.
[0034] Count the state transition during continuous observation in the explicit hidden state sequence, and count the number of the following events respectively: N good→good : the number of times that the hidden state remains good from good; N good→bad : the number of times that the hidden state changes from good to poor; N bad→good : the number of times that the hidden state changes from poor to good; N bad→bad : the number of times that the hidden state remains poor from poor;
[0035] According to the counting result, the state transition probability is calculated, and the specific calculation formula is as follows:
[0036]
[0037] Thus, the state transition probability matrix A is determined:
[0038]
[0039] S4.4: Input the initial state probability vector π obtained in step S4.2, the state transition probability matrix A obtained in step S4.3, and the initial uniform assignment of the emission probability matrix B into the binary state hidden Markov model, and perform hidden state inference on the water quality class time series D t , and output the initial hidden state time series wherein Based on the initial hidden state sequence and the water quality class time series D tThe joint statistics are calculated to obtain the emission probability matrix B, and the specific calculation formula is:
[0040] The number of times N good that the I-III category is observed when the hidden state is q good隐态观测好 and the number of times N good隐态观测差 that the IV-poor V category is observed when the hidden state is q bad ; The number of times N bad隐态观测好 that the I-III category is observed when the hidden state is q bad隐态观测差 and the number of times N bad隐态观测差 that the IV-poor V category is observed when the hidden state is q bad隐态观测差 ;
[0041] The elements of the emission probability matrix B are calculated as follows:
[0042]
[0043] Thus, the emission probability matrix B is determined:
[0044]
[0045] S4.5: input the initial state probability vector π obtained in step S4.2, the state transition probability matrix A obtained in step S4.3, and the emission probability matrix B obtained in step S4.4 into the binary state hidden Markov model, and input the water quality category time series D t Perform hidden state inference to output the corresponding hidden state time series Obtain the hidden state transition trajectory.
[0046] Optionally, the step S5 of determining the dominant water quality category state before and after the mutation point specifically comprises the following steps:
[0047] For each mutation point V k , trace back from the mutation point V k to the last mutation point or the recording starting point to extract the water quality category data Y new(k-1,k) monitored in the time window before the mutation point; continue from the mutation point V k to the recording ending point to extract the water quality category data Y new(k,k+1) monitored in the time window after the mutation point; and calculate the mode of the water quality category in the time window before and after the mutation point, i.e. the water quality category with the highest frequency of occurrence, and define it as the dominant water quality category state before and after the mutation point.
[0048] Optionally, the determination rule for determining whether the mutation point is an inflection point of the radical jump of the water quality level in step S6 is: if there is a radical jump in the dominant water quality category before and after the mutation point, i.e. from the I-III category to the IV-poor V category, or from the IV-poor V category to the I-III category, it is determined that the mutation point is an inflection point of the radical jump of the water quality level.
[0049] For the inflection point determined to occur the radical change of water quality level, the water quality category state T k and the specified reference moment T ref Perform category judgment to determine the state label type State label type Defined as follows:
[0050]
[0051] The specified reference moment refers to the representative water quality category state at the recording starting point, used to measure the change characteristics of the current inflection point relative to the initial state; after each round of inflection point identification calculation is completed, the representative water quality category of the current period is dynamically updated and cached at each monitoring moment, and a time sequence state memory pool is constructed; when a new inflection point is identified, the reference moment T ref .
[0052] Based on the same inventive concept, the application discloses an online identification system for water quality category change based on inflection points, comprising:
[0053] The period characteristic determination module is used for selecting a surface water quality historical monitoring sequence covering no less than one year to perform spectral deconstruction, extracting dominant period characteristics, and determining a dynamic analysis window;
[0054] The trend data generation module is used for obtaining a water quality continuous monitoring time sequence x t in the dynamic analysis window, performing multi-scale structure separation on the water quality monitoring time sequence x t based on a Loess kernel regression STL model, extracting water quality change trend characteristics, and obtaining a change trend time sequence T t ;
[0055] The water quality category data generation module is used for performing interval mapping on the change trend time sequence T t according to water quality category standard limit values, obtaining a discrete water quality category time sequence D t , and dividing the water quality category into six categories: class I, class II, class III, class IV, class V and poor class V;
[0056] The hidden state inference module is used for constructing a binary state hidden Markov model according to the discrete water quality category time sequence D t , setting a “good state-poor state” bipolar potential structure, and inferring a hidden state transition trajectory through a probability propagation mechanism, wherein the “good state-poor state” bipolar potential structure refers to good water quality and poor water quality, the good water quality represents water quality essence of class I to class III, and the poor water quality represents water quality essence of class IV to poor class V.
[0057] The mutation point recognition module is configured to anchor the mutation point in the hidden state transition trajectory, i.e., the mutation time point when the water quality state changes from a good state to a poor state or from a poor state to a good state, and extract the dominant water quality category state before and after the mutation point based on the water quality category data in the time window before and after the mutation.
[0058] The inflection point recognition and alarm module is configured to determine whether the mutation point is an inflection point at which a radical change in the water quality level occurs according to the dominant water quality category state before and after the mutation point, and trigger semantic water quality alarm information marking based on the determination result. The alarm information includes the inflection point occurrence time, the dominant water quality category state before and after the mutation point, the determination result, and the state label type.
[0059] Optionally, the definition form of the binary state hidden Markov model in the hidden state inference module is as follows:
[0060] Model=(π,A,B)
[0061] Wherein π is an initial state probability vector, A is a state transition probability matrix, and B is an emission probability matrix. In the hidden Markov model, the observation set is an observation space O, and the observation space O is composed of a discrete water quality category time sequence D t ,
[0062] D t ∈{Ⅰclass,Ⅱclass,Ⅲclass,Ⅳclass,Ⅴclass,poorⅤclass}; the hidden state set in the binary state hidden Markov model is a hidden state space Q, and the hidden state space Q is composed of two types of hidden states, i.e., a hidden state q good and a hidden state q bad , wherein the hidden state q good represents good water quality, and the good water quality represents the substantial category of water quality as: I, II, III class, i.e., a better water quality category; and the hidden state q bad corresponds to poor water quality, and the poor water quality represents the substantial category of water quality as: IV, V, poor V class, i.e., a poor water quality category.
[0063] The initial state probability vector π represents the probability of water quality in each hidden state at the initial time, and is defined as follows:
[0064] π=(π good ,π bad )
[0065] Wherein: π good represents the probability of water quality being good water quality; and π bad represents the probability of water quality being poor water quality.
[0066] The state transition probability matrix A is used to describe the change rule between the hidden states, and is defined as follows:
[0067]
[0068] wherein a 11 = P(q good → q good ), the probability of maintaining the good water quality; a 12 = P(q good → q bad ), the probability of the good water quality turning into the poor water quality; a 21 = P(q bad → q good ), the probability of the poor water quality improving into the good water quality; a 22 = P(q bad → q bad ), the probability of maintaining the poor water quality;
[0069] The emission probability matrix B describes the probability of the hidden state generating the observed water quality category, and is defined as follows:
[0070]
[0071] wherein b 11 = P(observe better category | q good ), the probability of observing the better water quality category under the good water quality hidden state; b 12 = P(observe worse category | q good ), the probability of observing the worse water quality category under the good water quality hidden state; b 21 = P(observe better category | q bad ), the probability of observing the better water quality category under the poor water quality hidden state; b 22 = P(observe worse category | q bad ), the probability of observing the worse water quality category under the poor water quality hidden state;
[0072] The initial state probability vector is calculated according to the water quality category data within 24 hours, and is sampled at intervals to obtain m water quality monitoring data within a day. If the number of observations belonging to the good water quality, i.e. the water quality category is class I to class III, is m1 times, and the number of observations belonging to the poor water quality, i.e. the water quality category is class IV to class V, is m2 times, then the initial state probability vector is
[0073] The water quality category time series D t According to the preset hidden state definition rule, the water quality category time series is one-to-one mapped into the explicit hidden state sequence, the state transition during continuous observation is counted in the explicit hidden state sequence, the state transition probability is calculated according to the counting result, and the state transition probability matrix A is obtained.
[0074] The state transition during continuous observation is counted in the explicit hidden state sequence, and the number of occurrences of the following events is counted respectively: N good→good: the number of times that the hidden state remains in the superior state from the superior state; N good→bad : the number of times that the hidden state changes from the superior state to the inferior state; N bad→good : the number of times that the hidden state changes from the inferior state to the superior state; N bad→bad : the number of times that the hidden state remains in the inferior state from the inferior state;
[0075] According to the statistical results, the state transition probability is calculated, and the specific calculation formula is as follows:
[0076]
[0077] Thus, the state transition probability matrix A is determined:
[0078]
[0079] The initial state probability vector π, the state transition probability matrix A, and the initial uniform assignment of the emission probability matrix B are input into the binary state hidden Markov model, and the water quality category time sequence D t is inferred, and the initial hidden state time sequence is output. Based on the initial hidden state sequence and the water quality category time sequence D t , joint statistics are performed, and the emission probability matrix B is calculated, and the specific calculation formula is as follows:
[0080] When the hidden state is q good , the number of times N good隐态观测好 that the I-III category is observed and the number of times N good隐态观测差 that the IV-inferior V category is observed are counted. bad When the hidden state is q bad隐态观测好 , the number of times N bad隐态观测差 that the I-III category is observed and the number of times N t that the IV-inferior V category is observed are counted.
[0081] The calculation formula of each element of the emission probability matrix B is as follows:
[0082]
[0083] Thus, the emission probability matrix B is determined:
[0084]
[0085] The initial state probability vector π, the state transition probability matrix A, and the calculated emission probability matrix B are input into the binary state hidden Markov model, and the water quality category time sequence D t is inferred, and the corresponding hidden state time sequence is output.
[0086] Optionally, the dominant water quality category state before and after the mutation point in the mutation point identification module is specifically:
[0087] For each mutation point V k , the water quality category data Y k monitored in the time window before the mutation point is extracted by tracing back to the last mutation point or the recording starting point. new(k-1,k) , the water quality category data Y k monitored in the time window after the mutation point is extracted by continuing to the recording ending point. new(k,k+1) The mode of the water quality category in the time window before and after the mutation point is calculated respectively, that is, the water quality category with the highest frequency of occurrence, which is defined as the dominant water quality category state before and after the mutation point.
[0088] Optionally, the determination rule for determining whether the mutation point is a turning point of radical change of water quality level in the turning point identification and alarm module is: if there is a radical change of the dominant water quality category before and after the mutation point, that is, the water quality level changes from I-III to IV-poor V, or from IV-poor V to I-III, it is determined that the mutation point is a turning point of radical change of water quality level.
[0089] For the turning point determined to be a turning point of radical change of water quality level, the water quality category state T k after the turning point and the specified reference time T ref are classified to determine the state label type The state label type is defined as follows:
[0090]
[0091] The specified reference time refers to the representative water quality category state at the recording starting point, which is used to measure the change characteristics of the current turning point relative to the initial state; after each round of turning point identification and calculation is completed, the representative water quality category of the current period is dynamically updated and cached continuously at each monitoring time, and a time sequence state memory pool is constructed; when a new turning point is identified, the reference time T ref associated with the new turning point is extracted from the time sequence state memory pool.
[0092] Based on the same inventive concept, the application discloses an electronic device, which comprises one or more processors, one or more memories, and one or more programs stored in the memories and configured for execution by the processors, and when the programs are loaded into the processors, the steps of the online identification method of water quality category change based on turning points are implemented.
[0093] Based on the same inventive concept, the application discloses a computer readable storage medium, which stores a computer program, the computer program comprises program instructions, and the program instructions enable a processor to execute the steps of the inflection point-based online identification method for water quality category change when the processor executes the program instructions.
[0094] Advantages: Compared with the prior art, the application has the following remarkable advantages:
[0095] (1) The application can effectively distinguish random fluctuations from fundamental changes in water quality categories, significantly suppress the influence of noise interference such as short-time disturbance and accidental anomalies on water quality change state identification, and significantly improve the accuracy, stability and interpretability of water quality category transition identification.
[0096] (2) The application accurately identifies water quality category inflection points through structural mutation anchoring mechanism, not only can locate the occurrence time and state of water quality change, but also can output semantic alarm information, realize the time sequence closed loop response from trend monitoring to event alarm.
[0097] (3) The hidden Markov modeling scheme proposed by the application identifies water quality hidden state changes based on the superior state- inferior state double hidden state structure, and forms the observation-hidden state double mapping structure through the data-driven adaptive estimation of the initial probability, state transition matrix and emission matrix, which significantly enhances the dynamic modeling ability of water quality category trend.
[0098] (4) Based on the trend-guided state discretization and hidden state analysis results, the application constructs a water quality hidden state time sequence with higher stationarity and stronger continuity, which makes the inflection point identification more physically meaningful and time sequence consistent, and significantly improves the identification accuracy and decision reference value of fundamental water quality jump events.
[0099] (5) The application does not rely on large-scale deep learning framework, adopts a lightweight time sequence modeling scheme with clear structure and strong interpretability, has engineering deployability and model generalization ability, and is suitable for multi-region, multi-index surface water quality online analysis and dynamic response scene. BRIEF DESCRIPTION OF DRAWINGS
[0100] Figure 1 is a flowchart of the application;
[0101] Figure 2 is a system framework diagram of the application;
[0102] Figure 3 is a result diagram of the original monitoring time sequence decomposed by the STL algorithm based on time series decomposition of the application;
[0103] Figure 4 is an inflection point-based water quality category change identification result diagram of the application. DETAILED DESCRIPTION
[0104] In order to make the objectives, technical solutions and advantages of the present application clearer, further detailed description will be made to the present application in combination with the drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not used to limit the present application.
[0105] Embodiment 1: As shown in the present application discloses a kind of online identification method of water quality category change based on inflection point, comprising the following steps: Figure 1
[0106] S1: selecting at least one year of surface water quality historical monitoring data for frequency spectrum decomposition, obtaining dominant period characteristics, determining dynamic analysis window according to the dominant period characteristics, i.e. determining the continuous monitoring time length of inflection point identification; the continuous monitoring time length of inflection point identification refers to the monitoring time length capable of covering at least one complete dominant period characteristic, to ensure the representativeness and accuracy of data analysis, and to provide reliable data support for subsequent inflection point identification.
[0107] First, collect at least one year of historical monitoring data of water quality indicators of the required surface water quality monitoring site, form the original water quality monitoring time series; water quality indicators include ammonia nitrogen concentration, total nitrogen concentration, total phosphorus concentration or chemical oxygen demand concentration.
[0108] The original water quality monitoring time series is subjected to frequency spectrum decomposition by using fast Fourier transform (FFT), and the dominant period characteristics are determined. The period characteristics refer to the phenomenon that the monitoring data presents regular repeated changes in the time dimension, which is usually formed by natural environment (such as seasonal change and rainfall period), human activity (such as pollution discharge rule), hydrological process and other factors; by fast Fourier transform, the frequency significant peak value can be identified, so as to judge whether there is a significant daily cycle (24 hours), weekly cycle (7 days), monthly cycle (30 days) or other cycle of the water quality indicator; the energy spectrum is obtained by calculating the amplitude square of the complex coefficient corresponding to the frequency, and is normalized to energy proportion, so as to quantify the contribution degree of each cycle component to the overall water quality change; the dominant period characteristics are determined according to the energy contribution proportion.
[0109] According to the dominant period characteristics, the continuous monitoring time length of inflection point identification is determined; the continuous monitoring time length of inflection point identification refers to the monitoring time length capable of covering at least one complete dominant period characteristic, to fully reflect the change trend and fluctuation mode of water quality indicators, and to avoid insufficient trend information due to too short time period, or too much historical interference information due to too long time period.
[0110] In the present application, considering that most of the surface water quality indicators have obvious monthly periodic characteristics affected by monthly rainfall, water temperature changes and the like, a continuous monitoring period covering 60 days is selected, covering 2 dominant periodic characteristics, which can ensure sufficient data quantity and effectively support subsequent trend extraction and inflection point identification analysis, and ensure the representativeness and accuracy of the identification results.
[0111] S2: as Figure 3 shown, obtaining the water quality monitoring time sequence x t under the continuous monitoring duration in the dynamic analysis window, using a time sequence decomposition STL algorithm to separate the water quality monitoring time sequence x t from multiple scales, extracting water quality change trend characteristics, and generating a change trend time sequence T t ={T1,T2,…T n}, wherein the period parameter in the time sequence decomposition algorithm is the dominant period characteristic in step (1).
[0112] The STL (Seasonal-Trend decomposition based on Loess) algorithm is used to decompose and process the water quality monitoring time sequence, and based on the optimized local polynomial regression (LOESS) fitting model, three main components of long-term trend, periodic change and random disturbance are separated; the mathematical representation of STL decomposition is:
[0113] x t =T t +S t +R t
[0114] Wherein, x t represents the original water quality monitoring time sequence; T t represents the trend part, reflecting the long-term change trend of the data; S t represents the seasonal part, showing the periodic change of the data; R t represents the residual part, representing random noise that is not explained by the trend and seasonality. Through STL decomposition, the water quality change influencing mechanism of different sources can be quantified and separated, providing high-quality trend data support for subsequent inflection point detection.
[0115] The trend part in the STL decomposition result is extracted, and a trend time sequence is generated. The trend time sequence eliminates the interference of seasonality and random fluctuations on the data, and can better reflect the real change of water quality. The trend item T t obtained by decomposition can obtain the trend time sequence of water quality change, reflecting the trend change of water quality, and the calculation formula is:
[0116] T t =x t -St -R t
[0117] The original water quality monitoring time sequence of the application has the typical characteristics of online, time-varying and high disturbance, the data is collected in real time by automatic equipment, the frequency is high and the continuity is strong; the value is dynamically changed with time and presents a non-stationary trend under the influence of natural and human factors; at the same time, a large number of high-frequency fluctuations and abnormal disturbances are accompanied, which cover the real change signal and increase the identification difficulty. Therefore, the dynamic analysis window is determined according to the dominant cycle characteristics, the monitoring data is obtained in the dynamic analysis window, and then the trend component is obtained through STL decomposition, so that the trend time sequence T t which eliminates the disturbance of water quality normal fluctuation to water quality basic state identification from the root.
[0118] S3: interval mapping is performed on the change trend time sequence T t , that is, water quality classification is performed to obtain discrete water quality category time sequence D t ; the water quality category is divided into six categories: class I, class II, class III, class IV, class V and poor V class, and each water quality category corresponds to a specific water quality index concentration range, that is, a water quality category limit interval composed of water quality category standard limit values.
[0119] According to the "Surface Water Environmental Quality Standard" (GB3838-2002) issued by the State Environmental Protection Administration, the key water quality indexes and the corresponding water quality category limit intervals are determined; the water quality category is divided into six categories: class I, class II, class III, class IV, class V and poor V class, and each water quality category corresponds to a specific water quality index concentration range, that is, a water quality category limit interval composed of water quality category standard limit values.
[0120] For the change trend time sequence T t ={T1,T2,…T n}, the water quality classification judgment is performed on the trend value T t of each time step one by one, the current trend value T t is compared with the water quality category standard limit value, and the trend value T t is mapped to the corresponding water quality category label according to the water quality index concentration range to which it belongs, and the mathematical expression is:
[0121] D t =f(T t )
[0122] Wherein, f() is a classification function constructed based on water quality category standard limit value, and the corresponding water quality category number is output; the continuous trend time sequence T t is converted into discrete water quality category time sequence D t ={D1,D2,…Dn}。
[0123] S4: constructing a binary state Hidden Markov Model (HMM) based on the discrete water quality category time series D t , setting a "good state- poor state" bipolar potential structure, the "good state- poor state" bipolar potential structure refers to good water quality and poor water quality, the good water quality represents that the water quality is essentially I to III, and the poor water quality represents that the water quality is essentially IV to poor V, and the corresponding water quality hidden state time series is inferred through a probability propagation mechanism to obtain a hidden state transition trajectory.
[0124] S4.1: constructing a binary state Hidden Markov Model, the definition form of the binary state Hidden Markov Model is as follows:
[0125] Model = (π, A, B)
[0126] wherein π is an initial state probability vector, A is a state transition probability matrix, and B is an emission probability matrix;
[0127] In the Hidden Markov Model, the observation set is an observation space O, the observation space O is composed of the discrete water quality category time series D t , D t ∈ {I, II, III, IV, V, poor V}; in the Hidden Markov Model, the hidden state set is a hidden state space Q, the hidden state space Q is composed of two types of hidden states, a hidden state q good and a hidden state q bad , wherein the hidden state q good represents good water quality, the good water quality represents that the water quality is essentially I, II, and III, i.e., a better water quality category; the hidden state q bad corresponds to poor water quality, the poor water quality represents that the water quality is essentially IV, V, and poor V, i.e., a poor water quality category;
[0128] The initial state probability vector π represents the probability of the water quality being in each hidden state at the initial time, and is defined as follows:
[0129] π = (π good , π bad )
[0130] wherein π good represents the probability of the water quality being good water quality; and π bad represents the probability of the water quality being poor water quality;
[0131] The state transition probability matrix A is used to describe the change rule between the hidden states, and is defined as follows:
[0132]
[0133] wherein a 11 = P(q good → q good ), probability of keeping good water quality; a 12 = P(q good → q bad ), probability of good water quality turning into poor water quality; a 21 = P(q bad → q good ), probability of poor water quality improving into good water quality; a 22 = P(q bad → q bad ), probability of keeping poor water quality.
[0134] The emission probability matrix B describes the probability of hidden state generating observation water quality category, defined as follows:
[0135]
[0136] wherein b 11 = P(observe better category | q good ), probability of observing better water quality category under good water quality hidden state; b 12 = P(observe worse category | q good ), probability of observing worse water quality category under good water quality hidden state;
[0137] b 21 = P(observe better category | q bad ), probability of observing better water quality category under poor water quality hidden state;
[0138] b 22 = P(observe worse category | q bad ), probability of observing worse water quality category under poor water quality hidden state;
[0139] S4.2: Calculate initial state probability vector according to water quality category data within 24 hours, sample every certain time interval, obtain m water quality monitoring data within a day, if the number of observations belonging to good water quality, i.e. water quality category I to III is m1 times, and the number of observations belonging to poor water quality, i.e. water quality category IV to V is m2 times, then the initial state probability vector is
[0140] Taking sampling every 4 hours as an example, a total of 6 monitoring time series are obtained in the previous day, if the number of observations belonging to good water quality, i.e. water quality category I to III is 4 times, and the number of observations belonging to poor water quality, i.e. water quality category IV to V is 2 times, then the initial state probability vector is determined as π = (4 / 6, 2 / 6).
[0141] S4.3: mapping the water quality category time series D t According to the preset hidden state definition rule, the water quality category time series is one-to-one mapped to the explicit hidden state sequence, the state transition during the continuous observation period in the explicit hidden state sequence is counted, the state transition probability is calculated according to the counting result, and the state transition probability matrix A is obtained;
[0142] Specifically, the following steps are included:
[0143] The water quality category time series D t According to the preset hidden state definition rule, i.e., the water quality of class I to class III is classified as an optimal state, and the water quality of class IV to class V is classified as a poor state, the water quality category time series is mapped to the explicit hidden state sequence; the state transition during the continuous observation period in the explicit hidden state sequence is counted, and the number of occurrences of the following events is counted respectively: N good→good : the number of times that the hidden state remains in the optimal state; N good→bad : the number of times that the hidden state changes from the optimal state to the poor state; N bad→good : the number of times that the hidden state changes from the poor state to the optimal state; N bad→bad : the number of times that the hidden state remains in the poor state;
[0144] According to the counting result, the state transition probability is calculated, and the specific calculation formula is as follows:
[0145]
[0146] Thus, the state transition probability matrix A is determined:
[0147]
[0148] S4.4: inputting the initial state probability vector π obtained in step S4.2, the state transition probability matrix A obtained in step S4.3, and the initial uniform assignment of the emission probability matrix B into the binary state hidden Markov model, performing hidden state inference on the water quality category time series D t , and outputting the initial hidden state time series , wherein Based on the initial hidden state sequence , the water quality category time series D t is jointly counted, and the emission probability matrix B is calculated;
[0149] Specifically, the following steps are included:
[0150] The emission probability matrix B is initially uniformly assigned as: Based on the binary state hidden Markov model, the Viterbi algorithm is used to perform hidden state inference on the water quality category time series D tPerform hidden state inference to infer the most likely hidden state path, that is, recursively calculate the optimal hidden state path for each time step t and output the initial hidden state time sequence in Based on the initial hidden state sequence and water quality category time series D t Perform joint statistics and calculate the emission probability matrix B. The specific calculation formula is:
[0151] The statistical hidden state is q good When N is the number of times I-III categories are observed good隐态观测好 and the number of times N the IV-inferior V category is observed good隐态观测差 ;
[0152] The statistical hidden state is q bad When N is the number of times I-III categories are observed bad隐态观测好 and the number of times N the IV-inferior V category is observed bad隐态观测差 ;
[0153] The calculation formula for each element of the emission probability matrix B is as follows:
[0154]
[0155] S4.5: Input the initial state probability vector π obtained in step S4.2, the state transition probability matrix A obtained in step S4.3, and the emission probability matrix B obtained in step S4.4 into the binary state hidden Markov model to calculate the water quality category time series D. t Perform hidden state inference and output the corresponding hidden state time series Obtain hidden state transition trajectory;
[0156] The binary state hidden Markov model uses the Viterbi algorithm to infer the hidden state, and uses dynamic programming to recursively find the hidden state path with the maximum probability and output the hidden state time series.
[0157] S5: Anchor the mutation point in the hidden state transition trajectory, that is, the mutation moment when the water quality state changes from the optimal state to the inferior state or from the inferior state to the optimal state. Based on the water quality category data in the time window before and after the mutation, extract the dominant water quality category state before and after the mutation point; that is, according to the hidden state time series Identify the mutation point in the hidden state sequence, based on the mutation point V k The water quality category data monitored within a certain time range before and after the mutation point is used to determine the dominant water quality category status before and after the mutation point; the mutation point V k It is defined as the moment when the hidden state changes between two consecutive time steps t-1 and t, that is, it satisfies: Output mutation point set: {V1,V2,…,V k}, wherein V k represents the kth mutation point of the detected hidden state.
[0158] The determination of the dominant water quality category state before and after the mutation point specifically includes the following steps:
[0159] For each mutation point V k , the following is counted respectively: the period before the mutation point: from the mutation point V k to the last mutation point or the beginning of the record, the water quality category data Y new(k-1,k) monitored in this period is extracted; the period after the mutation point: from the mutation point V k to the end of the record, the water quality category data Y new(k,k+1) monitored in this period is extracted; the mode of the water quality category in the period before the mutation point and the period after the mutation point is calculated respectively, i.e. the water quality category with the highest frequency of occurrence, which is defined as the dominant water quality category state before and after the mutation point.
[0160] S6: According to the dominant water quality category state before and after the mutation point obtained in step S5, it is determined whether the mutation point is an inflection point of the radical change of the water quality level, and a semantic water quality alarm information label is triggered based on the determination result, the alarm information including the inflection point occurrence time V k , the dominant water quality category state before and after the mutation point, the determination result and the state label type
[0161] The determination rule for determining whether the mutation point is an inflection point of the radical change of the water quality level is: if there is a category transition of the dominant water quality category before and after the mutation point, i.e. from I-III category to IV-poor V category, or from IV-poor V category to I-III category, it is determined that the mutation point is an inflection point of the radical change of the water quality level.
[0162] The determination rule can be expressed as:
[0163]
[0164] wherein: T before (V k ) is the dominant water quality category before the mutation point; T after (V k ) is the dominant water quality category after the mutation.
[0165] Significant_Change(V k ) is a change judgment flag, with a value of 1 indicating a radical change and a value of 0 indicating no radical change.
[0166] For the inflection point determined to have a radical change of the water quality level, i.e. Significant_Change(V k) = 1, the water quality category state T k and the specified reference time T ref to make a category judgment and determine the state label type
[0167] state label type is defined as follows:
[0168]
[0169] wherein the specified reference time T ref is used to judge the "recent" and "persistent" state; if the user wants to understand the water quality change in the past month, the specified reference time can be one month ago, and the specified reference time refers to the representative water quality category state at the starting point of the record, which is used to measure the change characteristics of the current inflection point relative to the initial state; after each round of inflection point recognition calculation is completed, the representative water quality category of the current period is dynamically updated and cached at each monitoring time, and a time sequence state memory pool is constructed; when a new inflection point is identified, the reference time T ref associated with the new inflection point is extracted from the time sequence state memory pool.
[0170] As shown in Figure 3 , the water quality monitoring time sequence decomposition results of the total nitrogen (TN) index in the past 60 days are shown, and the original data is decomposed into trend, periodic and residual terms by using the STL model; the blue curve represents the original monitoring time sequence, which presents high-frequency fluctuations; the orange curve is the extracted long-term trend, which describes the overall evolution trend of the water quality concentration; the green curve corresponds to the periodic fluctuation characteristics; and the red curve reveals the residual structure of non-periodic disturbance and local anomaly.
[0171] As shown in Figure 4 , the figure shows the original monitoring time sequence of ammonia nitrogen (NH3-N) concentration and the corresponding water quality category jump recognition results from May to June, 2022. Figure 4 The lower graph of Figure 4 is the original sequence of NH3-N concentration, and the red dotted line indicates two key inflection points, which reveal the significant jump nodes of water quality state; The upper graph of
[0172] based on IV water quality as a threshold, marks and identifies the substantial change of water quality category. The analysis result shows that the water quality change in this period presents a "front-middle-back" three-section structure feature: the front and the end are in poor water quality (not lower than the limit value of IV class), and the middle is in good water quality (lower than the limit value of IV class), which clearly depicts the dynamic evolution process of water quality from "poor-good again". Figure 2 As shown in , the application discloses an online inflection point-based water quality category change recognition system, which comprises:
[0173] The periodic feature determination module is used to select at least one year of historical surface water quality monitoring data for spectral deconstruction to obtain the dominant periodic features. Based on the dominant periodic features, the dynamic analysis window is determined, that is, the continuous monitoring duration for inflection point identification is determined. The continuous monitoring duration for inflection point identification refers to the monitoring time length that can cover at least one complete dominant periodic feature to ensure the representativeness and accuracy of the data analysis and provide reliable data support for subsequent inflection point identification.
[0174] First, collect at least one year of historical monitoring data of water quality indicators from the required surface water quality monitoring stations to form an original water quality monitoring time series; water quality indicators include ammonia nitrogen concentration, total nitrogen concentration, total phosphorus concentration or chemical oxygen demand concentration.
[0175] Fast Fourier transform (FFT) is used to perform spectral deconstruction of the original water quality monitoring time series to determine the dominant periodic characteristics. Periodic characteristics refer to the phenomenon that the monitoring data presents regular and repeated changes in the time dimension, which is usually driven by factors such as the natural environment (such as seasonal changes and rainfall cycles), human activities (such as sewage discharge patterns), and hydrological processes. Fast Fourier transform can be used to identify significant frequency peaks, thereby judging whether the water quality indicators have significant daily cycles (24 hours), weekly cycles (7 days), monthly cycles (30 days) or other cycles. The energy spectrum is obtained by calculating the square of the amplitude of the complex coefficient corresponding to the frequency, and normalized to the energy proportion, thereby quantifying the contribution of each periodic component to the overall water quality change. Based on the energy contribution ratio, the dominant periodic characteristics are determined.
[0176] According to the dominant cycle characteristics, the continuous monitoring duration for inflection point identification is determined; the continuous monitoring duration for inflection point identification refers to the monitoring time length that can cover at least one complete dominant cycle characteristic, so as to fully reflect the changing trend and fluctuation pattern of water quality indicators, and avoid insufficient trend information due to too short a time period, or the introduction of too much historical interference information due to too long a time period.
[0177] In the present invention, considering that most surface water quality indicators are affected by monthly rainfall, water temperature changes, etc. and have obvious monthly cycle characteristics, a continuous monitoring period covering 60 days is selected to cover two dominant cycle characteristics, which can ensure sufficient data volume and effectively support subsequent trend extraction and inflection point identification analysis, ensuring the representativeness and accuracy of the identification results.
[0178] Trend data generation module, used to obtain the water quality monitoring time series x under continuous monitoring time within the dynamic analysis window t , the time series decomposition STL algorithm is used to analyze the water quality monitoring time series x t Perform multi-scale structure separation, extract water quality change trend characteristics, and generate change trend time series T t ={T1,T2,…Tn}, where the period parameter in the time series decomposition algorithm is the dominant period feature in the period feature determination module.
[0179] The STL (Seasonal-Trend decomposition based on Loess) algorithm is used to decompose the water quality monitoring time series. Based on the optimized local polynomial regression (LOESS) fitting model, the three main components of long-term trend, periodic change and random disturbance are separated. The mathematical expression of STL decomposition is:
[0180] x t =T t +S t +R t
[0181] Among them, x t represents the original water quality monitoring time series; T t Indicates the trend part, reflecting the long-term trend of data; S t Represents the seasonal part, showing the periodic changes of data; R t The residual represents the random noise not explained by the trend and seasonality. Through STL decomposition, we can quantify and separate the influencing mechanisms of water quality changes from different sources, providing high-quality trend data support for subsequent inflection point detection.
[0182] The trend part of the STL decomposition result is extracted and a trend time series is generated. The trend time series eliminates the interference of seasonality and random fluctuations on the data and can better reflect the real changes in water quality. The trend term T obtained by decomposition t The trend time series of water quality changes can be obtained to reflect the trend changes of water quality. The calculation formula is:
[0183] T t =x t -S t -R t
[0184] The present invention can obtain a trend time series T that eliminates seasonal and random fluctuations. t , eliminating from the root the interference of normal fluctuations in water quality on the identification of the fundamental state of water quality.
[0185] The water quality category data generation module is used to generate the change trend time series T according to the water quality category standard limit. t Perform interval mapping, that is, classify water quality, and obtain the discrete water quality category time series D tThe water quality categories are divided into six categories: Class I, Class II, Class III, Class IV, Class V, and Substandard Class V. Each water quality category corresponds to a specific water quality index concentration range, i.e., a water quality category limit interval composed of water quality category standard limits.
[0186] According to the "Surface Water Environmental Quality Standard" (GB3838-2002) issued by the State Environmental Protection Administration, the key water quality indicators and their corresponding water quality category limit intervals are determined. The water quality categories are divided into six categories: Class I, Class II, Class III, Class IV, Class V, and Substandard Class V. Each water quality category corresponds to a specific water quality index concentration range, i.e., a water quality category limit interval composed of water quality category standard limits.
[0187] For the trend time series T t ={T1,T2,…T n}, the trend value T t of each time step is classified and judged one by one. The current trend value T t is compared with the water quality category standard limit, and according to the water quality index concentration range to which it belongs, the trend value T t is mapped to the corresponding water quality category label. The mathematical expression is:
[0188] D t =f(T t )
[0189] Where f() is a classification function based on water quality category standard limits, and the output is the corresponding water quality category number. The continuous trend time series T t is converted into a discrete water quality category time series D t ={D1,D2,…D n}.
[0190] The hidden state inference module is used to construct a binary state hidden Markov model (HMM) based on the discrete water quality category time series D t . The "good state- poor state" bipolar potential structure is set, which refers to good water quality and poor water quality. Good water quality represents water quality of Class I to Class III, and poor water quality represents water quality of Class IV to Substandard Class V. The corresponding water quality hidden state time series is inferred through a probability propagation mechanism, and the hidden state transition trajectory is obtained.
[0191] The definition form of the binary state hidden Markov model in the hidden state inference module is as follows:
[0192] Model=(π,A,B)
[0193] where π is the initial state probability vector, A is the state transition probability matrix, and B is the emission probability matrix; the observation set in the hidden Markov model is the observation space O, and the observation space O is composed of the time series D of discrete water quality categories t ,
[0194] D t ∈{Ⅰ,Ⅱ,Ⅲ,Ⅳ,Ⅴ,Ⅴ}; the hidden state set in the hidden Markov model is the hidden state space Q, and the hidden state space Q is composed of two types of hidden states, i.e., the hidden state q good and the hidden state q bad , where the hidden state q good represents good water quality, and the good water quality represents the substantial water quality categories I, II, and III, i.e., the better water quality categories; and the hidden state q bad corresponds to poor water quality, and the poor water quality represents the substantial water quality categories IV, V, and V, i.e., the worse water quality categories.
[0195] The initial state probability vector π represents the probability of the water quality being in each hidden state at the initial time, and is defined as follows:
[0196] π=(π good ,π bad )
[0197] where π good represents the probability of the water quality being good water quality; and π bad represents the probability of the water quality being poor water quality.
[0198] The state transition probability matrix A is used to describe the change rule between the hidden states, and is defined as follows:
[0199]
[0200] where a 11 =P(q good →q good ) represents the probability of maintaining good water quality; a 12 =P(q good →q bad ) represents the probability of good water quality changing to poor water quality; a 21 =P(q bad →q good ) represents the probability of poor water quality improving to good water quality; and a 22 =P(q bad →q bad ) represents the probability of maintaining poor water quality.
[0201] The emission probability matrix B describes the probability of the hidden state generating the observed water quality category, and is defined as follows:
[0202]
[0203] wherein: b 11 = P (observed better class | q good ), probability of observing better water quality class under the good state of water quality hidden state; b 12 = P (observed worse class | q good ), probability of observing worse water quality class under the good state of water quality hidden state;
[0204] b 21 = P (observed better class | q bad ), probability of observing better water quality class under the bad state of water quality hidden state;
[0205] b 22 = P (observed worse class | q bad ), probability of observing worse water quality class under the bad state of water quality hidden state;
[0206] According to the water quality class data within 24 hours, an initial state probability vector is calculated, and sampling is performed every certain period of time, m water quality monitoring data within a day are obtained, if the number of observations belonging to the good state of water quality, i.e. the water quality class is class I to class III, is m1 times, and the number of observations belonging to the bad state of water quality, i.e. the water quality class is class IV to class V, is m2 times, then the initial state probability vector is
[0207] The water quality class time sequence D t According to a preset hidden state definition rule, the water quality class time sequence is one-to-one mapped to a sequence of explicit hidden states, the state transition during continuous observation in the sequence of explicit hidden states is counted, the state transition probability is calculated according to the counting result, and a state transition probability matrix A is obtained.
[0208] The state transition during continuous observation in the sequence of explicit hidden states is counted, and the number of occurrences of the following events is counted respectively: N good→good : number of times of keeping the good state from the good state; N good→bad : number of times of changing from the good state to the bad state; N bad→good : number of times of changing from the bad state to the good state; N bad→bad : number of times of keeping the bad state from the bad state.
[0209] The state transition probability is calculated according to the counting result, and the specific calculation formula is as follows:
[0210]
[0211] Thus, the state transition probability matrix A is determined:
[0212]
[0213] Input the initial state probability vector π, the state transition probability matrix A, and the initial uniform assigned emission probability matrix B into the binary state hidden Markov model, and perform hidden state inference on the water quality category time series D t to output the initial hidden state time series wherein Based on the initial hidden state sequence and the water quality category time series D t perform joint statistics to calculate the emission probability matrix B
[0214] Specifically, the following steps are included:
[0215] The initial uniform assignment of the emission probability matrix B is as follows: Based on the binary state hidden Markov model, the Viterbi algorithm is used to perform hidden state inference on the water quality category time series D t to infer the most likely hidden state path, i.e., recursively calculate the optimal hidden state path for each time step t, and output the initial hidden state time series wherein Based on the initial hidden state sequence and the water quality category time series D t perform joint statistics to calculate the emission probability matrix B, and the specific calculation formula is as follows:
[0216] When the hidden state is q good , the number of times N good隐态观测好 of observing the I-III category and the number of times N good隐态观测差 of observing the IV-poor V category are counted; bad When the hidden state is q bad隐态观测好 , the number of times N bad隐态观测差 of observing the I-III category and the number of times N t of observing the IV-poor V category are counted.
[0217] The calculation formula of each element of the emission probability matrix B is as follows:
[0218]
[0219] Thus, the emission probability matrix B is determined:
[0220]
[0221] Input the initial state probability vector π, the state transition probability matrix A, and the calculated emission probability matrix B into the hidden Markov model, and perform hidden state inference on the water quality category time series D t to output the corresponding hidden state time series to obtain the hidden state transition trajectory.
[0222] The mutation point identification module is used to anchor the mutation point in the hidden state transition trajectory, that is, the mutation moment when the water quality state changes from a good state to a bad state or from a bad state to a good state. Based on the water quality category data in the time window before and after the mutation, the dominant water quality category state before and after the mutation point is extracted; that is, according to the water quality hidden state time series Identify the mutation point V in the hidden state sequence k , based on the mutation point V k The water quality category data monitored within a certain time range before and after the mutation point is used to determine the dominant water quality category status before and after the mutation point. k It is defined as the moment when the hidden state changes between two consecutive time steps t-1 and t, that is, it satisfies: Output mutation point set: {V1,V2,…,V k}, where V k Indicates the time point at which the kth hidden state mutation is detected.
[0223] The dominant water quality category states before and after the mutation point are determined in the mutation point identification module as follows:
[0224] For each mutation point V k , from the mutation point V k Trace back to the previous mutation point or the starting point of the record and extract the water quality category data Y monitored during the period before the mutation point new(k-1,k) ; From the mutation point V k Continue back to the end of the record and extract the water quality category data Y monitored during the period after the mutation point new(k,k+1) ; Calculate the mode of water quality categories in the time periods before and after the mutation point respectively, that is, the water quality category with the highest frequency, which is defined as the dominant water quality category state before and after the mutation point.
[0225] The inflection point recognition alarm module is used to determine whether the mutation point is an inflection point where the water quality level undergoes a fundamental jump based on the dominant water quality category status before and after the mutation point. Based on the determination result, the semantic water quality alarm information is triggered. The alarm information includes the inflection point occurrence time V k , dominant water quality category status before and after the mutation point, judgment results and status label type
[0226] The inflection point identification and alarm module determines whether a mutation point is an inflection point where a fundamental jump in water quality occurs: if there is a category jump in the dominant water quality category before and after the mutation point, that is, a jump from category I-III to category IV-poor V, or from category IV-poor V to category I-III, then the mutation point is considered an inflection point where a fundamental jump in water quality occurs;
[0227] For the inflection point where the water quality level is determined to have a fundamental jump, that is, Significant_Change (V k) = 1, the inflection point after the water quality category state T k and the specified reference time T ref category judgment is performed to determine the state label type state label type defined as follows:
[0228]
[0229] wherein the specified reference time T ref is used to judge the "recent" and "persistent" states; if the user wants to understand the water quality change in the past month, the specified reference time can be one month ago, and the specified reference time refers to the representative water quality category state at the starting point of the record, which is used to measure the change characteristics of the current inflection point relative to the initial state; after each round of inflection point recognition calculation is completed, the representative water quality category of the current period is dynamically updated and cached at each monitoring time, and a time sequence state memory pool is constructed; when a new inflection point is identified, the reference time T ref associated with the new inflection point is extracted from the time sequence state memory pool.
[0230] Embodiment 3
[0231] The electronic device disclosed by the application comprises one or more processors, one or more memories, and one or more programs, the program is stored in the memory and is configured to be executed by the processor, and the program is loaded into the processor to realize the steps of the online identification of the water quality category change based on the inflection point of embodiment 1.
[0232] Embodiment 4
[0233] The computer readable storage medium disclosed by the application stores a computer program, the computer program comprises program instructions, and the program instructions make the processor execute the steps of the online identification of the water quality category change based on the inflection point of embodiment 1 when the processor executes the program instructions.
Claims
1. An online identification method for water quality category changes based on inflection points, characterized in that: The steps include: S1: Select a historical surface water quality monitoring series covering at least one year for spectral deconstruction, extract the dominant periodic features, and determine the dynamic analysis window; S2: Obtain the water quality continuous monitoring time series x within the dynamic analysis window t , the STL model based on Loess kernel regression is used to analyze the water quality monitoring time series x t Perform multi-scale structure separation, extract water quality change trend characteristics, and obtain the change trend time series T t ; S3: Time series T of change trend based on water quality category standard limit t Perform interval mapping to obtain the discrete water quality category time series D t , water quality categories are divided into six categories: Class I, Class II, Class III, Class IV, Class V and Class V; S4: Based on discrete water quality category time series D t , construct a binary state hidden Markov model, set the "good state-bad state" bipolar latent structure, "good state-bad state" bipolar latent structure refers to good water quality and bad water quality. Good water quality represents water quality of Class I to Class III, and bad water quality represents water quality of Class IV to Class V. The hidden state transition trajectory is inferred through the probability propagation mechanism; S5: Anchor the mutation point in the latent state transition trajectory, that is, the moment when the water quality state changes from a good state to a bad state or from a bad state to a good state. Based on the water quality category data in the time window before and after the mutation, extract the dominant water quality category state before and after the mutation point; S6: Based on the dominant water quality category status before and after the mutation point, determine whether the mutation point is an inflection point where a fundamental jump in water quality occurs. Based on the determination result, trigger a semantic water quality alarm information labeling. The alarm information includes the time of the inflection point, the dominant water quality category status before and after the mutation point, the determination result, and the status label type.
2. The method for online identification of water quality category changes based on inflection points according to claim 1 is characterized in that: The step S4 specifically includes the following steps: S4.1: The definition of a binary state hidden Markov model is as follows: Model=(π,A,B) Where π is the initial state probability vector, A is the state transition probability matrix, and B is the emission probability matrix. The observation set in the hidden Markov model is the observation space O, which is composed of discrete water quality category time series D t Composition, D t ∈{Class I, Class II, Class III, Class IV, Class V, Class V}; The hidden state set in the binary state hidden Markov model is the hidden state space Q, which is composed of two types of hidden states. The hidden state q good and hidden state q bad , where the hidden state q good Represents excellent water quality. Excellent water quality represents the substantial categories of water quality: I, II, and III, which are better water quality categories; hidden state q bad Corresponding to poor water quality, poor water quality represents the substantive categories of water quality: IV, V, and inferior V, which are relatively poor water quality categories; The initial state probability vector π represents the probability of the water quality being in each hidden state at the initial moment and is defined as follows: π=(π good ,π bad ) Where: π good Indicates the probability that the water quality is excellent; π bad Indicates the probability that the water quality is poor; The state transition probability matrix A is used to describe the change pattern between hidden states and is defined as follows: Among them, a 11 =P(q good →q good ), the probability of maintaining excellent water quality; a 12 =P(q good →q bad ), the probability that the good water quality changes to the bad water quality; a 21 =P(q bad →q good ), the probability that poor water quality improves to excellent water quality; a 22 =P(q bad →q bad ), the probability of maintaining poor water quality; The emission probability matrix B describes the probability of the hidden state generating the observed water quality category and is defined as follows: Where: b 11 =P(observation better category q good ), the probability of observing a better water quality category under the optimal water quality hidden state; b 12 =P(observation poor category q good ), the probability of observing a poor water quality category under the optimal water quality hidden state; b 21 =P(observation better category|q bad ), the probability of observing a better water quality category under a poor water quality hidden state; b 22 =P(observation poor category q bad ), the probability of observing a poor water quality category in a poor water quality latent state; S4.2: Calculate the initial state probability vector based on the water quality category data within 24 hours. Sampling is done at regular intervals to obtain m water quality monitoring data within a certain day. If the number of observations of excellent water quality, that is, water quality categories I to III, is m1; the number of observations of poor water quality, that is, water quality categories IV to poor V, is m2, then the initial state probability vector S4.3: Time series of water quality categories D t According to the preset hidden state definition rules, the water quality category time series is mapped one by one to the explicit hidden state sequence. The state transition during the continuous observation period in the explicit hidden state sequence is counted. The state transition probability is calculated based on the statistical results to obtain the state transition probability matrix A. Count the state transitions during continuous observations in the explicit and implicit state sequences, and count the number of occurrences of the following events: N good→good : The number of times the hidden state remains optimal from the optimal state; N good→bad : The number of times the hidden state changes from the optimal state to the inferior state; N bad→good : The number of times the hidden state changes from the inferior state to the superior state; N bad→bad : The number of times the hidden state remains in a bad state from a bad state; The state transition probability is calculated based on the statistical results. The specific calculation formula is as follows: Thus, the state transition probability matrix A is determined: S4.4: Input the initial state probability vector π obtained in step S4.2, the state transition probability matrix A obtained in step S4.3, and the initial uniformly assigned emission probability matrix B into the binary state hidden Markov model to calculate the water quality category time series D. t Perform hidden state inference and output the initial hidden state sequence in Based on the initial hidden state sequence Time series with water quality category D t Perform joint statistics and calculate the emission probability matrix B. The specific calculation formula is: The statistical hidden state is q good When N is the number of times I-III categories are observed good隐态观测好 and the number of times N the IV-inferior V category is observed good隐态观测差 ; The statistical hidden state is q bad When N is the number of times I-III categories are observed bad隐态观测好 and the number of times N the IV-inferior V category is observed bad隐态观测差 ; The calculation formula for each element of the emission probability matrix B is as follows: Thus the emission probability matrix B is determined: S4.5: Input the initial state probability vector π obtained in step S4.2, the state transition probability matrix A obtained in step S4.3, and the emission probability matrix B obtained in step S4.4 into the binary state hidden Markov model to calculate the water quality category time series D. t Perform hidden state inference and output the corresponding hidden state time series Obtain the hidden state transition trajectory.
3. The method for online identification of water quality category changes based on inflection points according to claim 1 is characterized in that: Determining the dominant water quality category state before and after the mutation point in step S5 specifically includes the following steps: For each mutation point V k , from the mutation point V k Trace back to the previous mutation point or the starting point of the record and extract the water quality category data Y monitored in the time window before the mutation point new(k-1,k) ; From the mutation point V k Continue back to the end of the record and extract the water quality category data Y monitored in the time window after the mutation point new(k,k+1) ; Calculate the mode of water quality categories in the time window before and after the mutation point, that is, the water quality category with the highest frequency, which is defined as the dominant water quality category state before and after the mutation point.
4. The method for online identification of water quality category changes based on inflection points according to claim 1 is characterized in that: The rule for determining whether the mutation point is an inflection point where a fundamental jump in water quality occurs in step S6 is: if there is a fundamental jump in the dominant water quality category before and after the mutation point, that is, a jump from category I-III to category IV-inferior V, or a jump from category IV-inferior V to category I-III, then the mutation point is determined to be an inflection point where a fundamental jump in water quality occurs; For the inflection point where a fundamental jump in water quality occurs, the water quality category state T k and the specified reference time T ref Perform category judgment and determine the status label type Status label type The definition is as follows: The designated reference moment refers to the representative water quality category state at the recording starting point, which is used to measure the change characteristics of the current inflection point relative to the initial state. After each round of inflection point identification calculation is completed, the representative water quality category of the current period is dynamically updated and cached at each monitoring moment to build a time series state memory pool. When a new inflection point is identified, the reference time T associated with the new inflection point is extracted from the temporal state memory pool. ref .
5. An online identification system for water quality category changes based on inflection points, characterized in that: include: The periodic feature determination module is used to select a historical surface water quality monitoring sequence covering no less than one year for spectrum deconstruction, extract the dominant periodic features, and determine the dynamic analysis window; Trend data generation module, used to obtain the water quality continuous monitoring time series x within the dynamic analysis window t , the STL model based on Loess kernel regression is used to analyze the water quality monitoring time series x t Perform multi-scale structure separation, extract water quality change trend characteristics, and obtain the change trend time series T t ; The water quality category data generation module is used to generate the change trend time series T according to the water quality category standard limit. t Perform interval mapping to obtain the discrete water quality category time series D t , water quality categories are divided into six categories: Class I, Class II, Class III, Class IV, Class V and Class V; Hidden state inference module is used to calculate the discrete water quality category time series D t , construct a binary state hidden Markov model, set the "good state-bad state" bipolar latent structure, "good state-bad state" bipolar latent structure refers to good water quality and bad water quality. Good water quality represents water quality of Class I to Class III, and bad water quality represents water quality of Class IV to Class V. The hidden state transition trajectory is inferred through the probability propagation mechanism; The mutation point identification module is used to anchor the mutation point in the latent state transition trajectory, that is, the moment when the water quality state changes from a favorable state to a poor state or from a poor state to a favorable state. Based on the water quality category data in the time window before and after the mutation, the dominant water quality category state before and after the mutation point is extracted; The inflection point identification and alarm module is used to determine whether the mutation point is an inflection point where a fundamental jump in water quality grade occurs based on the dominant water quality category status before and after the mutation point, and trigger semantic water quality alarm information labeling based on the judgment result. The alarm information includes the time of occurrence of the inflection point, the dominant water quality category status before and after the mutation point, the judgment result and the status label type.
6. The inflection point-based online water quality classification change identification system according to claim 5 is characterized in that: The definition of the binary state hidden Markov model in the hidden state inference module is as follows: Model=(π,A,B) Where π is the initial state probability vector, A is the state transition probability matrix, and B is the emission probability matrix. The observation set in the hidden Markov model is the observation space O, which is composed of discrete water quality category time series D t Composition, D t ∈{Class I, Class II, Class III, Class IV, Class V, Class V}; The hidden state set in the binary state hidden Markov model is the hidden state space Q, which is composed of two types of hidden states. The hidden state q good and hidden state q bad , where the hidden state q good Represents excellent water quality. Excellent water quality represents the substantial categories of water quality: I, II, and III, which are better water quality categories; hidden state q bad Corresponding to poor water quality, poor water quality represents the substantive categories of water quality: IV, V, and inferior V, which are relatively poor water quality categories; The initial state probability vector π represents the probability of the water quality being in each hidden state at the initial moment and is defined as follows: π=(π good ,π bad ) Where: π good Indicates the probability that the water quality is excellent; π bad Indicates the probability that the water quality is poor; The state transition probability matrix A is used to describe the change pattern between hidden states and is defined as follows: Among them, a 11 =P(q good →q good ), the probability of maintaining excellent water quality; a 12 =P(q good →q bad ), the probability that the good water quality changes to the bad water quality; a 21 =P(q bad →q good ), the probability that poor water quality improves to excellent water quality; a 22 =P(q bad →q bad ), the probability of maintaining poor water quality; The emission probability matrix B describes the probability of the hidden state generating the observed water quality category and is defined as follows: Where: b 11 =P(observation better category q good ), the probability of observing a better water quality category under the optimal water quality hidden state; b 12 =P(observation poor category q good ), the probability of observing a poor water quality category under the optimal water quality hidden state; b 21 =P(observation better category|q bad ), the probability of observing a better water quality category under the hidden state of poor water quality; b 22 =P(poor observation category|q bad ), the probability of observing a poor water quality category in a poor water quality latent state; The initial state probability vector is calculated based on the water quality category data within 24 hours. Sampling is done at regular intervals to obtain m water quality monitoring data within a certain day. If the water quality is excellent, that is, the number of observations belonging to the water quality category of Class I to Class III is m1; the water quality is poor, that is, the number of observations belonging to the water quality category of Class IV to Class V is m2, then the initial state probability vector The water quality category time series D t According to the preset hidden state definition rules, the water quality category time series is mapped one by one to the explicit hidden state sequence. The state transition during the continuous observation period in the explicit hidden state sequence is counted. The state transition probability is calculated based on the statistical results to obtain the state transition probability matrix A. Count the state transitions during continuous observations in the explicit and implicit state sequences, and count the number of occurrences of the following events: N good→good : The number of times the hidden state remains optimal from the optimal state; N good→bad : The number of times the hidden state changes from the optimal state to the inferior state; N bad→good : The number of times the hidden state changes from the inferior state to the superior state; N bad→bad : The number of times the hidden state remains in a bad state from a bad state; The state transition probability is calculated based on the statistical results. The specific calculation formula is as follows: Thus, the state transition probability matrix A is determined: The initial state probability vector π, the state transition probability matrix A, and the initial uniformly assigned emission probability matrix B are input into the binary state hidden Markov model to calculate the water quality category time series D. t Perform hidden state inference and output the initial hidden state sequence in Based on the initial hidden state sequence Time series with water quality category D t Perform joint statistics and calculate the emission probability matrix B. The specific calculation formula is: The statistical hidden state is q good When N is the number of times I-III categories are observed good隐态观测好 and the number of times N the IV-inferior V category is observed good隐态观测差 ; The statistical hidden state is q bad When N is the number of times I-III categories are observed bad隐态观测好 and the number of times N the IV-inferior V category is observed bad隐态观测差 ; The calculation formula for each element of the emission probability matrix B is as follows: Thus the emission probability matrix B is determined: The initial state probability vector π, the state transition probability matrix A and the calculated emission probability matrix B are input into the binary state hidden Markov model to calculate the water quality category time series D. t Perform hidden state inference and output the corresponding hidden state time series Obtain the hidden state transition trajectory.
7. The online identification system for water quality category changes based on inflection points according to claim 5 is characterized in that: The dominant water quality category states before and after the mutation point are determined in the mutation point identification module as follows: For each mutation point V k , from the mutation point V k Trace back to the previous mutation point or the starting point of the record and extract the water quality category data Y monitored in the time window before the mutation point new(k-1,k) ; From the mutation point V k Continue back to the end of the record and extract the water quality category data Y monitored in the time window after the mutation point new(k,k+1) ; Calculate the mode of water quality categories in the time window before and after the mutation point, that is, the water quality category with the highest frequency, which is defined as the dominant water quality category state before and after the mutation point.
8. The inflection point-based online water quality classification change identification system according to claim 5, characterized in that: The inflection point identification and alarm module determines whether a mutation point is an inflection point where a fundamental jump in water quality occurs as follows: if there is a fundamental jump in the dominant water quality category before and after the mutation point, that is, a jump from category I-III to category IV-poor V, or a jump from category IV-poor V to category I-III, then the mutation point is identified as an inflection point where a fundamental jump in water quality occurs; For the inflection point where a fundamental jump in water quality occurs, the water quality category state T k and the specified reference time T ref Perform category judgment and determine the status label type Status label type The definition is as follows: The designated reference moment refers to the representative water quality category state at the starting point of the record, which is used to measure the change characteristics of the current inflection point relative to the initial state; After each round of inflection point identification calculation is completed, the representative water quality category of the current period is dynamically updated and cached at each monitoring moment to build a time series state memory pool; When a new inflection point is identified, the reference time T associated with the new inflection point is extracted from the temporal state memory pool. ref .
9. An electronic device, characterized in that: The method comprises one or more processors, one or more memories and one or more programs, wherein the programs are stored in the memories and configured to be executed by the processors, and when the programs are loaded into the processors, the steps of the method for online identification of water quality category changes based on inflection points according to any one of claims 1 to 4 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the inflection point-based online identification method for water quality category changes according to any one of claims 1 to 4.
Citation Information
Patent Citations
Method for analyzing skiing motion sequence based on hidden Markov analysis
CN112347991A
Intelligent ecological environment partition management and control system
CN117993556A