Red tide early warning method based on multi-algorithm fusion of buoy water quality data
Patent Information
- Application Number
- CN202611302499.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-09-25
AI Technical Summary
[0002]赤潮是近岸海域频发的生态灾害,其暴发与水质参数的时序波动及多因子耦合作用密切相关,严重威胁海洋生态环境与水产养殖安全,而浮标监测作为获取高频率、长时序水质数据的重要手段,能够实时采集水温、盐度、溶解氧、pH、叶绿素a及营养盐等多维参数,可为赤潮预警提供基础数据支撑,然而,近岸海域水质动态复杂,监测数据呈现强非线性、高噪声及样本不均衡等特征,传统统计方法在处理此类复杂时序数据时存在局限性
1、该一种基于浮标水质数据多算法融合的赤潮预警方法,通过构建多算法融合的时序预测-风险判别两段式协同架构,前端完成水质参数的精准预测,后端基于预测结果进行赤潮暴发风险判别,实现从原始监测数据到预警结论的全流程自动化处理,大幅提升了赤潮预警的时效性与一体化程度。
Smart Images

Figure CN122818263A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of marine environmental monitoring technology, and in particular to a red tide early warning method based on multi-algorithm fusion of buoy water quality data. Background Technology
[0002] Red tides are a frequent ecological disaster in nearshore waters. Their outbreaks are closely related to the temporal fluctuations of water quality parameters and the coupling effects of multiple factors, seriously threatening the marine ecological environment and the safety of aquaculture. Buoy monitoring, as an important means of obtaining high-frequency, long-term water quality data, can collect multi-dimensional parameters such as water temperature, salinity, dissolved oxygen, pH, chlorophyll a, and nutrients in real time, which can provide basic data support for red tide early warning. However, the dynamics of water quality in nearshore waters are complex, and the monitoring data exhibits characteristics such as strong nonlinearity, high noise, and sample imbalance. Traditional statistical methods have limitations in processing such complex time-series data.
[0003] In existing technologies, buoy water quality data exhibits high-dimensional nonlinearity and strong noise characteristics. A single model cannot fully exploit the implicit correlations between multiple parameters such as chlorophyll a, water temperature, and dissolved oxygen. This makes it easy for key red tide precursor signals to be overwhelmed by redundant information, resulting in insufficient accuracy in water quality parameter prediction. Furthermore, even after the predicted water quality parameters are obtained, high-dimensional time-series features still have redundant interference. The uneven distribution of red tide samples makes it easy to miss weak precursor signals when directly performing risk assessment. The lack of a basis for judging the effectiveness of features affects the reliability of early warning. In addition, after feature purification and discrimination optimization, the obtained discrimination results are only probability values, lacking a graded threshold judgment mechanism. It is impossible to directly output a clear conclusion on red tide outbreak and its risk level, which is difficult to meet the needs of actual red tide prevention and control decisions for intuitive and operable early warning results. Therefore, this paper proposes a red tide early warning method based on multi-algorithm fusion of buoy water quality data to solve the above-mentioned problems. Summary of the Invention
[0004] To overcome the shortcomings of the prior art, the present invention provides a red tide early warning method based on multi-algorithm fusion of buoy water quality data, which can effectively solve the problems involved in the prior art.
[0005] The objective of this invention can be achieved through the following technical solution: This invention provides a red tide early warning method based on multi-algorithm fusion of buoy water quality data, comprising the following steps: Step 1: Collect buoy water quality data from the target sea area, including water temperature, salinity, dissolved oxygen, pH, chlorophyll a, and turbidity. Perform preprocessing operations such as outlier removal, missing value imputation, and normalization to construct a standardized initial feature set. Remove abnormal data caused by sensor failure, imput missing time periods to ensure the continuity and integrity of the time series, and eliminate dimensional differences so that all parameters can participate in subsequent modeling on a unified scale. Step 2: LightGBM is used to train the preprocessed buoy water quality data. Histogram optimization and one-sided gradient sampling are used to screen key water quality factors in the buoy water quality data, remove redundant noise features, output a simplified feature set, quickly screen out the core water quality factors with the strongest correlation to red tide outbreaks, significantly compress the feature dimension, and reduce the computational complexity of subsequent time series modeling. Step 3: Input the screened key water quality factors into the LSTM network, and capture the long-term and short-term time-series dependencies through the forget gate, input gate and output gate to predict the future change trends of key parameters such as chlorophyll a and dissolved oxygen, output high-precision water quality prediction features, accurately depict the dynamic evolution of water quality parameters over time, and improve the accuracy of predicting the future change trends of key parameters. Step 4: Input the water quality prediction features into the hybrid discrimination module composed of random forest and XGBoost. The random forest evaluates the feature gain based on the Gini index. If the feature gain is lower than the set gain threshold, it is marked as an invalid feature and removed. The high-contribution core feature subset is retained, redundant interference information in the prediction features is removed, and the core features that contribute most significantly to the red tide discrimination are retained to improve the effectiveness of subsequent discrimination. Step 5: Input the purified core feature subset into XGBoost, use a weighted loss function to strengthen the focus on positive red tide samples, improve the iterative fitting residuals through serial gradient, output the discrimination probability value of red tide outbreak, enhance the model's sensitivity to the identification of scarce red tide outbreak samples, and effectively reduce the risk of missing the detection of weak precursor signals. Step 6: Based on the optimal cutoff point of ROC and the polarization characteristics of probability distribution, set three warning thresholds of low, medium and high, map the discrimination probability to the corresponding risk level, generate a clear conclusion on red tide outbreak and output the warning result, transform the fuzzy probability value into a clear graded risk conclusion, and provide an intuitive and operable judgment basis for prevention and control decision-making.
[0006] Preferably, in step 1, the process of constructing the standardized initial feature set is as follows: Collect continuous time-series buoy water quality data from buoy monitoring in the target sea area, identify and remove outlier values caused by sensor failure or environmental disturbance based on the physical reasonable threshold range of each parameter, use linear interpolation to fill in the missing time periods, ensure the integrity and continuity of time-series data, identify and remove abnormal observation values, and reasonably fill in the missing time periods; For the water temperature, salinity, dissolved oxygen, pH, chlorophyll a and turbidity parameters after filling, the maximum and minimum values of each parameter in the whole time series are calculated. The minimum-maximum normalization formula is applied to linearly map the values of each parameter to the [0,1] interval, eliminate the scale difference between different dimensions, and unify all water quality parameters to the same numerical scale, which is convenient for subsequent model training. The normalized parameters are arranged in time sequence and combined to form a standardized initial feature matrix. Each time step corresponds to a multi-dimensional feature vector containing all six water quality parameters. This results in the construction of a standardized initial feature set, forming a standardized data foundation with complete time sequence and unified dimensions, providing standardized input for subsequent feature selection.
[0007] Preferably, in step 2, the process of screening key water quality factors in the buoy water quality data is as follows: The standardized initial feature set is divided into training and validation sets according to time sequence. A LightGBM model (lightweight gradient booster) with decision tree as the base learner is constructed. The histogram bin number is set to 32, the learning rate is 0.05, the tree depth is 6, and the number of iterations is 200. Gradient boosting iterative training is performed on the training set. Reasonable data partitioning ensures the effectiveness of model training, and appropriate parameters are configured to ensure the stability and efficiency of the iteration process. During training, a one-sided gradient sampling mechanism is adopted. All samples are sorted in descending order according to the absolute value of the gradient. The top 20% of large gradient samples are retained, and 10% of the remaining small gradient samples are randomly sampled and weighted to compensate. These samples are combined to form a simplified training subset, which reduces the amount of computation while maintaining unbiased statistical properties. High-error samples are focused on participating in training, which greatly reduces the amount of training data while maintaining the consistency of statistical distribution. After iteration, the feature importance scores of each water quality parameter are output. Several items among water temperature, salinity, dissolved oxygen, pH, chlorophyll a and turbidity with scores greater than 0.05 are selected as key water quality factors. Redundant features with scores below the threshold are removed to form a simplified feature set. The contribution of each water quality parameter to red tide prediction is quantitatively evaluated, and features with weak contributions are removed to reduce interference in subsequent modeling.
[0008] Preferably, step 2 further includes: The LightGBM model employs a leaf-first growth strategy in each iteration, selecting the node with the largest gain among all current leaf nodes for splitting. This achieves the lowest training error with the fewest number of tree nodes. At the same time, it sets constraints on the minimum number of samples per leaf node and the maximum depth of the tree to suppress the risk of model overfitting. It prioritizes splitting the node with the largest gain to quickly reduce training error with fewer nodes, while constraining the depth and number of samples to prevent overfitting. For high-dimensional sparse features that still exist after unilateral gradient sampling, a mutual exclusion feature bundling mechanism is adopted. The number of samples with non-zero values among features is counted to construct a conflict graph. Features with less than a set conflict threshold are greedily grouped into the same bundle. Feature values are merged by adding an offset to compress the feature dimension, effectively compressing high-dimensional sparse features, reducing feature dimension, and reducing storage and computational overhead. Histograms are constructed for each group of features after bundling. The gradient sum and sample number within each bin are calculated. Only the bin boundaries need to be traversed to complete the split point search. The histogram of the child node is quickly obtained by using the difference of the parent node histogram. The simplified feature set containing key water quality factors is output after filtering, which accelerates the split point search process, reduces the calculation time, and outputs a simplified feature set containing key factors.
[0009] Preferably, in step 3, the process of outputting high-precision water quality prediction features is as follows: The key water quality factors output by the LightGBM model are rearranged in time sequence to construct a three-dimensional input tensor with time step. This tensor is then input into a pre-constructed two-layer LSTM network, with each layer containing 64 LSTM neurons. The forget gate is used to calculate the proportion of memory information retained from the previous time step, and to decide whether to discard or retain non-critical information from the historical state. The forget gate selectively discards non-critical historical information and retains important long-term dependent features, thereby improving the accuracy of long-term time series prediction. Candidate memory cells generated by the input gate and tanh activation function combine the key water quality factor information input at the current moment with the hidden state at the previous moment to update the memory cell state, realize the selective writing of newly added information at the current moment, and form an updated memory state containing long-short-term dependencies. The input gate selectively writes the effective information at the current moment, updates the memory state, and integrates long-short-term dependencies. The output gate calculates the weight of the influence of the current memory state on the output. The updated memory unit is scaled by the tanh activation function to generate the current hidden state. The predicted values of chlorophyll a and dissolved oxygen for the future time are output through linear mapping by the fully connected layer, thus completing the high-precision water quality prediction feature output. The output gate filters the effective information at the current time to generate accurate predicted values of chlorophyll a and dissolved oxygen, thus completing the high-precision prediction.
[0010] Preferably, in step 4, the process of retaining the subset of high-contribution core features is as follows: Using the water quality prediction features output by LSTM as input, a random forest model containing multiple decision trees is constructed. Each decision tree extracts a subset of samples with replacement from the original training set based on the Bagging sampling strategy, and randomly selects some features for candidate splits when splitting at each node to enhance the model's generalization ability. Multi-tree ensemble reduces the risk of overfitting of a single tree, and random sampling and feature selection enhance the model's generalization performance. For each split node of each decision tree, calculate the Gini index of the node before splitting and the Gini index of the two child nodes after splitting. Subtract the weighted sum of the Gini indices of the two child nodes from the Gini index before splitting to obtain the split gain value of each candidate feature at that node. The larger the gain, the higher the contribution of the feature to red tide discrimination. The Gini gain quantitatively measures the discrimination ability of each feature and accurately assesses the strength of each feature's contribution to red tide classification. The split gain values of all nodes in each decision tree for the same feature are weighted and summed according to the number of node samples. The contributions of all decision trees are then accumulated. The accumulated result is normalized and used as the final importance score of the feature. Invalid features with scores lower than the set gain threshold are removed, and a subset of high-contribution core features is retained. The importance of features is comprehensively evaluated by integrating information from multiple trees, and invalid and redundant features are removed, while a subset of high-contribution core features is retained.
[0011] Preferably, step 4 further includes: In the random forest model, each decision tree independently calculates the Gini gain of each candidate feature at each internal split node. The ratio of the number of node samples to the total number of samples is used as the weight to weight the gain of each node, eliminating the bias of uneven sample distribution on feature evaluation. The weighting of the number of node samples eliminates the evaluation bias caused by sample imbalance, making the evaluation of feature importance more objective and accurate. The weighted gains of the same feature in all decision trees are accumulated and normalized to obtain the comprehensive importance score of each water quality prediction feature. The gain threshold is dynamically set according to the score distribution characteristics. Features with scores below the gain threshold are marked as redundant interference features and removed. The feature contribution is comprehensively evaluated by integrating multi-tree information, and the threshold is dynamically set to accurately identify and remove redundant interference features. The remaining high-scoring core features after removal are sorted in descending order of contribution. The top few features whose cumulative contribution reaches a preset proportion are selected and combined to form a purified subset of core features. This ensures that the retained features have a clear gain contribution to red tide discrimination and minimizes the redundancy between features. The core features are sorted by contribution to retain discrimination information and reduce redundancy between features, thereby improving model efficiency.
[0012] Preferably, in step 5, the process of outputting the probability value for red tide outbreak is as follows: The core feature subset after random forest filtering and purification is input into the XGBoost model to construct a serial gradient boosting framework with decision tree as the base learner. The basic prediction value is initialized, and regularization parameters are set to constrain the tree complexity and leaf node weights to prevent model overfitting. The prediction bias is corrected layer by layer through serial iteration. The regularization constraint controls the model complexity and improves the generalization ability. In each iteration, the first and second gradients of the loss function with respect to the current predicted value are calculated for each sample. The weight coefficient of positive samples is set in the loss function to enhance the loss contribution of red tide outbreak samples. This guides the model to focus on fitting a few positive samples during training, alleviating the problem of red tide sample imbalance. The weight of positive samples increases the weight of minority samples, effectively alleviating the problem of missed detection caused by sample imbalance. Based on the gradient values of each sample, a new decision tree fitting residual is constructed. The gain of each candidate split point is calculated and the node with the largest gain is selected for splitting. The prediction results of the decision tree generated by multiple iterations are accumulated and mapped to the [0, 1] interval through the Sigmoid function. The discrimination probability value of red tide outbreak is output. The prediction residual is gradually reduced by multiple iterations. The probability mapping outputs the discrimination probability value in the interval from 0 to 1, which is convenient for subsequent classification and determination.
[0013] Preferably, in step 6, the process of setting the low, medium, and high warning thresholds is as follows: Based on the true labels of the validation set samples and the discriminant probability values output by the XGBoost model, the subject operating characteristic curve is plotted, the true positive rate and false positive rate corresponding to each cutoff point are calculated, and the point corresponding to the maximum value of the Youden index is selected as the optimal cutoff point to distinguish between the two states of red tide outbreak and non-outbreak. Maximizing the Youden index ensures the balance between the true positive rate and the false positive rate, and accurately determines the optimal probability judgment boundary for red tide outbreak. The overall distribution of the discrimination probability of the statistical validation set samples is used to identify the polarization characteristics of the samples concentrated in the low probability interval and the high probability interval based on the frequency distribution histogram of probability values. The upper quartile of the low probability interval and the lower quartile of the high probability interval are calculated as auxiliary reference boundaries. The probability distribution histogram clearly shows the sample clustering characteristics, and the upper and lower quartiles help to define reasonable boundary intervals. Combining the optimal cutoff point with the polarization of probability distribution, three levels of warning threshold boundaries are set: low warning threshold, medium warning threshold, and high warning threshold. The low warning threshold, which is below the optimal cutoff point, is used to exclude the non-outbreak state. The high warning threshold, which is above the optimal cutoff point, is used to confirm the outbreak state. The medium warning threshold, which is between the two, serves as a transitional risk zone. Thus, the threshold system is constructed, and the three levels of thresholds are used to classify risk states: the low threshold excludes the non-outbreak state, the high threshold confirms the outbreak state, and the medium threshold marks the transitional risk.
[0014] Preferably, in step 6, the process of generating a clear conclusion about a red tide outbreak and outputting an early warning result is as follows: The probability value of red tide outbreak output by the XGBoost model is compared with the set low, medium and high warning thresholds one by one. If the probability value is lower than the low warning threshold, it is judged as no risk level; if it is between the low and medium warning thresholds, it is judged as low risk level; if it is between the medium and high warning thresholds, it is judged as medium risk level; and if it is higher than the high warning threshold, it is judged as high risk level. The probability value is compared with the three thresholds level by level to clearly divide the four risk levels of no, low, medium and high, and the judgment criteria are clear. Based on the determined risk level, a corresponding red tide outbreak conclusion is generated. For no-risk and low-risk levels, a no-outbreak conclusion and routine monitoring recommendations are output. For medium-risk levels, a potential outbreak conclusion and enhanced monitoring warnings are output. For high-risk levels, a confirmed outbreak conclusion and emergency response recommendations are output. Each risk level corresponds to a clear outbreak conclusion and graded response recommendations, providing differentiated handling guidelines for different risk scenarios. The risk level assessment results, corresponding outbreak conclusions, and recommendations are packaged into a structured early warning output format and displayed through a visual interface or pushed to the red tide prevention and control decision-making platform via a data interface. This provides clear and actionable early warning results to support red tide prevention and control in nearshore waters. The structured packaging ensures that the information is complete and analyzable, and the dual-channel output of visual display and platform push supports prevention and control decisions.
[0015] Compared with the prior art, the beneficial effects of the present invention are: 1. This red tide early warning method based on multi-algorithm fusion of buoy water quality data constructs a two-stage collaborative architecture of time-series prediction and risk assessment, which completes the accurate prediction of water quality parameters at the front end and assesses the risk of red tide outbreaks at the back end based on the prediction results. This achieves fully automated processing from raw monitoring data to early warning conclusions, greatly improving the timeliness and integration of red tide early warning.
[0016] 2. This red tide early warning method based on multi-algorithm fusion of buoy water quality data uses a gradient boosting algorithm in the feature extraction stage to perform nonlinear correlation mining and importance assessment on high-dimensional water quality data. It can accurately screen the core water quality factors with the strongest correlation to red tide outbreaks, effectively eliminate redundant information and noise interference, and enable the subsequent time series prediction model to focus on key influencing parameters, significantly improving the accuracy of water quality parameter prediction and the computational efficiency of the model.
[0017] 3. This red tide early warning method based on multi-algorithm fusion of buoy water quality data adopts a gating mechanism of long short-term memory network in the time series prediction stage. By selectively forgetting historical information and selectively writing new information, it can fully capture the fluctuation pattern and sudden change trend of water quality data in the long period and effectively perceive the weak precursor signals in the early stage of red tide. Attached Figure Description
[0018] Figure 1 This is a schematic diagram illustrating the workflow of a red tide early warning method based on multi-algorithm fusion of buoy water quality data according to the present invention. Figure 2 This is a schematic diagram of the process of a red tide early warning method based on multi-algorithm fusion of buoy water quality data according to the present invention; Figure 3 This is a LightGBM_LSTM structure diagram of a red tide early warning method based on multi-algorithm fusion of buoy water quality data according to the present invention. Detailed Implementation
[0019] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.
[0020] Example 1, please refer to Figures 1 to 3 This invention provides a technical solution: a red tide early warning method based on multi-algorithm fusion of buoy water quality data, comprising the following steps: Step 1: Collect buoy water quality data from the target sea area, including water temperature, salinity, dissolved oxygen, pH, chlorophyll a, and turbidity. Perform preprocessing operations such as outlier removal, missing value imputation, and normalization to construct a standardized initial feature set. Remove abnormal data caused by sensor malfunctions, imput missing time periods to ensure temporal continuity and completeness, and eliminate dimensional differences so that all parameters participate in subsequent modeling at a unified scale. Collect continuous time-series buoy water quality data from the target sea area. Identify and remove outliers caused by sensor malfunctions or environmental disturbances based on the physically reasonable threshold range of each parameter. Use linear interpolation to imput missing time periods to ensure the integrity and continuity of the time-series data. Identify and remove abnormal observations. The measured values were used to fill in the missing time periods. For the water temperature, salinity, dissolved oxygen, pH, chlorophyll a, and turbidity parameters after filling in the missing time periods, the maximum and minimum values of each parameter were calculated in the entire time series. The minimum-maximum normalization formula was applied to linearly map the values of each parameter to the [0, 1] interval to eliminate the scale difference between different dimensions and unify all water quality parameters to the same numerical scale, which is convenient for subsequent model training. The normalized parameters were arranged in time series and combined to form a standardized initial feature matrix. Each time point corresponds to a multi-dimensional feature vector containing all six water quality parameters. The standardized initial feature set was obtained to form a standardized data foundation with complete time series and unified dimensions, providing standardized input for subsequent feature selection. It should be noted that when performing outlier removal, the physically reasonable threshold ranges for water temperature were set to -2℃ to 35℃, salinity to 0‰ to 45‰, dissolved oxygen to 0 mg / L to 20 mg / L, pH to 6.0 to 9.5, chlorophyll a to 0 μg / L to 200 μg / L, and turbidity to 0 NTU to 1000 NTU. Observations exceeding these threshold ranges were identified as outliers and removed. For data gaps resulting from removal and missing time periods in the original data, linear interpolation was used to fill in the gaps using valid observations from adjacent time periods. Before proceeding, it must be confirmed that all data from the preceding and following time periods are valid and the time interval does not exceed 30 minutes. After anomaly removal and missing data filling are completed, the continuity of each parameter's time series data is checked to see if there are any data segments with consecutive missing values exceeding 6 hours. If so, these data segments are marked as invalid and logged. For each water quality parameter, the global maximum and global minimum values within the entire time series acquisition interval are extracted as normalized baseline values. The normalized baseline for water temperature parameter is determined based on the annual water temperature fluctuation range of the actual monitored sea area, and the baseline for salinity parameter is determined based on the historical extreme values of salinity changes in the sea area. Dissolved oxygen, pH, chlorophyll a, and turbidity parameters are determined based on their respective values within the entire time series. The measured extreme values within the interval are determined; for the original observed values of each parameter at each time point, the global minimum value is used as the lower bound and the global maximum value as the upper bound, and they are linearly mapped to the numerical interval [0, 1]. After mapping, the dimensions of each parameter are uniformly eliminated, and all water quality parameters are converted into dimensionless relative values; after normalization, the mapping results of each parameter are checked to ensure that all mapped values fall within the closed interval [0, 1]. For cases where the mapped values exceed the interval due to data anomalies, the excess values are truncated to the interval endpoint value 0 or 1, and the truncation operation log is recorded for future reference; the normalized data of all time points are arranged and combined in chronological order, and each sampling time point is... For each independent time step, the six normalized parameters of water temperature, salinity, dissolved oxygen, pH, chlorophyll a, and turbidity are combined into a six-dimensional feature vector in a fixed order. The six-dimensional feature vectors of all times are arranged in ascending order according to the sampling timestamp to form a standardized initial feature matrix. The row index of the matrix corresponds to the sampling time series, and the column index of the matrix corresponds to the six water quality parameter types. After the construction is completed, the integrity of the feature matrix is checked to confirm that the number of rows in the matrix is consistent with the total number of time series data records and the number of columns is 6. The absence of null values or non-numerical outliers in each six-dimensional feature vector is also checked to ensure that each element in the feature matrix is a valid value in the interval [0, 1].
[0021] Step 2: LightGBM is used to train the preprocessed buoy water quality data. Histogram optimization and one-sided gradient sampling are used to screen key water quality factors in the buoy water quality data, remove redundant noise features, and output a simplified feature set. This quickly identifies the core water quality factors most strongly correlated with red tide outbreaks, significantly compressing the feature dimensions and reducing the computational complexity of subsequent time-series modeling. The standardized initial feature set is divided into training and validation sets according to time series. A LightGBM model (Lightweight Gradient Boosting Machine) with a decision tree as the base learner is constructed. The histogram bin count is set to 32, the learning rate to 0.05, the tree depth to 6, and the number of iterations to 200. Gradient boosting iterative training is performed on the training set. Reasonable data partitioning ensures the effectiveness of model training, and appropriate parameters are configured to ensure the success of the iteration process. Stable and efficient, the training process employs a one-sided gradient sampling mechanism, sorting all samples in descending order by absolute gradient value, retaining the top 20% of samples with large gradients, and randomly sampling 10% of the remaining samples with small gradients and assigning them weight compensation. This combination forms a simplified training subset, reducing computational load while maintaining unbiased statistical characteristics. It focuses on high-error samples for training, significantly reducing the amount of training data while maintaining the consistency of statistical distribution. After iteration, it outputs the feature importance scores of each water quality parameter, selecting several items among water temperature, salinity, dissolved oxygen, pH, chlorophyll a, and turbidity with scores greater than 0.05 as key water quality factors, and removing redundant features with scores below the threshold to form a simplified feature set. This quantitatively evaluates the contribution of each water quality parameter to red tide prediction, removes features with weak contributions, and reduces interference in subsequent modeling. It should be noted that the LightGBM model training and feature selection process is based on the actual distribution characteristics of red tide monitoring data in the target sea area for parameter adaptation. The ratio of training set to validation set is determined according to the sampling frequency and total sample size of the time series data, ensuring that the training set covers the complete seasonal variation cycle and red tide outbreak event samples. The validation set is used to monitor the overfitting trend during the model iteration process. The number of bins in the histogram is set to 32. The learning rate is set to 0.05 to ensure stable convergence of the model during 200 iterations and to avoid loss function oscillations due to excessive step size. The tree depth is set to 6 to limit the complexity of a single decision tree and prevent a single tree from overfitting the noise in the training data. The number of iterations of 200 was determined through preliminary experiments. The parameter configuration of the one-sided gradient sampling mechanism is determined based on the distribution ratio of positive and negative samples and the noise level in the red tide monitoring data. The top 20% of the large gradient samples are retained to ensure that all high-error samples that contribute the most to model improvement participate in training. 10% of the remaining small gradient samples are randomly sampled and assigned corresponding weight compensation coefficients to reduce the amount of training data while maintaining the overall statistical characteristics of the sample distribution. This approach ensures that the information gain calculated based on a sample subset aligns with the expected theoretical value calculated based on the full dataset. The combined use of the leaf-first growth strategy and the histogram algorithm allows the model to prioritize the leaf node with the largest gain during each split, achieving the lowest training error with the fewest tree nodes. Simultaneously, setting the minimum number of leaf node samples and the maximum tree depth suppresses the risk of overfitting. Feature importance evaluation and the determination of the selection threshold are based on a comprehensive calculation of the frequency of each water quality parameter being selected as a splitting feature during the decision tree splitting process and its corresponding gain contribution. The feature importance scores of each water quality parameter are normalized to unify the dimensions. The score directly reflects the parameter's contribution to red tide outbreak prediction. The selection threshold is set to 0.05, determined through multiple rounds of cross-validation. Features below this threshold participate very infrequently during tree splitting and have a negligible gain contribution, offering no statistically significant improvement to the model's prediction performance. Removing these features does not decrease model accuracy; instead, it reduces feature dimensionality and minimizes redundant information interference with subsequent time-series modeling. The selected key water quality factors retain the core parameters most strongly correlated with red tide outbreaks. Furthermore, step 2 also includes: In each iteration, the LightGBM model employs a leaf-first growth strategy, selecting the node with the highest gain among all current leaf nodes for splitting, achieving the lowest training error with the fewest number of tree nodes. Simultaneously, it sets constraints on the minimum number of samples per leaf node and the maximum tree depth to suppress the risk of overfitting. Prioritizing the splitting of the node with the highest gain quickly reduces training error with fewer nodes, while constraints on depth and sample number prevent overfitting. For high-dimensional sparse features that still exist after unilateral gradient sampling, a mutually exclusive feature binding mechanism is used, statistically identifying conflicts based on the number of simultaneously non-zero samples among statistical features. The graph greedily groups features with conflicts less than a set conflict threshold into the same bundle, merges feature values by adding an offset, compresses feature dimensions, effectively compresses high-dimensional sparse features, reduces feature dimensions, and reduces storage and computational overhead. Histograms are constructed for each group of features after bundling, and the gradient sum and sample number within each bin are calculated. Only the bin boundaries need to be traversed to complete the split point search. The histogram difference of the parent node is used to quickly obtain the histogram of the child node, and the output is a simplified feature set containing key water quality factors after filtering. This accelerates the split point search process, reduces computation time, and outputs a simplified feature set containing key factors. It should be noted that the split gain values of all leaf nodes in the current round are stored in a priority queue. At the beginning of each iteration, the leaf node with the largest gain is taken from the top of the queue and split. The gain values of the two new leaf nodes generated after the split are recalculated and pushed into the queue. This process is repeated until the preset tree depth limit of 6 levels or the total number of leaf nodes reaches the upper limit constraint of 31 is reached. The tree depth limit of 6 levels ensures that the decision path length of a single decision tree is moderate. The upper limit of 31 leaf nodes is used in conjunction with the depth of 6 levels. The minimum number of samples for a leaf node is set to 5. When a certain leaf node... When the number of training samples contained in a child node is less than a certain threshold, the node will no longer participate in subsequent splits. This prevents the decision tree from generating overly complex branch structures in sparse sample regions. Together with the depth limit and the upper limit on the total number of leaves, this forms a triple regularization constraint system to jointly suppress the risk of overfitting. The values of each parameter are determined through grid search optimization using historical red tide monitoring data of the target sea area and remain fixed during model training. After each split operation, the model calculates the training set error and validation set error of the current tree in real time. If the validation set error does not decrease for five consecutive iterations, an early termination mechanism is triggered, stopping further splitting of the tree. Step-by-step growth; traverse all feature pairs, count the number of samples in the same sample where each feature pair simultaneously takes a non-zero value as the conflict count value, construct an undirected conflict graph with features as nodes and feature pair conflict count values as edge weights. The conflict threshold is set to one ten-thousandth of the total number of feature samples. When the conflict count value between two features is lower than this threshold, they are considered mutually exclusive and can be grouped into the same bundle. The greedy grouping process processes each feature in descending order of degree centrality in the conflict graph, assigning the current feature to the first existing bundle that has no conflict with its mutually exclusive features. If no bundle satisfies the condition, the current feature is assigned to the first existing bundle that has no conflict with its mutually exclusive features. A new bundle is created to accommodate the feature. After grouping, the offset of the original value range of each feature in the same bundle is calculated. The features are sorted in ascending order according to the length of the original value range. The cumulative offset is added to each feature value in turn, so that the mutually exclusive features that were originally scattered in different value ranges are merged into a single feature dimension. The offset is calculated based on the difference between the maximum and minimum values of each feature on the full training data to ensure that the value ranges of each feature do not overlap after merging. Feature dimension compression is completed without loss of feature information. After compression, the feature dimension is reduced to 5% to 15% of the original dimension.For each feature dimension after bundling and compression, the continuous interval from the minimum to the maximum value of the feature is uniformly divided into 32 discrete bins. Each bin contains left and right boundary values. All training samples at the current node are traversed, and the index of the bin to which the sample belongs is calculated based on the value of the sample on the bound feature. The first-order gradient value and the second-order gradient value of the sample are accumulated into the gradient sum variable of that bin, and the sample count variable is incremented by 1. After traversal, each bin records three statistics: the cumulative first-order gradient sum, the cumulative second-order gradient sum, and the number of samples. During the split point search, only 31 candidate split positions among the 32 bin boundaries need to be traversed, and for each candidate position, the bi values of the left child node are calculated. The cumulative statistic of n is used. The statistic of the right child node is obtained by subtracting the statistic of the left child node from the statistic of the parent node's statistic. No need to re-traverse the samples. The split gain is calculated for each candidate split position, and the bin boundary with the largest gain is selected as the final split point. Histogram subtraction reduces the time complexity of each split from O(number of samples × number of features) to O(number of bins × number of features), where the number of bins is a fixed value of 32. After model training converges, the cumulative gain contribution value of each feature in the entire decision tree split process is extracted from the LightGBM model object. After normalization, the feature importance score of each water quality parameter is obtained. Features with scores greater than 0.05 are retained as members of the simplified feature set.
[0022] Step 3: Input the selected key water quality factors into an LSTM network. Through forgetting gates, input gates, and output gates, capture short-term and long-term temporal dependencies to predict future trends in key parameters such as chlorophyll a and dissolved oxygen. Output high-precision water quality prediction features to accurately characterize the dynamic evolution of water quality parameters over time, improving the accuracy of predicting future trends of key parameters. Rearrange the key water quality factors output by the LightGBM model in temporal order to construct a three-dimensional input tensor with a time step. Input this tensor into a pre-constructed two-layer LSTM network, with each layer containing 64 LSTM neurons. The forgetting gate calculates the proportion of information retained from the previous time step, deciding whether to discard or retain non-critical information from historical states. The forgetting gate selectively discards non-critical historical information while retaining important long-term dependency features, improving the accuracy of long-term predictions. The system generates candidate memory units through an input gate and a tanh activation function. It combines the key water quality factor information input at the current moment with the hidden state at the previous moment to update the memory unit state, achieving selective writing of newly added information at the current moment, forming an updated memory state containing long-short-term dependencies. The input gate selectively writes the effective information at the current moment, updates the memory state, and integrates long-short-term dependencies. The output gate calculates the influence weight of the memory state at the current moment on the output. The updated memory unit is scaled through a tanh activation function to generate the hidden state at the current moment. The predicted values of chlorophyll a and dissolved oxygen at future moments are output through a fully connected layer linear mapping, completing the high-precision water quality prediction feature output. The output gate filters the effective information at the current moment to generate accurate predicted values of chlorophyll a and dissolved oxygen, completing the high-precision prediction. It should be noted that the construction of the 3D input tensor is determined based on the types of key water quality factors retained after LightGBM screening. The time step is set to 24 hours, that is, water quality data collected hourly over the past 24 hours is used to predict water quality parameter values at future times. Each layer of the dual-layer LSTM network structure contains 64 LSTM units. The number of LSTM units is determined by comprehensively optimizing the time series length and feature dimension of the historical red tide monitoring data of the target sea area. The sigmoid activation function of the forget gate outputs a retention ratio value between 0 and 1. This retention ratio value is multiplied element-wise with the state of the memory unit at the previous time step to achieve selective forgetting of historical information. The input gate calculates the selective writing weight of newly added information at the current time step through the sigmoid activation function. At the same time, the input features at the current time step are concatenated with the hidden state at the previous time step step and then processed by the tanh activation function to generate candidate memory units. The two are multiplied element-wise and then added to the historical memory state processed by the forget gate to complete the update of the memory units. The dual-layer LSTM network is trained using the time backpropagation algorithm. Each layer of the network receives the data from the previous layer at the corresponding time step step step. The output is used as input to form a hierarchical temporal feature abstraction structure. The first layer extracts the basic fluctuation pattern of water quality parameters, and the second layer extracts higher-order mutation trend features based on this. During training, the Adam optimizer is used to update parameters, and the initial learning rate is set to 0.001, which was determined through pre-experiments. The output gate concatenates the input features at the current time step with the hidden state at the previous time step and calculates the output weights using the Sigmoid activation function. The output weights are then multiplied element-wise with the memory cell state after tanh scaling to obtain the hidden state at the current time step. The hidden state is then input into the fully connected layer and converted into the predicted values of chlorophyll a and dissolved oxygen at future time steps through linear mapping. The output dimension of the fully connected layer is fixed at 2, corresponding to the predicted results of the two key water quality parameters, chlorophyll a and dissolved oxygen, respectively. During training, the mean squared error is used as the loss function to measure the deviation between the predicted value and the true value. During the model training phase, the batch size is set to 32 and the iteration rounds are set to 100. An early stopping strategy is used to monitor the validation set loss. Training is terminated when the validation set loss does not decrease for 10 consecutive iterations to prevent the model from overfitting.
[0023] Step 4: Input the water quality prediction features into the hybrid discrimination module composed of random forest and XGBoost. The random forest evaluates the feature gain based on the Gini index. If the feature gain is lower than the set gain threshold, it is marked as an invalid feature and removed. The high-contribution core feature subset is retained, redundant interference information in the prediction features is removed, and the core features that contribute most significantly to the red tide discrimination are retained, thereby improving the effectiveness of subsequent discrimination.
[0024] Step 5: Input the purified core feature subset into XGBoost, use a weighted loss function to enhance the focus on positive red tide samples, improve the iterative fitting residuals through serial gradient, output the discrimination probability value of red tide outbreak, enhance the model's sensitivity to the identification of scarce red tide outbreak samples, and effectively reduce the risk of missing weak precursor signals.
[0025] Step 6: Based on the optimal cutoff point of ROC and the polarization characteristics of probability distribution, set three warning thresholds of low, medium and high, map the discrimination probability to the corresponding risk level, generate a clear conclusion on red tide outbreak and output the warning result, transform the fuzzy probability value into a clear graded risk conclusion, and provide an intuitive and operable judgment basis for prevention and control decision-making.
[0026] Example 2, as Figures 1 to 3 As shown, based on Example 1, this invention provides a technical solution: In step 4, the process of retaining the high-contribution core feature subset is as follows: the water quality prediction features output by LSTM are used as input to construct a random forest model containing multiple decision trees. Each decision tree extracts a sample subset with replacement from the original training set based on the Bagging sampling strategy, and randomly selects some features for candidate splitting at each node to enhance the model's generalization ability. Multi-tree ensemble reduces the risk of overfitting of a single tree. Random sampling and feature selection enhance the model's generalization performance. For each splitting node of each decision tree, the Gini index of the node before splitting and the Gini index of the two child nodes after splitting are calculated. The Gini index is subtracted from the weighted sum of the Gini indices of the two child nodes to obtain the split gain value of each candidate feature at that node. The larger the gain, the higher the contribution of the feature to red tide discrimination. The Gini gain quantitatively measures the discrimination ability of each feature and accurately assesses the strength of each feature's contribution to red tide classification. The split gain values of the same feature in all nodes appearing in each decision tree are weighted and summed according to the number of node samples. Then, the contributions of all decision trees are accumulated. The accumulated result is normalized and used as the final importance score of the feature. Invalid features with scores lower than the set gain threshold are removed, and a subset of high-contribution core features is retained. The importance of features is comprehensively evaluated by integrating information from multiple trees, and invalid and redundant features are removed, while a subset of high-contribution core features is retained. It should be noted that the random forest model is configured with 500 decision trees. When splitting a node, each tree randomly selects the number of features equal to the square root of all features, rounded down. In bagging sampling, the size of each sample subset is the same as the original training set. Sampling with replacement ensures that approximately 63.2% of the original samples enter the training set of each tree, with the remaining samples used as out-of-bag data for internal error estimation. Each tree employs a full growth strategy without pruning. Splitting stops when the number of samples in a leaf node drops to 1 or the node purity reaches 1. This configuration was determined through grid search optimization using the target sea area red tide monitoring dataset. The ensemble size of 500 trees strikes a balance between model accuracy and computational efficiency. Out-of-bag error estimation tends to stabilize as the number of trees increases. The square root feature sampling strategy reduces the correlation between trees, enabling the random forest to stably process the high-dimensional predictive features output by LSTM and output reliable feature importance evaluation results. During node splitting, each decision tree calculates the change in the Gini index of each candidate feature under different values for the training samples contained in the current node. The Gini index calculation formula is: ,in, This represents the Gini index of the current node. A larger value indicates a more mixed distribution of sample categories within the node, and higher impurity. This represents the total number of sample categories in the current node. In the red tide early warning task, the number of categories is 2, namely, the red tide outbreak category and the non-outbreak category. For the current node The proportion of class samples to the total number of samples in that node; the split gain of each candidate feature is determined based on the weighted difference between the impurity of the node before splitting and the impurity of the two child nodes after splitting, with the weight being the proportion of the number of samples in each child node to the total number of samples in the current node, calculated using the following formula: ,in, This represents the split gain value of the current candidate feature at a specific split point. A larger gain indicates that the feature and the split point have a stronger ability to distinguish between sample classes. This represents the Gini index of the parent node before the split, i.e., the initial impurity of the current node before the split. This represents the number of training samples contained in the left child node after the split. This represents the number of training samples contained in the right child node after the split. This represents the total number of samples in the parent node before the split. The Gini index is the value of the left child node after splitting, reflecting the sample purity within the left child node. The Gini index of the right child node after splitting reflects the sample purity within the right child node. When splitting a node, all available candidate features and all possible split points for the current node are traversed, and the gain value corresponding to each split scheme is calculated. The candidate feature with the largest gain and its corresponding split point are selected to perform the actual splitting operation for that node. For continuous water quality prediction features, a binary search method is used to traverse the midpoints of adjacent values in the feature value sorting sequence as candidate split points, ensuring that the gain calculation of each split scheme covers all possible feature value boundaries, guaranteeing that each split is the optimal feature selection for the current node. After all 500 decision trees in the random forest have grown, each internal node of each tree is traversed, and the selected splitting feature, the number of samples corresponding to that node, and the feature splitting gain value at that node are extracted. For the same water quality prediction feature, its splitting gain value at all internal nodes of all decision trees is multiplied by the number of samples at the corresponding node and then summed to obtain the weighted sum of the feature's gains. The calculation formula is: ,in, For the first The sum of the weighted gains of each feature in a random forest based on the Gini index; the larger the value, the greater the overall contribution of that feature to distinguishing red tide categories in the entire forest. The total number of decision trees in the random forest. For the first All of the trees with features The set of internal nodes as a splitting feature For the first Nodes of a tree Location, characteristics The split gain value, For the first Nodes of a tree The total number of samples at the node before the current split is used as the weighting weight for the node's gain. The more samples a node has, the greater its split gain has on the overall model. The sum of the weighted gains of all features is normalized to ensure that the importance scores of each feature are on the same order of magnitude. The gain threshold is dynamically determined based on the characteristic distribution of the red tide monitoring data in the target sea area. Features with gain scores lower than 30% of the average gain score of all features are removed, and features with scores higher than the threshold are retained to form a core feature subset. This threshold setting is confirmed by cross-validation to achieve effective compression of feature dimensions while ensuring discrimination accuracy. Furthermore, step 4 also includes: each decision tree in the random forest model independently calculates the Gini gain of each candidate feature at each internal split node, uses the ratio of the number of node samples to the total number of samples as the weight to weight the gain of each node, eliminates the bias of uneven sample distribution on feature evaluation, and weights the number of node samples to eliminate the evaluation bias caused by sample imbalance, making the feature importance evaluation more objective and accurate. The weighted gain of the same feature in all decision trees is accumulated and normalized to obtain the comprehensive importance score of each water quality prediction feature. The gain threshold is dynamically set according to the score distribution characteristics. Features with scores below the gain threshold are marked as redundant interference features and removed. The feature contribution is comprehensively evaluated by integrating multi-tree information. The threshold is dynamically set to accurately identify and remove redundant interference features. The remaining high-scoring core features after removal are sorted in descending order of contribution. The top few features with accumulated contributions reaching the preset proportion are selected and combined to form a purified core feature subset. This ensures that the retained features have a clear gain contribution to red tide discrimination and minimizes the redundancy between features. The core features are sorted by contribution to retain discrimination information and reduce the redundancy between features, thereby improving model efficiency. It should be noted that the random forest model is configured with 500 decision trees. Each tree independently receives water quality prediction features output by the LSTM network as input, and performs Gini gain calculation on each candidate feature at each internal node. Specifically, for each internal node of each decision tree, the total number of samples at that node is determined, and the proportions of positive and negative red tide samples contained in that node are calculated, thereby calculating the Gini index of that node. Subsequently, all available candidate features and corresponding candidate split points of the current node are traversed, and the Gini index and the number of child nodes under each split scheme are calculated, and the split gain value of each candidate feature at that node is calculated using the number of node samples. The ratio of the number of training samples to the total number of random forest samples is used as the weighting coefficient for the gain of that node. Weighting is applied to the gain value at each node to ensure a reasonable weighting ratio between the gain contributions of sparse and dense nodes in subsequent accumulation. After completing the growth of all 500 decision trees and the weighted gain calculation of their internal nodes, the splitting feature selected by each internal node in each decision tree and its corresponding weighted gain value are extracted. For the same water quality prediction feature, its weighted gains across all decision trees and all internal nodes are accumulated to obtain the original weighted gain sum of that feature. Then, the original weighted gain sum of all features is normalized to reflect the overall importance of each feature. The scores are uniformly mapped to the same numerical order of magnitude. After obtaining the comprehensive importance score of each feature, a gain threshold is dynamically set based on the characteristic distribution of red tide monitoring data in the target sea area. Specifically, the comprehensive importance scores of all features are sorted in descending order, and the arithmetic mean of all feature scores is calculated. 30% of this mean is used as the elimination threshold. Features with comprehensive importance scores below this threshold are identified as redundant interference features that do not significantly contribute to the identification of red tide outbreaks and are eliminated. After eliminating redundant features below the gain threshold, the remaining high-scoring core features are sorted in descending order of comprehensive importance score. Starting from the feature at the top of the list, the comprehensive importance of each feature is accumulated one by one. The feature score is calculated as the proportion of the current accumulated value to the total score of all features, i.e., the cumulative contribution rate. When the cumulative contribution rate reaches a preset threshold, the screening stops, and the accumulated features are extracted as the members of the final core feature subset. This preset threshold is set according to the actual feature dimension and information redundancy of the red tide monitoring data in the target sea area, ensuring that the selected core feature subset can effectively compress the feature dimension while retaining most of the discrimination information. After screening, the internal correlation of the core feature subset is checked to examine the difference in the source of gain between each retained feature, ensuring that the internal redundancy of the feature subset is minimized. The final core feature subset is used to replace the original LSTM output features.
[0027] In step 5, the process of outputting the discrimination probability value of red tide outbreak is as follows: The core feature subset purified by random forest is input into the XGBoost model; a serial gradient boosting framework with decision tree as the base learner is constructed; basic predicted values are initialized; regularization parameters are set to constrain tree complexity and leaf node weights to prevent overfitting; prediction bias is corrected layer by layer through serial iteration; regularization constraints control model complexity and improve generalization ability; in each iteration, the first and second gradients of the loss function with respect to the current predicted value are calculated for each sample; and positive sample weight coefficients are set in the loss function to strengthen the red tide outbreak class samples. The loss contribution guides the model training to focus on fitting a few positive samples, alleviating the problem of red tide sample imbalance. The weighted positive samples increase the weight of minority samples, effectively alleviating the problem of missed judgment caused by sample imbalance. A new decision tree is constructed based on the gradient value of each sample to fit the residual. The gain of each candidate split point is calculated and the node with the largest gain is selected for splitting. The prediction results of the decision tree generated by multiple iterations are accumulated and mapped to the [0, 1] interval through the Sigmoid function to output the discrimination probability value of red tide outbreak. The prediction residual is gradually reduced by multiple iterations, and the probability mapping outputs the discrimination probability value in the interval of 0 to 1, which is convenient for subsequent classification judgment. It should be noted that the construction of the XGBoost model requires determining the base prediction values. These base prediction values are set based on the prior probability distribution of red tide outbreak categories in the training set samples, using half the log odds of positive and negative samples as the initial bias. The model's regularization parameters include a leaf node complexity penalty coefficient γ and an L2 regularization coefficient λ. γ controls the minimum loss reduction required for leaf node splitting, and λ constrains the sum of squares of leaf node weights. Together, they constitute the model complexity penalty term. The maximum tree depth is set to 6 layers, consistent with the LightGBM model parameters, ensuring parameter adaptation across modules during serial iteration. The learning rate is set to 0.1 to control the correction step of each new tree on the overall prediction result. The model is designed for a long iteration cycle of 100 iterations, ensuring stable convergence while fully fitting the residuals. Before each iteration, the model reads the predicted values for each sample from the previous iteration and calculates the first and second partial derivatives of each sample with respect to the current predicted value using the binary cross-entropy loss function. The first partial derivative is the difference between the predicted probability and the true label, and the second partial derivative is the product of the predicted probability and the probability minus one. A positive sample weight coefficient is configured in the loss function, determined based on the ratio of negative to positive samples in the training set. This coefficient applies an additional weight multiplier to positive samples when calculating the loss value for each sample, ensuring that the gradient contribution of positive samples accounts for a larger share of the overall gradient. A large proportion of these weights are set once during model initialization and remain unchanged throughout all iterations, ensuring stable attention to positive samples throughout model training. In each iteration, the first and second gradients of all samples are stored in association with the current tree structure according to the sample index. In each iteration, a new decision tree is constructed based on the first and second gradients of each sample to fit the residuals of the previous model. During tree construction, for each candidate split point, the split gain is calculated using the sum of the first and second gradients of the samples contained in the current node. The gain calculation considers the gradient statistics of the left and right child nodes as well as the constraints of the regularization parameter λ. The candidate feature and split point with the largest gain are selected to perform node splitting. The tree growth adopts a hierarchical splitting strategy, with all nodes expanding synchronously at each level until the preset maximum tree depth of 6 levels is reached or the weight of the leaf node is lower than a set threshold, at which point growth stops. After a new decision tree is generated, the optimal weight of each leaf node is calculated by dividing the sum of the first gradient of the samples within that node by the sum of the second gradient and λ. The leaf weights output by the current tree are multiplied by the learning rate of 0.1 and then added to the total predicted value of the preceding model to complete one round of iteration update. The above process is repeated until the preset upper limit of 100 iterations is reached or the loss function fails to decrease for 10 consecutive rounds on the validation set, at which point the process terminates early. Finally, the cumulative predicted value is mapped to the probability interval between 0 and 1 by the Sigmoid function, and the discrimination probability value of the red tide outbreak is output.
[0028] In step 6, the process of setting low, medium, and high warning thresholds is as follows: Based on the true labels of the validation set samples and the discriminant probability values output by the XGBoost model, the receiver operating characteristic (ROC) curve is plotted, the true positive rate and false positive rate corresponding to each cutoff point are calculated, the point corresponding to the maximum value of the Youden index is selected as the optimal cutoff point, the two states of red tide outbreak and non-outbreak are distinguished, the Youden index is maximized to ensure the balance between the true positive rate and the false positive rate, the optimal probability judgment boundary of red tide outbreak is accurately determined, the overall distribution of the discriminant probability of the validation set samples is statistically analyzed, and the polarization characteristic of the samples concentrated in the low probability interval and the high probability interval is identified based on the frequency distribution histogram of probability values. The four upper-level histograms in the low probability interval are calculated respectively. The quantiles and the lower quartile of the high probability interval serve as auxiliary reference boundaries. The probability distribution histogram clearly shows the sample clustering characteristics. The upper and lower quartiles help to define reasonable boundary intervals. Combining the optimal cutoff point and the polarization characteristics of the probability distribution, three levels of warning threshold boundaries are set: low warning threshold, medium warning threshold, and high warning threshold. The low warning threshold is lower than the optimal cutoff point to exclude the non-outbreak state, the high warning threshold is higher than the optimal cutoff point to confirm the outbreak state, and the medium warning threshold is between the two as a transitional risk segment. Thus, the threshold system is completed. The three levels of thresholds are used to classify risk states: the low threshold excludes the non-outbreak state, the high threshold confirms the outbreak state, and the medium threshold marks the transitional risk. It should be noted that, based on the true class labels of the validation set samples and the 0-1 interval discriminant probability values output by the XGBoost model, the true positive rate and false positive rate are calculated at each probability cutoff point, and receiver operating characteristic (ROC) curves are plotted. For each cutoff point, the true positive rate is calculated by statistically analyzing the proportion of samples in the validation set that are actually positive and have a predicted probability greater than or equal to the cutoff value out of all positive samples. The false positive rate is calculated by statistically analyzing the proportion of samples in the validation set that are actually negative and have a predicted probability greater than or equal to the cutoff value out of all negative samples. The Youden index is calculated at each cutoff point, and the value of the Youden index is the sum of the true positive rate and the false positive rate. The cutoff point corresponding to the maximum value of the Youden index was selected as the optimal cutoff point. This cutoff point is the best probability boundary for distinguishing between red tide outbreaks and non-outbreaks, ensuring that the model's overall discriminative ability for red tide outbreaks is maximized while balancing the accuracy of positive and negative sample identification. Frequency distribution statistics were performed on the discriminative probability values of all samples in the validation set, and a probability histogram was constructed with a class interval of 0.05. The clustering distribution of samples in different probability intervals was observed, and the low-probability interval clusters and high-probability interval clusters with significant probability values in the histogram were identified. The upper quartiles of the sample probability values within the low-probability intervals were extracted as... The low-probability interval reference boundary is determined by extracting the lower quartile of the probability values of samples within the high-probability cluster. The specific values of the upper and lower quartiles are determined statistically by the actual probability distribution of the validation set samples. The optimal cutoff point is used as the core benchmark for the three-tiered warning thresholds. The cutoff point is fine-tuned by referencing the upper quartile of the low-probability interval and the lower quartile of the high-probability interval. The low-warning threshold is set below the optimal cutoff point, with its specific value adjusted downwards from the optimal cutoff point. This ensures that while the threshold is below the optimal cutoff point, it is not lower than the upper quartile of the low-probability interval, guaranteeing that the low-warning threshold effectively covers a wide range of areas. A subset of non-outbreak state samples are used to exclude non-outbreak states. The high warning threshold is set higher than the optimal cutoff point, with its specific value adjusted upwards from the optimal cutoff point. This ensures that the threshold is higher than the optimal cutoff point but not higher than the lower quartile of the high probability interval, guaranteeing that the high warning threshold can accurately identify outbreak state samples for confirmation of an outbreak state. The medium warning threshold is set as a value between the low and high warning thresholds, serving as a risk warning segment for the transition from a non-outbreak state to an outbreak state. The specific values of the three warning thresholds are all calculated and determined by the statistical characteristics of the actual probability distribution of the validation set, thus completing the construction of a three-tiered warning threshold system.
[0029] Furthermore, in step 6, the process of generating a clear conclusion on red tide outbreak and outputting the early warning result is as follows: The discrimination probability value of red tide outbreak output by the XGBoost model is compared one by one with the set low, medium, and high early warning thresholds. If the discrimination probability value is lower than the low early warning threshold, it is judged as no risk level; if it is between the low and medium early warning thresholds, it is judged as low risk level; if it is between the medium and high early warning thresholds, it is judged as medium risk level; and if it is higher than the high early warning threshold, it is judged as high risk level. The probability value is compared with the three thresholds level by level to clearly divide the four risk levels of no risk, low risk, medium risk, and high risk. The judgment criteria are clear. Based on the judged risk level, the corresponding red tide outbreak conclusion is generated. No risk level The system outputs conclusions of no outbreak and routine monitoring recommendations for low-risk levels, conclusions of potential outbreaks and enhanced monitoring warnings for medium-risk levels, and conclusions of confirmed outbreaks and emergency response recommendations for high-risk levels. Each risk level corresponds to a clear outbreak conclusion and tiered response recommendations, providing differentiated handling guidelines for different risk scenarios. The risk level determination results, corresponding outbreak conclusions, and recommendations are encapsulated in a structured early warning output format and pushed to the red tide prevention and control decision-making platform via a visual interface or data interface. This provides clear and actionable early warning results to support red tide prevention and control in nearshore waters. The structured encapsulation ensures that the information is complete and analyzable, and the dual-channel output of visual display and platform push supports prevention and control decision-making. It should be noted that during the process of comparing the probability value with the warning threshold, the operator uses the red tide outbreak discrimination probability value output in real time by the XGBoost model as input data. Following preset logical judgment rules, this probability value is compared step-by-step with the three calibrated warning thresholds. After receiving each set of discrimination probability values, it is automatically compared with the low, medium, and high warning thresholds in ascending order. Based on the comparison results, the current sea area status is classified into one of four risk levels: no risk, low risk, medium risk, or high risk. This risk classification process is then completed. Simultaneously with the determination, the determination result and corresponding probability value are recorded, and the determination timestamp, probability value, and risk level are stored together in the system operation log. During the process of generating red tide outbreak conclusions and recommendations based on risk levels, the determined risk level is used as a trigger condition. Matching pre-set conclusion generation rules, the system automatically retrieves the standardized conclusion description and response recommendation text corresponding to that risk level. For no-risk and low-risk levels, a "no outbreak" conclusion is generated along with routine monitoring recommendations to guide staff in maintaining normal monitoring frequency. For medium-risk levels, a "potential outbreak" conclusion is generated along with an encrypted monitoring alert. The system prompts staff to increase monitoring frequency and pay attention to the changing trends of key parameters. For high-risk levels, it generates a confirmed outbreak conclusion along with emergency response recommendations, prompting staff to immediately initiate emergency response procedures. When generating the conclusion and recommendations, it also embeds the key parameter values (including predicted chlorophyll a concentration and dissolved oxygen concentration) from the current water quality prediction characteristics into the corresponding positions in the recommendation text, making the recommendations more targeted. During the process of packaging and pushing out the early warning results, the risk level determination results, the corresponding red tide outbreak conclusion, and response recommendation information are packaged according to a predefined structured data format to form a standardized early warning. The output message contains core fields such as monitoring site identifier, data timestamp, risk level code, conclusion type code, and suggested text content to ensure the integrity and parsability of the information. After encapsulation, two output channels are activated simultaneously: on the one hand, the message is rendered into a visual interface for on-site monitoring personnel to view in real time; on the other hand, the message is pushed to the superior red tide prevention and control decision-making platform through a data interface to achieve cross-level sharing of early warning information. The push process uses an encrypted transmission protocol to ensure the security of data transmission. After receiving the message, the red tide prevention and control decision-making platform can automatically parse it and trigger the corresponding linkage response process.
[0030] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. The scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A red tide early warning method based on multi-algorithm fusion of buoy water quality data, characterized in that, Includes the following steps: Step 1: Collect buoy water quality data from buoy monitoring in the target sea area, perform preprocessing operations, and construct a standardized initial feature set; Step 2: LightGBM is used to train the preprocessed buoy water quality data. Histogram optimization and one-sided gradient sampling are used to screen key water quality factors in the buoy water quality data, remove redundant noise features, and output a simplified feature set. Step 3: Input the selected key water quality factors into the LSTM network to capture long-term and short-term time-series dependencies, predict the future trend of key parameter changes, and output high-precision water quality prediction features. Step 4: Input the water quality prediction features into the hybrid discrimination module composed of random forest and XGBoost. The random forest evaluates the feature gain based on the Gini index. If the feature gain is lower than the set gain threshold, it is marked as an invalid feature and removed. The high-contribution core feature subset is retained. Step 5: Input the purified core feature subset into XGBoost, use a weighted loss function to enhance the focus on positive red tide samples, improve the iterative fitting residuals through serial gradient, and output the discrimination probability value of red tide outbreak; Step 6: Based on the optimal cutoff point of ROC and the polarization characteristics of probability distribution, set three warning thresholds: low, medium and high. Map the discrimination probability to the corresponding risk level, generate a clear conclusion on red tide outbreak and output the warning result.
2. The red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 1, characterized in that: In step 1, the process of constructing the standardized initial feature set is as follows: Collect continuous time-series buoy water quality data from buoy monitoring in the target sea area, identify and remove outlier values caused by sensor failure or environmental disturbance based on the physical reasonable threshold range of each parameter, and use linear interpolation to fill in the missing data for the time period. For the parameters of water temperature, salinity, dissolved oxygen, pH, chlorophyll a and turbidity after filling, the maximum and minimum values of each parameter in the whole time series are calculated, and the minimum-maximum normalization formula is applied to linearly map the values of each parameter to the [0, 1] interval. The normalized parameters are arranged in time sequence and combined to form a standardized initial feature matrix. Each time step corresponds to a multi-dimensional feature vector containing all six water quality parameters, thus obtaining a standardized initial feature set.
3. The red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 1, characterized in that: In step 2, the process of screening key water quality factors in the buoy water quality data is as follows: The standardized initial feature set was divided into training and validation sets according to time sequence. A LightGBM model with decision tree as the base learner was constructed. The histogram bin number was set to 32, the learning rate to 0.05, the tree depth to 6, and the number of iterations to 200. Gradient boosting iterative training was performed on the training set. During training, a one-sided gradient sampling mechanism is used. All samples are sorted in descending order according to the absolute value of the gradient. The top 20% of large gradient samples are retained, and 10% of the remaining small gradient samples are randomly sampled and weighted to compensate for the difference. These samples are combined to form a simplified training subset. After iteration, the feature importance scores of each water quality parameter are output. Several items among water temperature, salinity, dissolved oxygen, pH, chlorophyll a and turbidity with scores greater than 0.05 are selected as key water quality factors. Redundant features with scores below the threshold are removed to form a simplified feature set.
4. The red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 3, characterized in that: Step 2 also includes: The LightGBM model employs a leaf-first growth strategy in each iteration, selecting the node with the largest gain among all current leaf nodes for splitting, achieving the lowest training error with the fewest number of tree nodes, while setting constraints on the minimum number of samples per leaf node and the maximum depth of the tree. For high-dimensional sparse features that still exist after unilateral gradient sampling, a mutually exclusive feature bundling mechanism is adopted. The number of samples with non-zero values among features is counted to construct a conflict graph. Features with less than a set conflict threshold are greedily grouped into the same bundle. Feature values are merged by adding an offset to compress the feature dimension. Histograms are constructed for each group of features after bundling. The gradient sum and sample number within each bin are calculated. Only the bin boundaries need to be traversed to complete the split point search. The histogram of the child node is quickly obtained by using the difference of the parent node histogram. The filtered concise feature set containing key water quality factors is output.
5. The red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 1, characterized in that: In step 3, the process of outputting high-precision water quality prediction features is as follows: The key water quality factors output by the LightGBM model are rearranged in time sequence to construct a three-dimensional input tensor with time step. This tensor is then input into a pre-constructed two-layer LSTM network, with each layer containing 64 LSTM neurons. The proportion of memory information retained from the previous time step is calculated through the forget gate, which determines whether to discard or retain non-critical information from the historical state. Candidate memory units generated by the input gate and tanh activation function combine the key water quality factor information input at the current moment with the hidden state at the previous moment to update the memory unit state, thereby achieving selective writing of newly added information at the current moment and forming an updated memory state containing long-term and short-term dependencies. The influence weight of the current memory state on the output is calculated through the output gate. The updated memory unit is scaled through the tanh activation function to generate the current hidden state. The predicted values of chlorophyll a and dissolved oxygen for the future time are output through linear mapping by the fully connected layer.
6. The red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 1, characterized in that: In step 4, the process of retaining the subset of high-contribution core features is as follows: The water quality prediction features output by LSTM are used as input to construct a random forest model containing multiple decision trees. Each decision tree extracts a subset of samples with replacement from the original training set based on the Bagging sampling strategy, and randomly selects some features for candidate splits when splitting at each node. For each split node of each decision tree, calculate the Gini index of the node before splitting and the Gini index of the two child nodes after splitting. Subtract the weighted sum of the Gini indices of the two child nodes from the Gini index before splitting to obtain the split gain value of each candidate feature at that node. The split gain values of all nodes in each decision tree for the same feature are weighted and summed according to the number of node samples. The contributions of all decision trees are then accumulated. The accumulated result is normalized and used as the final importance score of the feature. Invalid features with scores lower than the set gain threshold are removed, and a subset of high-contribution core features is retained.
7. A red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 6, characterized in that: Step 4 also includes: In the random forest model, each decision tree independently calculates the Gini gain of each candidate feature at each internal split node, and uses the ratio of the number of node samples to the total number of samples as the weight to weight the gain of each node. The weighted gains of the same feature in all decision trees are accumulated and normalized to obtain the comprehensive importance score of each water quality prediction feature. The gain threshold is dynamically set according to the score distribution characteristics, and features with scores lower than the gain threshold are marked as redundant interference features and removed. The remaining high-scoring core features after removal are sorted in descending order of contribution. The top few features whose cumulative contribution reaches a preset proportion are selected and combined to form a purified subset of core features.
8. A red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 1, characterized in that: In step 5, the process of outputting the probability value for red tide outbreak is as follows: The core feature subset after random forest filtering and purification is input into the XGBoost model to construct a serial gradient boosting framework with decision tree as the base learner. The basic prediction values are initialized, and regularization parameters are set to constrain the tree complexity and leaf node weights. In each iteration, the first and second gradients of the loss function with respect to the current predicted value are calculated for each sample. The weight coefficient of positive samples is set in the loss function to enhance the loss contribution of red tide outbreak samples, and guide the model to focus on fitting a few positive samples during training. Based on the gradient values of each sample, a new decision tree fitting residual is constructed. The gain of each candidate split point is calculated and the node with the largest gain is selected for splitting. The prediction results of the decision tree generated by multiple iterations are accumulated and mapped to the [0, 1] interval through the Sigmoid function, and the discrimination probability value of red tide outbreak is output.
9. A red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 1, characterized in that: In step 6, the process of setting the low, medium, and high warning thresholds is as follows: Based on the true labels of the validation set samples and the discriminant probability values output by the XGBoost model, the subject operating characteristic curve was plotted, the true positive rate and false positive rate corresponding to each cutoff point were calculated, and the point corresponding to the maximum value of the Youden index was selected as the optimal cutoff point to distinguish between red tide outbreak and non-outbreak states. The overall distribution of the discrimination probability of the statistical validation set samples is used to identify the polarization characteristics of the samples concentrated in the low probability interval and the high probability interval based on the frequency distribution histogram of probability values. The upper quartile of the low probability interval and the lower quartile of the high probability interval are calculated as auxiliary reference boundaries. Combining the optimal cutoff point with the polarization of probability distribution, three warning threshold boundaries are set: low warning threshold, medium warning threshold, and high warning threshold. The low warning threshold is lower than the optimal cutoff point to exclude the non-outbreak state, the high warning threshold is higher than the optimal cutoff point to confirm the outbreak state, and the medium warning threshold is between the two as a transitional risk zone, thus completing the construction of the threshold system.
10. A red tide early warning method based on multi-algorithm fusion of buoy water quality data according to claim 9, characterized in that: In step 6, the process of generating a clear conclusion about a red tide outbreak and outputting an early warning result is as follows: The probability value of red tide outbreak output by the XGBoost model is compared with the set low, medium and high warning thresholds one by one. If the probability value is lower than the low warning threshold, it is judged as no risk level; if it is between the low warning threshold and the medium warning threshold, it is judged as low risk level; if it is between the medium warning threshold and the high warning threshold, it is judged as medium risk level; and if it is higher than the high warning threshold, it is judged as high risk level. Based on the determined risk level, a corresponding red tide outbreak conclusion is generated. For no-risk and low-risk levels, a no-outbreak conclusion and routine monitoring recommendations are output. For medium-risk levels, a potential outbreak conclusion and enhanced monitoring warning are output. For high-risk levels, a confirmed outbreak conclusion and emergency response recommendations are output. The risk level assessment results, corresponding outbreak conclusions, and recommendations are packaged into a structured early warning output format and displayed through a visual interface or pushed to the red tide prevention and control decision-making platform via a data interface.