Seawater intrusion real-time prediction method based on physical mechanism guidance feature selection
By obtaining physical mechanism weights through a quantitative source-specific model to guide feature selection, and combining this with the SHAP method to screen features, the XGBoost model is trained. This solves the problems of high cost and low efficiency in seawater intrusion monitoring, achieves real-time and high-precision seawater intrusion prediction, and improves the reliability of the model's mechanisms and the accuracy of prediction.
Patent Information
- Application Number
- CN202511878298.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-12
- Publication Date
- 2026-03-17
AI Technical Summary
In existing technologies, seawater intrusion monitoring relies on costly and time-consuming hydrochemical laboratory tests, making it difficult to achieve real-time and high-precision predictions. Furthermore, conventional SHAP feature selection methods ignore the physical reliability of samples, leading to misselection of features and insufficient model robustness.
By constructing a quantitative and source-specific model to obtain the weights of physical mechanisms, and combining it with machine learning SHAP feature selection, the optimal feature set is selected, and the XGBoost model is trained to predict seawater intrusion. High-precision prediction is achieved by utilizing environmental features monitored on-site.
It achieves real-time, high-precision prediction of seawater intrusion, solves the problems of high cost and low efficiency of traditional methods, improves the reliability of the model mechanism and prediction accuracy, and ensures the consistency between the model logic and physical mechanism.
Smart Images

