Blue-green algae outbreak prediction model construction method and blue-green algae outbreak prediction system
By using the BG algorithm to identify mutant points and weighted training of long and short-term memory neural networks in the cyanobacteria burst prediction model, the problem of traditional models ignoring human factors and mutant point detection assumptions is solved, and the accuracy and robustness of prediction are improved.
Patent Information
- Application Number
- CN202411269808.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-13
AI Technical Summary
The traditional cyanobacterial outbreak prediction model ignores the influence of human factors, and the existing variation point detection method is strict assumptions and cannot effectively capture multiple variation points, resulting in poor accuracy and robustness of the prediction model.
The preset BG algorithm is used to identify the mutant points, extract the target feature information, and train the long-term and short-term memory neural network model based on the weighted loss function to build a cyanobacteria burst prediction model based on the weighted mutant point.
It significantly improves the accuracy and robustness of the cyanobacteria outbreak prediction model, can capture mutations in the water environment of the basin more sensitively, enhance attention to the influence of human factors, and improve the reliability of prediction.
Smart Images

Figure CN119129833A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of environmental science, and in particular to a method for constructing a cyanobacteria outbreak prediction model and a cyanobacteria outbreak prediction system. Background Art
[0002] Cyanobacteria bloom is the most prominent feature of eutrophic water bodies. Its outbreak is related to a variety of comprehensive factors such as meteorology, hydrology, water quality, biological characteristics of cyanobacteria and human factors. Accurate prediction of cyanobacteria outbreaks can play an important role in the protection of lake water sources. At present, relevant technologies have proposed that the outbreak time of cyanobacteria can be predicted by establishing a cyanobacteria outbreak prediction model.
[0003] However, the traditional modeling process treats lake water quality time series data as stationary series for analysis and prediction, and the traditional data-driven cyanobacteria forecasting model only considers factors such as meteorology, hydrology, and water quality, ignoring the impact of human factors; however, in real application environments, the impact of human factors is difficult to quantify in data-driven models, such as the closure of chemical plants, fishing bans, dredging of sludge, creation of underwater forests, river management, and reservoir scheduling. The impact of human factors will cause mutations and variations in the water environment of lake basins, resulting in mutation points in the time series data that reflect major changes in the water environment of the basin. If these mutation points are ignored, the model will not be able to sensitively capture the mutations in the water environment of the basin, thereby affecting the accuracy and reliability of the prediction model.
[0004] In addition, existing statistical-based variation point detection and modeling methods often have strict assumptions, such as data stationarity and linearity, and can only deal with a single variation point; while in the actual lake basin water environment, there may be multiple variation points, resulting in poor robustness of the prediction model. Summary of the invention
[0005] In view of this, the object of the present invention is to provide a method for constructing a cyanobacteria outbreak prediction model and a cyanobacteria outbreak prediction system, which can significantly improve the accuracy and robustness of the cyanobacteria outbreak prediction model.
[0006] In a first aspect, an embodiment of the present invention provides a method for constructing a cyanobacteria outbreak prediction model, the method comprising: obtaining original sample data, and preprocessing the original sample data to obtain target sample data after noise is removed, wherein the original sample data comprises: key indicators of lake cyanobacteria outbreak, and the key indicators comprise: rainfall, chemical oxygen content and ammonia content of the lake; using a preset BG algorithm, performing variation point recognition processing on the target sample data to determine the variation points in the target sample data, wherein the preset BG algorithm is a heuristic segmentation algorithm, and the variation points are used to respond to sudden environmental changes; extracting target feature information from the target sample data corresponding to the variation points, wherein the target feature information comprises variation point information; determining a weighted loss function according to the target feature information, and using the weighted loss function, the target feature information and the original sample data to perform model training on a preset long short-term memory neural network model to determine a target cyanobacteria outbreak prediction model based on variation point weighting, wherein the target cyanobacteria outbreak prediction model is used to predict the probability and intensity of cyanobacteria outbreak and determine a target prediction result.
[0007] In one embodiment, the step of using a preset BG algorithm to perform variation point identification processing on the target sample data and determining the variation points in the target sample data includes: dividing the original sample data into data segments of a preset length, and using a preset BG algorithm to perform small sample size detection processing on the time series corresponding to each data segment in the original sample data, and determining the t-test statistic corresponding to each data point in the time series, wherein the t-test statistic is used to reflect the difference between data points; and determining the data point with the largest t-test statistic that is greater than a preset statistical threshold as the variation point.
[0008] In one embodiment, the step of extracting target feature information from the target sample data corresponding to the variation point includes: selecting a data segment corresponding to the variation point from the target sample data; performing feature extraction processing on the data segment to determine statistical features, time series features, and derived features based on the variation point related to the growth of cyanobacteria; and performing feature screening processing on the statistical features, the time series features, and the derived features according to a preset feature selection range to determine the target feature information for model training.
[0009] In one embodiment, the step of determining a weighted loss function based on the target feature information includes: obtaining the distance information of the variation point, and performing parameter setting processing on a preset weight function based on the distance information of the variation point and the target feature information to determine a target weight function, wherein the target weight function is used to dynamically adjust the prediction weight of the model according to the importance of the variation point; performing function fusion processing on the target weight function and a preset loss function to determine the weighted loss function, wherein the loss function is used to dynamically adjust model parameters according to the prediction error to optimize model performance, and the weighted loss function is a Gaussian weighted mean square error loss function based on the variation point distance.
[0010] In one embodiment, the step of using the weighted loss function, the target feature information and the original sample data to perform model training on a preset long short-term memory neural network model to determine a target cyanobacteria outbreak prediction model based on variation point weighting includes: combining the preset long short-term memory neural network model with a preset attention mechanism to determine a sequence-to-sequence model, and extracting data from different years from the original sample data as a model training set; sending the target feature information to the sequence-to-sequence model and the weighted loss function respectively, determining the root mean square difference corresponding to the target model to be trained and each of the model training sets, and weighting the root mean square difference to the corresponding training set to determine the target training set; using the target training set to perform model training on the target model to be trained, and determining the target cyanobacteria outbreak prediction model based on variation point weighting.
[0011] In a second aspect, an embodiment of the present invention further provides a cyanobacteria outbreak prediction system, the system comprising: a data reading and preprocessing module, a variation detection module, a feature extraction module, a time series prediction model training module and a prediction model application module; wherein the data reading and preprocessing module is used to obtain original sample data, and preprocess the original sample data to obtain target sample data after noise removal; the variation detection module is used to perform variation point recognition processing on the target sample data through a preset BG algorithm to identify variation points in the target sample data, wherein the preset BG algorithm is a heuristic segmentation algorithm, and the variation points are used to respond to sudden environmental changes; the feature extraction module is used to extract target feature information from the target sample data corresponding to the variation points; the time series prediction model training module is used to determine a weighted loss function according to the target feature information, and use the weighted loss function and the original sample data to perform model training on a preset long short-term memory neural network model to determine a target cyanobacteria outbreak prediction model based on variation point weighting; the prediction model application module is used to predict the probability and intensity of cyanobacteria outbreak through the target cyanobacteria outbreak prediction model to determine a target prediction result.
[0012] In one embodiment, the variation detection module includes: a BG algorithm parameter setting submodule; wherein the BG algorithm parameter setting submodule is used to perform data characteristic analysis on the target sample data, determine the data characteristics corresponding to the target sample data, and adjust the parameters of the BG algorithm according to the data characteristics to obtain an adjusted target BG algorithm.
[0013] In one embodiment, the variation detection module further includes: a submodule for identifying variation points using a BG algorithm; wherein the submodule for identifying variation points using a BG algorithm is used to perform variation point identification processing on target sample data using a target BG algorithm to determine variation points in the target sample data.
[0014] In one embodiment, the feature extraction module includes: a first feature selection submodule and a second feature selection submodule; wherein the first feature selection submodule is used to select data segments corresponding to variation points from target sample data, and perform feature extraction processing on the data segments to determine statistical features, time series features and derivative features based on variation points related to cyanobacteria growth; the second feature selection submodule is used to extract target feature information for model training from statistical features, time series features and derivative features according to a preset feature selection range.
[0015] In a third aspect, an embodiment of the present invention further provides a server, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement any one of the methods provided in the first aspect.
[0016] The embodiments of the present invention bring the following beneficial effects:
[0017] The embodiments of the present invention provide a method for constructing a cyanobacteria outbreak prediction model and a cyanobacteria outbreak prediction system. After obtaining the original sample data, the method pre-processes the original sample data to obtain the target sample data after noise is removed, and then uses a preset BG algorithm to perform variation point recognition processing on the target sample data to determine the variation points in the target sample data, and extracts the target feature information from the target sample data corresponding to the variation points. Finally, a weighted loss function is determined according to the target feature information, and a preset long short-term memory neural network model is trained using the weighted loss function, the target feature information and the original sample data to determine a target cyanobacteria outbreak prediction model based on variation point weighting, wherein the target cyanobacteria outbreak prediction model is used to predict the probability and intensity of cyanobacteria outbreaks and determine a target prediction result. The embodiments of the present invention can significantly improve the accuracy and robustness of the cyanobacteria outbreak prediction model.
[0018] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0019] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 A schematic flow chart of a method for constructing a blue algae outbreak prediction model provided by an embodiment of the present invention;
[0022] Figure 2 A schematic diagram of the structure of a blue algae outbreak prediction system provided by an embodiment of the present invention;
[0023] Figure 3 A time series diagram of rainfall provided by an embodiment of the present invention;
[0024] Figure 4 A time series diagram of chemical oxygen content provided by an embodiment of the present invention;
[0025] Figure 5 A time series diagram of ammonia content provided by an embodiment of the present invention;
[0026] Figure 6 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] Cyanobacteria bloom is the most prominent feature of eutrophic water bodies. Its outbreak is related to a variety of comprehensive factors such as meteorology, hydrology, water quality, biological characteristics of cyanobacteria and human factors. Accurate prediction of cyanobacteria outbreaks can play an important role in the protection of lake water sources. At present, relevant technologies have proposed that the outbreak time of cyanobacteria can be predicted by establishing a cyanobacteria outbreak prediction model.
[0029] However, the traditional modeling process treats lake water quality time series data as a stationary series for analysis and prediction, and the traditional data-driven cyanobacteria forecasting model only considers factors such as meteorology, hydrology, and water quality, ignoring the impact of human factors; however, in the actual application environment, the impact of human factors is difficult to quantify in the data-driven model. The impact of human factors such as the closure of chemical plants, fishing bans, dredging of sediments, creation of underwater forests, river management, and reservoir scheduling will cause mutations and variations in the water environment of the lake basin, resulting in the presence of mutation points in the time series data that reflect major changes in the water environment of the basin. If these mutation points are ignored, the model will not be able to sensitively capture the mutations in the water environment of the basin, thereby affecting the accuracy and reliability of the prediction model. Even if some existing models are aware of the existence of mutation points in the data, when training the model, all data are usually treated equally, which ignores the important indicative role of the data before and after the mutation point for prediction. The mutation point can better reflect the changing trend of the water environment in the basin and should be given higher attention, but the existing technology often lacks this consideration.
[0030] In addition, existing cyanobacteria outbreak prediction models are usually established based on statistical variation point detection and modeling methods, and often have strict assumptions, such as data stationarity and linearity, and can only deal with a single variation point. However, there may be multiple variation points in the actual lake basin water environment, resulting in poor robustness of the prediction model. For example, the industrial upgrading and transformation of Taihu Lake starting in 2008, the fishing ban in Taihu Lake starting in 2020, and other large and small water environment improvement projects may cause variations in time series data, thereby affecting the predictability of the cyanobacteria model. Therefore, a more flexible and robust variation point modeling mechanism is needed. The occurrence of cyanobacteria outbreaks is often closely related to changes in human production and life over a long period of time. However, many existing data-driven prediction models cannot quantify the impact of human factors well, which can easily lead to inaccurate predictions.
[0031] Based on this, the method for constructing a cyanobacteria outbreak prediction model and a cyanobacteria outbreak prediction system provided by the present invention can improve the accuracy and robustness of cyanobacteria outbreak prediction by introducing the concept of variation points and combining them with a weighted loss function. The weighted prediction idea based on variation points can make full use of the watershed water environment change information implicit in the lake water quality data.
[0032] See also Figure 1The flowchart of a method for constructing a blue algae outbreak prediction model is shown, and the method mainly includes the following steps S102 to S108:
[0033] Step S102, obtaining original sample data, and preprocessing the original sample data to obtain target sample data after noise removal, wherein the original sample data includes: key indicators of lake cyanobacteria outbreaks, and the key indicators include: lake rainfall, chemical oxygen content and ammonia content.
[0034] Step S104, using the preset BG algorithm, performing variation point identification processing on the target sample data to determine the variation points in the target sample data, wherein the preset BG algorithm is a heuristic segmentation algorithm, and the variation points are used to respond to sudden environmental changes. The number of variation points can be one or more, and the data before and after the variation points can play an important indicative role in the prediction. The variation points can well reflect the changing trend of the water environment in the basin. Specifically, the BG algorithm of variation test, namely the BernaolaGalvan segmentation algorithm, is a heuristic algorithm for detecting mutations in non-stationary time series. It is suitable for processing sequence data containing trend, seasonality or periodicity components, such as climate data. The basic principle of the BG algorithm is to divide a time series into two subsequences through a certain point, and then calculate the mean and standard deviation of the two subsequences, and use the t-test statistic to evaluate whether the segmentation point is a mutation point.
[0035] In one embodiment, the original sample data is divided into data segments of preset lengths, and a preset BG algorithm is used to perform small sample size detection processing on the time series corresponding to each data segment in the original sample data, and the t-test statistic corresponding to each data point in the time series is determined, wherein the t-test statistic is used to reflect the difference between the data points, and the data point with the largest t-test statistic and greater than a preset statistic threshold is determined as a mutation point. In addition, in addition to the BG algorithm, other algorithms that can effectively detect mutation points from multidimensional time series can also be used, such as Mann-Kendall mutation point detection, Pettitt mutation point detection, Buishand U test mutation point detection, and Standard Normal Homogeneity Test mutation point detection. Mutation point detection is the basic link of the present invention. The BG algorithm, etc. can effectively detect mutation points from multidimensional time series, laying the foundation for subsequent feature construction and model training.
[0036] In practical applications, the BG algorithm parameters can be adjusted according to the data characteristics to improve the accuracy of variation point identification. The BG algorithm is used to analyze lake water quality monitoring data to identify variation points that may reflect major changes in the water environment of the basin. These variation points may be caused by the implementation of new environmental protection policies in the local area, changes in industrial emissions, and other reasons.
[0037] Step S106, extracting target feature information from the target sample data corresponding to the variation point, wherein the target feature information (i.e., the multivariate feature vector) includes the variation point information. In one embodiment, the data segment corresponding to the variation point can be selected from the target sample data, and feature extraction processing can be performed on the data segment to determine the statistical features, time series features, and derivative features based on the variation point related to the growth of cyanobacteria. Finally, according to the preset feature selection range, feature screening processing is performed on the statistical features, time series features, and derivative features to determine the target feature information for model training. Furthermore, it is necessary to use the variation point information as the feature input of the prediction model, and input the detected variation point information (such as position, statistical changes of previous and subsequent data, etc.) as the target feature information into the prediction model to be trained, so as to make full use of the water environment change information of the watershed brought by the variation point, enrich the input features of the model, and improve the model expression ability. In addition to the variation point information, the target feature information also includes: water quality indicators, statistical features, time series features and other elements.
[0038] That is to say, the statistical features in the feature extraction module include but are not limited to the mean, variance, skewness and kurtosis, the time series features in the feature extraction module include but are not limited to the autocorrelation coefficient, partial autocorrelation coefficient and periodic characteristics, the derivative features based on the variation point in the feature extraction module include but are not limited to the data change rate and change amplitude before and after the variation point, and the available features include original water quality indicators (for example: water temperature, pH value, dissolved oxygen and nutrient concentration, etc.), statistical characteristics of original water quality indicators (for example: mean and variance, etc.), variation point information (for example: variation point location, changes in statistical characteristics of data before and after the variation point, etc.), time series characteristics (for example: autocorrelation and cross-correlation of the sequence, etc.) and weather data, etc.
[0039] Step S108, determine the weighted loss function according to the target feature information, and use the weighted loss function, the target feature information and the original sample data to train the preset long short-term memory neural network model to determine the target cyanobacteria outbreak prediction model based on the weighted variation point, wherein the target cyanobacteria outbreak prediction model is used to predict the probability and intensity of cyanobacteria outbreaks and determine the target prediction result. In one embodiment, the weighted loss function can use the weighted mean square error based on the Gaussian function as the weighted loss function, or other functions that can assign different weights to data points according to the distance of the variation point to highlight the importance of the variation point, such as: hyperbolic tangent function and other distance decay functions. The core of the model to be trained is the long short-term memory (LSTM) neural network model. LSTM is good at capturing long-term dependencies in time series data and can well learn the time series pattern of water quality data. It is a powerful tool for solving the time series prediction problem of cyanobacteria outbreak prediction.
[0040] The method for constructing the above-mentioned cyanobacteria outbreak prediction model provided by an embodiment of the present invention gives higher weights to data near the variation point through a weighted loss function, which can effectively improve the model's attention to these data points reflecting major changes in the water environment of the basin, thereby improving the accuracy and robustness of cyanobacteria outbreak prediction.
[0041] With respect to the above step S108, the present invention also provides an implementation method of training a blue algae outbreak prediction model, for details, see (1) to (3) below:
[0042] (1) Determine a weighted loss function according to target feature information: obtain distance information of the variation point, and perform parameter setting processing on a preset weight function according to the distance information of the variation point and the target feature information to determine a target weight function, and then perform function fusion processing on the target weight function and the preset loss function to determine a weighted loss function, wherein the target weight function is used to dynamically adjust the prediction weight of the model according to the importance of the variation point, and the loss function is used to dynamically adjust the model parameters according to the prediction error to optimize the model performance. The weighted loss function is a Gaussian weighted mean square error loss function based on the variation point distance. In one embodiment, the weighted loss function is in the form of a weighted mean square error:
[0043]
[0044] Among them, w i is the weight of the i-th data point, y i and are the true value and predicted value respectively, N is the total number of samples, and the weight w of the i-th data point i It can be calculated by the following formula:
[0045]
[0046] Among them, d iis the distance between the ith data point and the nearest mutation point, and σ controls the decay rate of the weight with distance. It can be seen that data points close to the mutation point will be given a larger weight; through the weighted loss function, the time series prediction model (such as LSTM) can pay more attention to the data near the mutation point during training, thereby improving the model's ability to respond to major changes in the water environment of the basin. On the one hand, the feature vector is used as the input of the LSTM network model, and on the other hand, it is sent to the weighted loss module to calculate the weighted loss function. The weighted loss module calculates a weighted loss function centered on the mutation point based on the distance information of the mutation point. The closer the distance, the greater the weight. The LSTM network model uses the weighted loss function for training, learning the mapping relationship between the feature vector and the blue algae outbreak. The trained LSTM model can output the probability of the occurrence of the blue algae outbreak and the predicted value of the outbreak intensity. The key to the model structure is to enhance the LSTM's attention to the mutation point through the weighted loss function, and improve the prediction ability of the sudden change of the water environment in the basin.
[0047] (2) After combining the preset long short-term memory neural network model with the preset attention mechanism, determining the sequence-to-sequence model, and extracting data from different years from the original sample data as the model training set, the target feature information can be sent to the sequence-to-sequence model and the weighted loss function respectively to determine the root mean square difference between the target model to be trained and the training sets of each model, and the root mean square difference is weighted to the corresponding training set to determine the target training set.
[0048] (3) The target training set is used to train the target model to be trained, and a target cyanobacteria outbreak prediction model based on the weighting of the variation points is determined. In one embodiment, real-time decision support can be provided based on the prediction results to help managers respond to cyanobacteria outbreak events in a timely manner.
[0049] In practical applications, if a prediction model is established that can predict cyanobacteria blooms 3-7 days in advance, taking Taihu Lake as an example, it includes the following steps (1) to (7):
[0050] (1) Data preparation: Daily hydrological and water quality monitoring data from 20 representative monitoring points in Taihu Lake were collected from January 1, 2015 to December 31, 2022, including 17 indicators such as water temperature, pH value, turbidity, chlorophyll a, dissolved oxygen, total nitrogen, and total phosphorus.
[0051] (2) Variation point detection: The BG algorithm was used to detect variation points in the above multidimensional daily data. The algorithm parameters were set as follows: minimum subsequence length was 7 days, significance level was 0.01, and Gaussian kernel parameter σ = 3. The test results showed that 82 significant variation points were found during the data period. These variation points may reflect sudden local environmental changes, such as short-term rain erosion and temporary factory emissions.
[0052] (3) Feature engineering: Construct a feature vector containing the following features: A. Original indicators and sliding statistical features: 17 water quality indicators and their mean, standard deviation, etc. within a 7-day sliding window; B. Mutation point features: the time distance to the nearest mutation point, and the statistical changes of the data 7 days before and after the mutation point; C. Time series features: the autocorrelation and cross-correlation components of each indicator within a 7-day window; D. Weather data: temperature, rainfall, and other data at the monitoring point on the day and in the past 7 days; the final input feature vector dimension is 233.
[0053] (4) Model structure: A sequence-to-sequence (Seq2Seq) model combining a long short-term memory network (LSTM) and an attention mechanism is used. The model input is a sequence of 233-dimensional feature vectors with a sequence length of 7 days and a prediction time step of 3-7 days.
[0054] (5) Weighted loss function: The Gaussian weighted mean square error loss function based on the distance between the mutation points is used:
[0055]
[0056]
[0057] Among them, d i is the time distance between the ith sample and the nearest mutation point. The closer the data is to the mutation point, the greater the weight. The 9 here is actually σ2, where σ is the standard deviation of the Gaussian function, weighted mean square error (WMSE).
[0058] (6) Model training: The data from 2015 to 2019 are used as the training set, and the data from 2020 to 2022 are used as the test set. The weighted RMSE on the training set is 7.8%, and the weighted RMSE on the test set is 8.3%.
[0059] (7) Prediction results: The model was applied to daily data from June 2022 to June 2023 for rolling prediction. The evaluation indicators were the hit rate and false alarm rate of the model for events exceeding the cyanobacteria bloom threshold 3-7 days in advance. The results showed that the model had an average hit rate of 82% and a false alarm rate of 16%, which can accurately predict the time of cyanobacteria bloom. For example, for the three more serious algae blooms on June 28, July 15, and August 9, 2022, the model issued warning signals 4-6 days in advance.
[0060] In another embodiment, if a prediction model is established that can achieve a 3-7 day advance forecast of the blue algae bloom in Chao Lake, the model also includes the following steps (1) to (7):
[0061] (1) Data preparation: Daily water quality monitoring data from 15 main monitoring points in Chaohu Lake were collected from January 1, 2017 to December 31, 2022, including 12 indicators such as water temperature, pH value, turbidity, chlorophyll a, dissolved oxygen, total nitrogen, and total phosphorus.
[0062] (2) Variation point detection: The BG algorithm was used to detect variation points in the multidimensional daily data, with an average run length of 7 days and a detection level of 0.05. The test results showed that there were 96 significant variation points during the data period, reflecting possible short-term environmental change events in the Chaohu Lake Basin, such as temporary sewage discharge and erosion caused by heavy rainfall.
[0063] (3) Feature engineering: Construct a feature vector that includes the following features: A. Original indicators and statistical features: 12 water quality indicators and their mean and standard deviation within a 7-day sliding window; B. Mutation point features: time distance to the nearest mutation point, and statistical changes in data within the 7 days before and after the mutation point; C. Time series features: autocorrelation and cross-correlation components of each indicator within a 7-day window; D. Meteorological data: temperature, rainfall, wind speed, etc. at the monitoring point on the day and in the past 7 days; the final input feature vector dimension is 180 dimensions.
[0064] (4) Model structure: Based on the LSTM network and attention mechanism, a sequence-to-sequence (Seq2Seq) multi-head attention model is constructed, including an encoder and a decoder. The input is a sequence of 180-dimensional feature vectors with a sequence length of 7 days and a prediction time step of 3-7 days.
[0065] (5) Weighted loss function: An exponential weighted mean square error loss function is used:
[0066]
[0067]
[0068] where d i is the time distance between the ith sample and the nearest mutation point. The closer the distance to the mutation point, the greater the weight.
[0069] (6) Model training: The data from 2017 to 2020 are used as the training set, and the data from 2021 to 2022 are used as the test set. The weighted RMSE of the training set is 6.2%, and the weighted RMSE of the test set is 7.1%.
[0070] (7) Prediction results: The model was applied to daily data from May 2022 to May 2023 for rolling prediction. Taking the chlorophyll a concentration exceeding 20 μg / L as the cyanobacteria bloom threshold, the model's warning hit rate and false alarm rate were evaluated 3-7 days in advance. The results showed that the model had an average hit rate of 79% and a false alarm rate of 20%. For example, for the three moderately severe algae bloom events on July 12, August 28, and September 22, 2022, the model successfully issued warnings 4-6 days in advance.
[0071] To facilitate understanding of this embodiment, a blue algae outbreak prediction system disclosed in an embodiment of the present invention is described in detail. Figure 2 The schematic diagram of the structure of a blue algae outbreak prediction system is shown, the system includes: a data reading and preprocessing module, a variation detection module, a feature extraction module, a time series prediction model training module and a prediction model application module, specifically:
[0072] The data reading and preprocessing module is used to obtain the original sample data and preprocess the original sample data to obtain the target sample data after noise is removed.
[0073] The variation detection module is used to perform variation point identification processing on the target sample data through the preset BG algorithm to identify the variation points in the target sample data, wherein the preset BG algorithm is a heuristic segmentation algorithm, and the variation points are used to respond to sudden environmental changes. Specifically, the BG algorithm for variation detection, namely the Bernaola Galvan segmentation algorithm, is a heuristic algorithm for detecting mutations in non-stationary time series. It is suitable for processing sequence data containing trend, seasonality or periodicity components, such as climate data. The basic principle of the BG algorithm is to divide a time series into two subsequences through a certain point, and then calculate the mean and standard deviation of the two subsequences, and use the t-test statistic to evaluate whether the segmentation point is a mutation point.
[0074] In one embodiment, the variation detection module includes: a BG algorithm parameter setting submodule and a BG algorithm application variation point identification submodule, wherein the BG algorithm parameter setting submodule is used to perform data characteristic analysis on the target sample data, determine the data characteristics corresponding to the target sample data, and adjust the parameters of the BG algorithm according to the data characteristics to obtain the adjusted target BG algorithm; the BG algorithm application variation point identification submodule is used to use the target BG algorithm to perform variation point identification on the target sample data to determine the variation points in the target sample data. In addition to the BG algorithm, other algorithms that can effectively detect variation points from multidimensional time series can also be used, such as Mann-Kendall mutation point detection, Pettitt mutation point detection, Buishand U test mutation point detection, and Standard Normal HomogeneityTest mutation point detection.
[0075] The feature extraction module is used to extract target feature information from the target sample data corresponding to the variation point. In one embodiment, the feature extraction module includes: a first feature selection submodule and a second feature selection submodule; wherein the first feature selection submodule is used to select data segments corresponding to the variation point from the target sample data, and perform feature extraction processing on the data segments to determine the statistical features, time series features and derived features based on the variation point related to the growth of cyanobacteria; the second feature selection submodule is used to extract target feature information for model training from the statistical features, time series features and derived features according to a preset feature selection range. That is to say, the feature extraction module can obtain the statistical features, time series features and derived features based on the variation point that are closely related to the growth of cyanobacteria based on the data segmentation of the variation point, and the feature selection submodule can select features that are useful for the prediction model.
[0076] The time series prediction model training module is used to determine the weighted loss function according to the target feature information, and use the weighted loss function and the original sample data to train the preset long short-term memory neural network model to determine the target cyanobacteria outbreak prediction model based on the weighted mutation point. That is to say, the time series prediction model training module can define the loss function based on the distance weight function of the mutation point, and perform model training and evaluation optimization.
[0077] The prediction model application module is used to predict the probability and intensity of cyanobacteria outbreaks through the target cyanobacteria outbreak prediction model to determine the target prediction result. That is to say, the prediction model application module can predict the probability of cyanobacteria outbreaks and the intensity of cyanobacteria outbreaks, thereby providing decision support and providing a basis for lake management.
[0078] In practical applications, Figure 3 A rainfall time series diagram is shown in Figure 4 A time series diagram of chemical oxygen content and Figure 5 The time series graph of ammonia content shown in the figure shows the time series graphs of three key indicators of the lake (rainfall, COD and NH3) from June 1, 2023 to June 30, 2024. Among them, Chemical Oxygen Demand (COD) is the amount of reducing substances that need to be oxidized in water samples measured by chemical methods. In wastewater, wastewater treatment plant effluent and contaminated water, the oxygen equivalent of substances (generally organic matter) that can be oxidized by strong oxidants. In the time series of rainfall, a variation point was detected, which occurred on July 15, 2023. In the time series of COD, a variation point was detected, which occurred on August 20, 2024. In the time series of NH3, two variation points were detected, which occurred on August 20, 2023 and November 5, 2023, respectively. These variation points may reflect major changes in the water environment of the lake basin, such as industrial emissions, climate change, etc., and their relationship with cyanobacterial outbreaks needs to be further analyzed. The time series graph intuitively shows the trend of water quality data changes and the time position of the detected variation points, which helps to understand the background and necessity of constructing a weighted prediction model in the present invention.
[0079] In summary, the present invention can make full use of lake hydrological and water quality time series data, capture the influence of variation points in the data, and improve the model's sensitivity to major changes in the basin water environment caused by human factors through the variation point weighted loss function, thereby improving the prediction accuracy. It also adopts time series prediction models, such as LSTM, to effectively capture the temporal characteristics of the data, quantify the influence of human factors, and improve the prediction ability of the model, thereby more accurately predicting the risk of cyanobacteria outbreaks, providing a decision-making basis for lake management, and avoiding the harm caused by cyanobacteria outbreaks.
[0080] In addition, the detected variation point information can be used as a feature, and combined with other features (such as water quality indicators, statistical characteristics, time series characteristics, etc.) to construct a feature vector, which is input into the time series prediction model. The weighted loss function of the variation point distance is set, which can make the model pay more attention to the data near the variation point during training.
[0081] An embodiment of the present invention provides a server. Specifically, the server includes a processor and a storage device. The storage device stores a computer program, and when the computer program is executed by the processor, it executes the method described in any one of the above-mentioned embodiments.
[0082] Figure 6A structural diagram of a server provided in an embodiment of the present invention, the server 100 includes: a processor 60, a memory 61, a bus 62 and a communication interface 63, wherein the processor 60, the communication interface 63 and the memory 61 are connected via the bus 62; the processor 60 is used to execute an executable module stored in the memory 61, such as a computer program.
[0083] The memory 61 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 63 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0084] The bus 62 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0085] Among them, the memory 61 is used to store programs, and the processor 60 executes the program after receiving the execution instruction. The method executed by the device for flow process definition disclosed in any embodiment of the above-mentioned embodiment of the present invention can be applied to the processor 60 or implemented by the processor 60.
[0086] The processor 60 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 60. The above processor 60 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present invention can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 61, and the processor 60 reads the information in the memory 61 and completes the steps of the above method in combination with its hardware.
[0087] The computer program product of the readable storage medium provided in the embodiment of the present invention includes a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be referred to the previous method embodiments, which will not be repeated here.
[0088] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0089] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for constructing a blue algae outbreak prediction model, characterized in that: The method comprises: Acquire original sample data, and pre-process the original sample data to obtain target sample data after noise removal, wherein the original sample data includes: key indicators of lake cyanobacteria outbreak, and the key indicators include: lake rainfall, chemical oxygen content and ammonia content; Using a preset BG algorithm, performing variation point identification processing on the target sample data to determine variation points in the target sample data, wherein the preset BG algorithm is a heuristic segmentation algorithm, and the variation points are used to reflect sudden environmental changes; Extracting target feature information from the target sample data corresponding to the variation point, wherein the target feature information includes variation point information; A weighted loss function is determined according to the target feature information, and a preset long short-term memory neural network model is trained using the weighted loss function, the target feature information and the original sample data to determine a target cyanobacteria outbreak prediction model based on weighted variation points, wherein the target cyanobacteria outbreak prediction model is used to predict the probability and intensity of cyanobacteria outbreaks and determine a target prediction result.
2. The method for constructing a blue algae outbreak prediction model according to claim 1, characterized in that: The step of using a preset BG algorithm to perform variation point identification processing on the target sample data to determine the variation points in the target sample data includes: Divide the original sample data into data segments of preset lengths, and use a preset BG algorithm to perform small sample size detection processing on the time series corresponding to each data segment in the original sample data, and determine the t-test statistic corresponding to each data point in the time series, wherein the t-test statistic is used to reflect the difference between data points; The data point with the largest t-test statistic value and greater than a preset statistic threshold is determined as the variation point.
3. The method for constructing a blue algae outbreak prediction model according to claim 1, characterized in that: The step of extracting target feature information from the target sample data corresponding to the variation point comprises: Selecting the data segment corresponding to the variation point from the target sample data; Performing feature extraction processing on the data segments to determine statistical features, time series features, and derivative features based on variation points related to the growth of cyanobacteria; According to a preset feature selection range, feature screening processing is performed on the statistical features, the time series features and the derived features to determine target feature information for model training.
4. The method for constructing a blue algae outbreak prediction model according to claim 1, characterized in that: The step of determining a weighted loss function according to the target feature information comprises: Acquire the distance information of the variation point, and perform parameter setting processing on a preset weight function according to the distance information of the variation point and the target feature information to determine a target weight function, wherein the target weight function is used to dynamically adjust the prediction weight of the model according to the importance of the variation point; The target weight function and the preset loss function are subjected to function fusion processing to determine the weighted loss function, wherein the loss function is used to dynamically adjust the model parameters according to the prediction error to optimize the model performance, and the weighted loss function is a Gaussian weighted mean square error loss function based on the variation point distance.
5. The method for constructing a blue algae outbreak prediction model according to claim 1, characterized in that: The step of using the weighted loss function, the target feature information and the original sample data to train a preset long short-term memory neural network model to determine a target blue algae outbreak prediction model based on a weighted variation point includes: Combining the preset long short-term memory neural network model with the preset attention mechanism to determine a sequence-to-sequence model, and extracting data from different years from the original sample data as a model training set; Sending the target feature information to the sequence-to-sequence model and the weighted loss function respectively, determining the root mean square difference corresponding to the target model to be trained and each model training set, and weighting the root mean square difference to the corresponding training set to determine the target training set; The target training set is used to perform model training on the target model to be trained, and the target cyanobacteria outbreak prediction model based on the weighting of variation points is determined.
6. A blue algae outbreak prediction system, characterized in that: The system includes: a data reading and preprocessing module, a variation detection module, a feature extraction module, a time series prediction model training module and a prediction model application module; wherein, The data reading and preprocessing module is used to obtain original sample data and preprocess the original sample data to obtain target sample data after noise is removed; The variation detection module is used to perform variation point identification processing on the target sample data through a preset BG algorithm to identify variation points in the target sample data, wherein the preset BG algorithm is a heuristic segmentation algorithm, and the variation points are used to reflect sudden environmental changes; The feature extraction module is used to extract target feature information from the target sample data corresponding to the variation point; The time series prediction model training module is used to determine a weighted loss function according to the target feature information, and use the weighted loss function and the original sample data to perform model training on a preset long short-term memory neural network model to determine a target cyanobacteria outbreak prediction model based on the weighting of the variation points; The prediction model application module is used to predict the probability and intensity of cyanobacteria outbreak through the target cyanobacteria outbreak prediction model to determine the target prediction result.
7. The blue algae outbreak prediction system according to claim 6, characterized in that: The variation detection module includes: a BG algorithm parameter setting submodule; wherein, The BG algorithm parameter setting submodule is used to perform data characteristic analysis on the target sample data, determine the data characteristics corresponding to the target sample data, and perform parameter adjustment on the parameters of the BG algorithm according to the data characteristics to obtain an adjusted target BG algorithm.
8. The blue algae outbreak prediction system according to claim 7, characterized in that: The variation detection module also includes: a variation point identification submodule using the BG algorithm; wherein, The submodule for identifying variation points by applying the BG algorithm is used to perform variation point identification processing on the target sample data by using the target BG algorithm to determine variation points in the target sample data.
9. The blue algae outbreak prediction system according to claim 6, characterized in that: The feature extraction module includes: a first feature selection submodule and a second feature selection submodule; wherein, The first feature selection submodule is used to select data segments corresponding to the variation points from the target sample data, and perform feature extraction processing on the data segments to determine statistical features, time series features and derivative features based on variation points related to the growth of cyanobacteria; The second feature selection submodule is used to extract target feature information for model training from the statistical features, the time series features and the derived features according to a preset feature selection range.
10. A server, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 5.
Citation Information
Cited By
Artificial intelligence-based enteromorpha prevention and control early warning method and system
CN119516750A
Cyanobacterial bloom monitoring method based on multi-modal data fusion and deep learning
CN120411797A
Basin cyanobacterial bloom evolution forecasting method and system based on improved PredRNN
CN121724229A