Figure CN121682172A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the interdisciplinary field of hydrogeology, environmental science and machine learning, and specifically relates to a real-time prediction method for seawater intrusion based on feature selection guided by physical mechanisms. Background Technology
[0002] Seawater intrusion poses a serious threat to groundwater resources in coastal areas worldwide, making accurate prediction of its extent crucial for groundwater conservation. For a long time, assessing the degree of seawater intrusion has primarily relied on hydrochemical indicators. While single indicators such as chloride ion concentration (Cl⁻) are easy to measure, they only reflect localized characteristics of the intrusion and cannot comprehensively characterize the complex freshwater-seawater mixing and geochemical processes. Therefore, the industry commonly uses the Global Quality Index (GQI). SWI (GQI) serves as a more representative and reliable metric. However, neither GQI nor... SWI Whether it's other water chemical characteristic indicators, their acquisition heavily relies on time-consuming, costly, and cumbersome laboratory tests, making continuous monitoring and real-time early warning of the groundwater environment almost impossible, constituting a major technical bottleneck in practical applications.
[0003] To address the limitations of traditional methods, data-driven machine learning (ML) has been introduced, enabling us to predict the extent of seawater intrusion using environmental features that are easily monitored continuously in the field. This represents a significant advancement in achieving real-time, low-cost early warning. However, when applying ML to solve this complex hydrogeochemical problem, the reliability of input features becomes a new key challenge: while existing feature selection tools based on SHAP values are advanced, their conventional simple SHAP averaging method ignores the physical reliability of the samples and cannot identify and distinguish between spurious correlations and genuine physical mechanism signals in the data. This results in a lack of mechanistic reliability in the final model and may lead to feature misselection, thus limiting its robustness. Therefore, to fully leverage the significant advantages of machine learning while simultaneously addressing the challenge of mechanistic reliability in feature selection for complex environmental data, this invention proposes a method that deeply embeds physical mechanisms into the SHAP feature selection process to construct a reliable and high-precision prediction model. Summary of the Invention
[0004] Purpose of the invention: The purpose of this invention is to address the shortcomings of existing technologies and provide a real-time prediction method for seawater intrusion based on physical mechanism-guided feature selection. This invention embeds the physical mechanism weights obtained from a quantitative source-specific model into the workflow of machine learning feature selection, thereby constructing a high-precision, high-efficiency, and physically reliable seawater intrusion prediction model.
[0005] Technical Solution: This invention provides a real-time prediction method for seawater intrusion based on physical mechanism-guided feature selection. It integrates the physical mechanism weights obtained from a quantitative source-specific model with machine learning SHAP feature selection to guide feature optimization. This enables high-precision prediction of the Comprehensive Quality Index (GQI) of seawater intrusion, which requires complex laboratory testing, using environmental features that are easily monitored continuously in the field. SWI This overcomes the limitations of real-time monitoring and cost in traditional water chemistry monitoring; specifically, it includes the following steps:
[0006] Step 1: Construct a seawater intrusion prediction dataset;
[0007] Step 1.1: Obtain the environmental characteristics of the site in real time. The environmental characteristics include land use type, sampling depth, rainfall, evaporation, tidal level, tidal range, groundwater level and groundwater temperature.
[0008] Simultaneously, groundwater samples from different depths in groundwater wells under different land use types were collected and sent to the laboratory for testing. The results of the groundwater sample hydrochemical analysis included the concentrations of the following eight ions: Na+ + K + Ca 2+ Mg 2 + Cl - SO4 2- HCO3 - and NO3 - ;
[0009] Step 1.2: Calculate the target variable, the Comprehensive Seawater Intrusion Index (GQI), using water chemistry indicators. SWI ;
[0010] Step 1.3: Use the interquartile range (IQR) method to analyze environmental characteristics and the combined seawater intrusion index (GQI). SWI Outlier screening and removal were performed; environmental characteristics were used as feature variables, with the seawater intrusion comprehensive index (GQI) as the key indicator. SWI Build a prediction dataset for the target variable;
[0011] Step 2: Construct a quantitative and source-specific model and obtain the physical mechanism weights for each sample. The detailed method is as follows:
[0012] First, using the water chemistry indicators of eight ions (Na) + K + Ca 2+ Mg 2+ Cl - SO4 2- HCO3 - NO3 -To construct a quantitative and source-specific model, we can identify and quantify the standardized contribution of seawater intrusion sources to each groundwater sample i. and standardization contribution As the weight of the physical mechanism, the expression for the quantitative source-specific model is: ;
[0013] in, It refers to a sample concentration matrix containing n samples and m chemical substances; It refers to a source characteristic spectrum matrix with p source factors and m chemical substances. It is the source contribution matrix of n samples to p source factors, used to describe the standardized contribution of each source factor to any given sample. , It refers to the residual matrix containing n samples and m chemical substances;
[0014] Step 3: Train the initial model and calculate the sum of all features for all samples. The value is used for subsequent feature selection. The detailed method is as follows: take the environmental features in the prediction dataset from step 1 as the input feature variables, and use GQI... SWI As the target variable, an initial prediction model XGBoost is trained, and the SHAP method is used to calculate the feature importance value of the environmental feature j to each sample i. ;
[0015] Step 4: Calculate feature importance using physical mechanism weights. The detailed method is as follows:
[0016] Utilizing the obtained mechanism weights As a weighting coefficient, it affects the feature importance value. (Importance of features) The importance of the overall characteristics is obtained by weighting the absolute values of the values. The calculation formula is:
[0017] ;
[0018] Step 5: Select the optimal simplified feature set, retrain the final prediction model, and make predictions. Specifically, this involves assessing the overall feature importance obtained in Step 3. The features are sorted in descending order, and the top-k features with a cumulative importance reaching a predetermined threshold (e.g., 95%) are selected to form the optimal simplified feature subset. Then, based on the optimal feature subset and the target variable, the final prediction model XGBoost is retrained. Ultimately, this enables real-time and high-precision prediction of GQI using the on-site monitoring data corresponding to the optimal feature subset. SWI This completely eliminates the reliance on complex water chemistry tests.
[0019] This invention addresses the shortcomings of traditional seawater intrusion monitoring methods, such as high cost, low efficiency, and difficulty in real-time monitoring, by utilizing environmental characteristics that are easy to monitor continuously on-site for GQI (Gas Quality Index). SWI This method provides real-time, high-precision predictions, addressing the feature misselection defects caused by the conventional SHAP simple averaging method's neglect of sample physical reliability. It effectively filters out spurious correlations and noise interference, thereby ensuring consistency between the model's logic and physical mechanisms and improving the model's generalization ability. Furthermore, the cumulative importance threshold in step 5 is not limited to 95% and can be selected within the range of 90%-99% based on different trade-offs between model simplification and prediction accuracy in practical applications.
[0020] Further, step 1.2, the Global Quality Index (GQI) for seawater intrusion. SWI It can comprehensively characterize the complex freshwater-seawater mixing and geochemical processes, thus providing more comprehensive information than a single water chemistry indicator (such as Cl). - A more representative and reliable measure of the degree of seawater intrusion (concentration) is calculated using the following formula:
[0021] ;
[0022] ;
[0023] ;
[0024] All ion concentrations are expressed in meq / L. and These represent the total cation and total anion concentrations of each groundwater sample, respectively. , and These represent the chloride ion concentrations in the sample, freshwater, and seawater, respectively; if local data is unavailable, the freshwater chloride ion concentration can be assumed to be 0 meq / L, and the seawater chloride ion concentration can be assumed to be 566 meq / L; the Global Quality Index (GQI) for seawater intrusion. SWI The value ranges from 0 to 100, with lower values indicating a higher degree of seawater intrusion.
[0025] Further, in step 1.3, the interquartile range (IQR) is used to define the normal range of data points in the dataset as being between [Q1 - 1.5 × IQR] and [Q3 + 1.5 × IQR]; where Q1 and Q3 are the first and third quartiles of the data (the 25th and 75th percentiles), respectively, and IQR is the interquartile range (Q3 - Q1); any data point falling outside this range is considered a potential outlier, and all outlier data points are removed.
[0026] Furthermore, in step 2, the quantitative and source-specific model solves for the G and F matrices by minimizing the objective function Q. The formula for calculating Q is as follows:
[0027] ;
[0028] Where Q is used to measure the sum of squares of the residuals between the observed values and the model predictions, and is weighted by uncertainty; It is a sample concentration matrix The concentration of the j-th water chemical ion in the i-th sample; yes The uncertainty is generally provided by the testing laboratory.
[0029] Furthermore, the feature importance value in step 3 The calculation formula is as follows:
[0030] This value measures the prediction of feature j for sample i. Compared to the baseline (benchmark value) The contribution of SHAP; the SHAP value satisfies the additive property, that is, the predicted value of any sample i is equal to the predicted value of SHAP. equal to the baseline value Sum of all feature contribution values:
[0031] ;
[0032] in It is the average predicted value of all samples, while It is the total number of features;
[0033] The calculation formula is:
[0034] ;
[0035] Where N is the set of all features, and S is the subset of features in N that does not contain feature j. and These represent the model's predicted values on feature subsets that include feature j and feature subsets that do not include feature j, respectively.
[0036] Furthermore, during the training of the XGBoost model in steps 3 and 5, temporal cross-validation (TSCV) and Bayesian optimization are used for hyperparameter tuning. The specific methods are as follows:
[0037] Using Bayesian optimization as the global search framework, the system intelligently explores the well-defined hyperparameter space. The objective function of Bayesian optimization is set to minimize the root mean square error (RMSE) of the model on the validation set. In each iteration, the Bayesian optimizer uses its Gaussian process surrogate model and acquisition function to recommend a new set of the most promising hyperparameter combinations.
[0038] Subsequently, to accurately evaluate the performance of this set of hyperparameters, a 5-fold TSCV mechanism was used for validation. During validation, the prediction dataset was divided into five consecutive training-validation pairs. Each validation set was trained using all its previous historical data, effectively preventing future information leakage. Finally, the average RMSE of the five validations was calculated as the output of the black-box function and fed back to the Bayesian optimizer to update its surrogate model.
[0039] Through this iterative and intelligent trial-and-error process, compared to random or grid search, this invention can converge to the optimal hyperparameter configuration with the smallest RMSE and the strongest generalization ability in time series prediction scenarios more quickly and effectively.
[0040] Beneficial effects: Compared with the prior art, the present invention has the following advantages:
[0041] 1. Prominent Application Value. This invention realizes the application of GQI by utilizing environmental characteristics that are easy to monitor continuously on-site. SWI The real-time prediction capability completely solves the technical bottlenecks of traditional monitoring methods in terms of real-time performance and low cost.
[0042] 2. Improved prediction accuracy and mechanism reliability: Guided by a physical mechanism, this invention enables the model to effectively filter out all key features, resulting in a high prediction accuracy R0 on the test set. 2 The score reached 0.885, which is significantly better than the conventional SHAP feature selection method.
[0043] 3. High reliability and interpretability of the mechanism. This invention not only provides prediction results but also ensures the consistency between the internal logic and physical laws of the model. Through SHAP interactive analysis, it is demonstrated that the model has learned complex mechanisms such as "the layers affected by agricultural activities such as irrigation are in paddy fields at 0-200cm" and "the layers affected by seawater intrusion are in dry land and paddy fields at 300-400cm", which are consistent with the physical zoning laws shown by quantitative and source-specific models, making the "black box" model transparent and reliable. Attached Figure Description
[0044] Figure 1 This is a schematic diagram of the overall process of the present invention;
[0045] Figure 2 The following is a comparison chart showing the prediction performance of the XGBoost model under different feature selection methods in the example.
[0046] Figure 3 Here is a scatter plot of XGBoost model predictions versus observations on the test set for different feature selection methods, as shown in the example: Figure 3 The left image in the figure is a scatter plot obtained by the present invention; Figure 3 The right image in the image is a scatter plot obtained using the conventional SHAP feature selection method;
[0047] Figure 4 The graph shows the changes in XGBoost model predictions and observations over time under different feature selection methods on the test set of the example (February 11, 2024 - March 23, 2024). Figure 4 The solid line in the figure represents the result of this invention. Figure 4 The dashed line in the image represents the result obtained using the conventional SHAP feature selection method.
[0048] Figure 5 This is a comparison chart showing the patterns between the quantitative source-specific model and the final XGBoost prediction model in the examples: Figure 5 The left figure shows the standardized contribution of the three source factors obtained by the quantitative source model under different land use types and sampling depths; Figure 5 The right figure shows the distribution of SHAP values of the final XGBoost prediction model under different land use types and sampling depths. Detailed Implementation
[0049] The technical solution of the present invention will be described in detail below, but the scope of protection of the present invention is not limited to the embodiments described.
[0050] like Figure 1 As shown, the real-time prediction method for seawater intrusion based on physical mechanism-guided feature selection of the present invention includes the following steps:
[0051] Step 1: Construct a seawater intrusion prediction dataset;
[0052] Step 1.1: Obtain the environmental characteristics of the site in real time. The environmental characteristics include land use type, sampling depth, rainfall, evaporation, tidal level, tidal range, groundwater level and groundwater temperature.
[0053] Simultaneously, groundwater samples from different depths in groundwater wells under different land use types were collected and sent to the laboratory for testing. The results of the groundwater sample hydrochemical analysis included the concentrations of the following eight ions: Na+ + K + Ca 2+ Mg 2 + Cl - SO4 2- HCO3 - and NO3 - ;
[0054] Step 1.2: Calculate the target variable, the Comprehensive Seawater Intrusion Index (GQI), using water chemistry indicators. SWI ;
[0055] Step 1.3: Use the interquartile range (IQR) method to analyze environmental characteristics and the combined seawater intrusion index (GQI).SWI Outlier screening and removal were performed; environmental characteristics were used as feature variables, with the seawater intrusion comprehensive index (GQI) as the key indicator. SWI Build a prediction dataset for the target variable;
[0056] Step 2: Construct a quantitative and source-specific model and obtain the physical mechanism weights for each sample. The detailed method is as follows:
[0057] First, a quantitative and source-specific model was constructed using eight hydrochemical indicators of ions to identify and quantify the standardized contribution of seawater intrusion sources to each groundwater sample i. Standardization contribution As the weight of the physical mechanism, the expression for the quantitative source-specific model is: ;
[0058] in, It refers to a sample concentration matrix containing n samples and m chemical substances; It refers to a source characteristic spectrum matrix with p source factors and m chemical substances. It is the source contribution matrix of n samples to p source factors, used to describe the standardized contribution of each source factor to any given sample. , It refers to the residual matrix containing n samples and m chemical substances;
[0059] Step 3: Train the initial model XGBoost and calculate the sum of all features for all samples. The detailed method is as follows: Use the environmental features in the prediction dataset from step 1 as input feature variables, and use the seawater intrusion comprehensive index (GQI) as the input feature variable. SWI As the target variable, an initial prediction model XGBoost is trained, and the SHAP method is used to calculate the feature importance value of environmental feature j to each sample i. ;
[0060] Step 4: Calculate feature importance using physical mechanism weights, i.e., use the obtained mechanism weights. As a weighting coefficient, it affects the feature importance value. We perform a weighted calculation to obtain the overall feature importance. The calculation formula is:
[0061] ;
[0062] Step 5: Select the optimal simplified feature set, retrain the final prediction model, and make predictions. Specifically, this involves assessing the overall feature importance obtained in Step 3. The features are sorted in descending order, and the top-k features whose cumulative importance reaches a predetermined threshold are selected to form the optimal simplified feature subset. Then, based on the optimal feature subset and the target variable, the final prediction model XGBoost is retrained. Finally, the field monitoring data corresponding to the optimal feature subset is utilized.
[0063] This invention overcomes the shortcomings of traditional monitoring methods, such as high cost, low efficiency, and difficulty in real-time monitoring. By utilizing environmental characteristics that facilitate continuous on-site monitoring, it enables the measurement of the Global Quality Index (GQI), which previously required complex laboratory testing. SWI Real-time high-precision prediction.
[0064] Step 1.2 of this embodiment: Global Quality Index (GQI) SWI The calculation formula is as follows:
[0065] ;
[0066] ;
[0067] ;
[0068] All ion concentrations are expressed in meq / L. and These represent the total cation and total anion concentrations of each groundwater sample, respectively. , and These represent the chloride ion concentrations in the sample, freshwater, and seawater, respectively.
[0069] In step 1.3 of this embodiment, the interquartile range (IQR) is used to define the normal range of data points in the dataset as being between [Q1 - 1.5 × IQR] and [Q3 + 1.5 × IQR].
[0070] Q1 and Q3 are the first and third quartiles of the data, respectively, and IQR is the interquartile range (Q3-Q1). Any data point falling outside this range is considered a potential outlier, and all outlier data points are then removed.
[0071] Step 2: The quantitative and source-specific model solves for the G and F matrices by minimizing the objective function Q. The formula for calculating Q is as follows:
[0072] ;
[0073] Where Q is used to measure the sum of squares of the residuals between the observed values and the model predictions, and is weighted by uncertainty; It is a matrix The concentration of the j-th water chemical ion in the i-th sample; yes The uncertainty.
[0074] like Figure 2 As shown, the feature importance values in this embodiment The calculation formula is as follows:
[0075] ;
[0076] Where N is the set of all features, and S is the subset of features in N that does not contain feature j. and These represent the model's predicted values on feature subsets that include feature j and feature subsets that do not include feature j, respectively; the formula for calculating the predicted values is as follows:
[0077] ;
[0078] In the above formula It is the average predicted value of all samples, while It represents the total number of features.
[0079] Steps 3 and 5, during the training of the XGBoost model, employ Temporal Cross-Validation (TSCV) and Bayesian optimization for hyperparameter tuning. The specific methods are as follows:
[0080] Using Bayesian optimization as the global search framework, the hyperparameter space is explored. The objective function of Bayesian optimization is set to minimize the root mean square error (RMSE) of the model on the validation set. In each iteration, the Bayesian optimizer uses its Gaussian process surrogate model and acquisition function to recommend a new set of the most promising hyperparameter combinations. Subsequently, a 5-fold TSCV mechanism is used for validation. During validation, the dataset is divided into five consecutive training-validation pairs, and each validation set is trained using all its previous historical data. Finally, the average RMSE of the five validations is calculated as the output of the black-box function and fed back to the Bayesian optimizer to update its surrogate model.
[0081] To further verify the technical effectiveness of the present invention, this embodiment employs a real-time prediction method for seawater intrusion based on physical mechanism-guided feature selection, using the optimal XGBoost model to predict GQI. SWI .
[0082] First, in the data preparation phase, the raw dataset containing 407 time-series water samples was analyzed. This dataset includes eight feature variables (tidal level, tidal range, groundwater level, groundwater temperature, rainfall, evaporation, land use, and sampling depth) and one target variable, GQI. SWI .
[0083] Subsequently, a quantitative and source-specific model was constructed to determine the concentrations of eight major ions (Na+, Na ... + K + Ca2+ Mg 2+ Cl - SO4 2- HCO3 - NO3 - Quantitative source apportionment was performed, and three physically significant factors were successfully separated. Among them, the seawater intrusion source factor was identified due to its position in the main seawater ion (Na+). + and Cl - The high loading on the factor was identified as a source of seawater intrusion, explaining 66.2% of the total variance. The standardized contribution of this seawater intrusion factor to each sample is shown below. The output is the weight of the physical mechanism.
[0084] Next, the model enters the feature selection stage guided by the mechanism. First, it utilizes eight environmental features and the target variable GQI. SWI Train the initial prediction model XGBoost and calculate the SHAP value of each feature for each sample. Conventional feature importance ranking usually involves... This invention introduces a simple average of the absolute values. As a weighting coefficient, for The mechanism of obtaining feature j by weighted summation of absolute values yields a reliable global feature index. Ultimately, through the study of... Sort the features in descending order and select the feature subsets whose cumulative importance reaches the 95% threshold.
[0085] This embodiment successfully corrects feature ranking through mechanism guidance, increasing the importance of land use and decreasing the importance of rainfall. Ultimately, this method eliminates the rainfall feature and obtains the optimal simplified feature subset consisting of the remaining 7 features. However, the existing conventional SHAP feature selection method eliminates land use while retaining the other 7 features.
[0086] The final prediction model XGBoost, retrained based on the obtained feature subset, achieves a significant performance breakthrough: the prediction accuracy R on the test set is... 2 The value increased from 0.667 using the conventional method to 0.885. Figure 3 Here is a scatter plot of XGBoost model predictions versus observed values on the test set for different feature selection methods, as shown in the example: Figure 4 This is a graph showing the changes in XGBoost model predictions and observed values over time (February 11, 2024 - March 23, 2024) under different feature selection methods on the test set. Figure 3 and Figure 4 Experimental comparisons show that the prediction effect of the present invention is closer to the true value.
[0087] Figure 5 This is a comparison chart showing the patterns between the quantitative source-specific model and the final XGBoost prediction model. Figure 5 The left figure shows the standardized contribution of the three source factors obtained by the quantitative source model under different land use types and sampling depths; Figure 5 The right figure shows the SHAP value distribution of the final XGBoost prediction model under different land use types and sampling depths. Analysis reveals that the model learns complex mechanisms consistent with the physical zoning patterns exhibited by quantitative and source-specific models, such as "the layers affected by agricultural activities like irrigation are in paddy fields (0-200cm)" and "the layers affected by seawater intrusion are in dry land and paddy fields (300-400cm)." This makes the "black box" model transparent and reliable. This high-precision and highly generalizable prediction model provides technical support for real-time, low-cost early warning of seawater intrusion.
Claims
1. A seawater intrusion real-time prediction method based on physical mechanism guided feature selection, characterized in that, The method comprises the following steps: Step 1, constructing a seawater intrusion prediction dataset; Step 1.1, obtaining the environmental characteristics monitored in real time on site, the environmental characteristics including land use type, sampling depth, rainfall, evaporation, tidal level, tidal range, groundwater level and groundwater temperature; At the same time, groundwater samples at different depths of groundwater wells under different land use types are collected and sent to the laboratory for detection to obtain the water chemical analysis results of the groundwater samples. The analysis results include the concentrations of the following eight ions: Na + , K + , Ca 2+ , Mg 2+ , Cl - , SO4 2- , HCO3 - and NO3 - ; Step 1.2, calculate target variable seawater intrusion comprehensive index GQI by water chemical index SWI ; Step 1.
3. Using the interquartile range (IQR) method to screen and remove outliers of environmental characteristics and the comprehensive index of seawater intrusion (GQI) SWI Step 2.
1. Screening and removing outliers of environmental characteristics and the comprehensive index of seawater intrusion (GQI) SWI Step 2.
2. Building a prediction dataset with environmental characteristics as the characteristic variable and the comprehensive index of seawater intrusion (GQI) as the target variable Step 2, constructing a quantitative source model and obtaining the physical mechanism weight of each sample, the detailed method being: Firstly, the quantitative source apportionment model was constructed by using eight ions as water chemistry indicators to identify and quantify the normalized contribution of each groundwater sample i from seawater intrusion source The normalized contribution of each groundwater sample i from seawater intrusion source was calculated as follows: As the physical mechanism weight, the expression of the quantitative source apportionment model was as follows: wherein, is a sample concentration matrix comprising n samples and m chemical species; is a source signature matrix having p source factors and m chemical species, is a source contribution matrix of n samples to p source factors, describing the normalized contribution of each source factor to any given sample , is a residual matrix comprising n samples and m chemical species; Step 3, training the initial model XGBoost and calculating the value of all features corresponding to all samples , the detailed method is: taking the environmental features in the prediction data set in step 1 as input feature variables, taking the seawater intrusion comprehensive index GQI SWI as the target variable, training the initial prediction model XGBoost, and calculating the feature importance value of environmental feature j for each sample i by SHAP method ; Step 4, calculate the feature importance using the physical mechanism weight, i.e. using the resulting mechanism weight As a weighting coefficient, the feature importance value is weighted to obtain the overall feature importance The calculation formula is: ; Step 5: Select the optimal simplified feature set, retrain the final prediction model, and make predictions. Specifically, this involves assessing the overall feature importance obtained in Step 3. The features are sorted in descending order, and the top-k features whose cumulative importance reaches a predetermined threshold are selected to form the optimal simplified feature subset. Then, based on the optimal feature subset and the target variable, the final prediction model XGBoost is retrained. Finally, the field monitoring data corresponding to the optimal feature subset is utilized. 2.The real-time prediction method for seawater intrusion based on physical mechanism guided feature selection according to claim 1, wherein, Step 1.2 Calculation of the Groundwater Intrusion Index GQI SWI The formula for the calculation of the Groundwater Intrusion Index GQI is as follows: ; ; ; where all ion concentrations are expressed in meq / L; and represent the total cation and total anion concentrations, respectively, for each groundwater sample; , and represent the chloride concentrations for the sample, fresh water, and sea water, respectively. 3.The real-time prediction method for seawater intrusion based on physical mechanism guided feature selection according to claim 1, wherein, Step 1.3, using the interquartile range IQR method to define the normal range of data points in the dataset between [Q1-1.5xIQR] and [Q3+1.5xIQR]; Wherein, Q1 and Q3 are the first and third quartiles of the data respectively, and IQR is the interquartile range; any data point falling outside this range is regarded as a potential outlier, and then all abnormal data points are removed. 4.The method of claim 1, wherein, Step 2, the quantitative source model is solved by minimizing the objective function Q, and the calculation formula of Q is as follows: ; where Q is the sum of squares of the residuals between the observed values and the model predicted values, weighted by the uncertainty; is the concentration matrix of the samples is the concentration of the jth water chemical ion of the ith sample in the concentration matrix of the samples is the uncertainty of the concentration of the jth water chemical ion of the ith sample in the concentration matrix of the samples.
5. The method of claim 1, wherein, The step 3 feature importance value The formula for calculating the step 3 feature importance value is as follows: ; where N is the set of all features, S is a subset of N that does not contain feature j, and represent the predicted value of the model on a subset of features that contains or does not contain feature j, respectively; the formula for the predicted value is as follows: ; In the above formula is the average predicted value of all samples, while is the total number of features. 6.The method of claim 1, wherein, Step 3 and step 5, in the training process of the XGBoost model, the time series cross validation method TSCV and Bayesian optimization are used for hyperparameter tuning, and the specific method is: Taking Bayesian optimization as a global search framework, the hyperparameter space is explored, and the objective function of Bayesian optimization is set to minimize the root mean square error RMSE of the model on the validation set; In each iteration, the Bayesian optimizer uses its Gaussian process surrogate model and acquisition function to recommend a new set of the most promising hyperparameter combinations; Then, the 5-fold TSCV mechanism is used for verification; when verifying, the prediction dataset is divided into five consecutive training-validation pairs, and each validation set is trained by all the historical data before it; Finally, the average RMSE of the five verifications is calculated as the output of the black box function, and fed back to the Bayesian optimizer to update its surrogate model.