Underground water quality grading prediction method based on multi-source data fusion and machine learning
By combining water quality and non-water quality indicators and using machine learning models to fusion of multi-source data, the problem of insufficient groundwater quality prediction accuracy in the existing technology is solved, and more accurate water quality level prediction is achieved, which is suitable for groundwater environmental monitoring and water resource management.
Patent Information
- Application Number
- CN202510595920.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-08-15
AI Technical Summary
The prior art only considers water quality indicators when predicting groundwater quality, and fails to make full use of non-water quality indicators, resulting in insufficient prediction accuracy.
Combining water quality indicators and non-water quality indicators, we establish a prediction model through multi-source data fusion and machine learning, and train and verify using XGBoost, artificial neural networks and deep learning models to optimize model parameters to prevent overfitting and achieve accurate prediction of water quality levels.
It improves the accuracy and stability of groundwater quality rating prediction, can better reflect the water quality conditions in the target area, and is suitable for groundwater environmental monitoring and water resource management.
Smart Images

Figure CN120494621A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a groundwater quality classification prediction method, belonging to the technical field of environmental monitoring and water resource management. Background Art
[0002] To ensure safe drinking water supplies in the future, it is essential to understand the quality and contamination levels of existing groundwater. High-precision water quality prediction is key to controlling water pollution and improving water management. Current groundwater quality predictions are based on calculating EWQI values based on groundwater quality indicators and then further categorizing them. This method only considers groundwater quality indicators and does not account for the impact of non-water quality factors on groundwater quality. Therefore, there is significant room for improvement in prediction accuracy. Summary of the Invention
[0003] Purpose of the invention: The technical problem to be solved by the present invention is to address the shortcomings of the existing technology and provide a groundwater quality classification prediction method based on multi-source data fusion and machine learning. This method combines water quality indicators and non-water quality indicators, establishes a prediction model based on machine learning, and can quickly and accurately predict the groundwater quality grade.
[0004] In order to solve the above technical problems, the present invention discloses a groundwater quality classification prediction method based on multi-source data fusion and machine learning, comprising:
[0005] S1. Constructing a sample set: Collect groundwater samples from all sampling points in the target area within the same time period, analyze and obtain water quality indicators, and construct attribute vectors of the groundwater samples together with non-water quality indicators; determine the EWQI value of the groundwater samples, classify the water quality according to the EWQI value, and use the water quality grade as the sample label;
[0006] S2, divide the sample set into training set and validation set;
[0007] S3. Use the training set to train the prediction model based on machine learning, and the validation set to prevent overfitting in the training process, and obtain a trained prediction model;
[0008] S4. Use the trained prediction model to predict the groundwater sample to obtain the predicted water quality level.
[0009] Furthermore, the water quality indicators include conventional water quality indicators and characteristic water quality indicators. The conventional water quality indicators include: pH value, total dissolved solids TDS, total hardness TH, Ca 2+ concentration, Mg 2+ concentration, Na + concentration, K + concentration, HCO3ˉ concentration, Clˉ concentration, SO4 2- concentration, NO3 -concentration, Fˉ concentration and PO4 3- Concentration; the characteristic water quality indicators include the concentration of characteristic pollutants in the target area.
[0010] Furthermore, the non-water quality indicators are numerical expressions of land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters and geological factor parameters at the sampling point at the sampling time.
[0011] Furthermore, determining the EWQI value of the groundwater sample, classifying the water quality grade according to the EWQI value, and using the water quality grade as a label for the sample includes the following steps:
[0012] S11, for M t For the analysis of groundwater samples collected from all sampling wells in the target area within the time period t, m is the number of sampling wells in the target area. The water quality indicators obtained by analyzing the water samples collected from each well include n water quality parameters, which are expressed as a matrix:
[0013]
[0014] where p ij represents the jth water quality parameter obtained by analyzing the groundwater sample collected from the i-th sampling well, i = 1, 2, 3, ..., m, j = 1, 2, 3 ... n;
[0015] S12, matrix M t After standardization, M t The element r in row i and column j ij for:
[0016]
[0017] S13. Calculate the entropy value of each water quality parameter. The entropy value of the j-th water quality parameter is E j for:
[0018] where e ij for:
[0019] S14. Calculate the entropy weight of each water quality parameter. The entropy weight W of the j-th water quality parameter is j for:
[0020]
[0021] S15. Calculate the matrix M t Corresponding parameter quality score The parameter quality score Q of the jth water quality parameter of the i-th well is ij for:
[0022] Among them C test,ij M t The measured value of the jth water quality parameter in the i-th well, C test,ij =p ij ; C best,j is the ideal value of the jth water quality parameter, S std,j Indicates the jth water quality parameter standard value recommended by the Groundwater Quality Standard;
[0023] Calculate the EWQI value of the groundwater sample from each sampling well. The EWQI value of the i-th sampling well is:
[0024] S16, according to EWQI i The value of the groundwater quality grade G at the location of the i-th well is obtained i , G i As samples i =[p i1 ,p i2 ,…,p in ] tag.
[0025] Furthermore, the numerical expressions of the land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters and geological factor parameters of the sampling point at the sampling time are determined by:
[0026] Label encoding is performed on land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters and geological factor parameters, and the encoded values are used as the numerical expressions of the corresponding parameters.
[0027] Furthermore, the prediction model based on machine learning is XGBoost, the maximum depth of the tree is set to 6, the learning rate is set to 0.1, the number of iterations is set to 100, the subsample sampling ratio is set to 0.8, the feature sampling ratio is set to 0.8, and the random seed is set to 42.
[0028] Furthermore, the prediction model based on machine learning is an artificial neural network. The feature dimension of the input layer is the attribute vector dimension of the groundwater sample. The first layer is a fully connected layer containing 64 neurons, and the activation function uses ReLU, followed by a Dropout layer with a dropout rate of 0.3; the middle layer is a fully connected layer with 32 neurons, and the activation function uses ReLU, followed by a Dropout layer with a dropout rate of 0.2; the number of neurons in the output layer is the number of water quality levels, and the Softmax activation function is used.
[0029] Furthermore, the prediction model based on machine learning is a deep learning model. The input layer is a fully connected layer containing 128 neurons, the activation function is ReLU, and batch normalization is introduced, followed by a Dropout layer with a dropout rate of 0.4; the middle layer includes two fully connected layers with 64 and 32 neurons respectively. Each fully connected layer uses the ReLU activation function, and a Dropout layer is set between the two fully connected layers with a dropout rate of 0.3; the number of neurons in the output layer is the number of water quality levels, and the Softmax activation function is used.
[0030] Furthermore, the step S2 divides the sample set into a training set, a validation set and a test set;
[0031] The step S3 uses the training set to train multiple prediction models based on machine learning;
[0032] The test set is used to test multiple trained prediction models, and the optimal model is selected as the final prediction model to predict the groundwater samples to obtain the predicted water quality level.
[0033] Furthermore, the method of using a test set to test the trained multiple prediction models and selecting the optimal model includes:
[0034] Input the samples in the test set into each trained prediction model to obtain the prediction results;
[0035] Calculate the evaluation index of each prediction model, the evaluation index includes:
[0036]
[0037] Where K is the number of samples in the test set, b k and b k ′ are the predicted value and true value of the kth sample in the test set, b mean It is the average of the prediction results of multiple prediction models for the kth sample in the test set;
[0038] Calculate the total evaluation index: J = α1MSE + α2RSR + α3(1-R 2 )+α4MAPE;
[0039] α1, α2, α3, and α4 are preset evaluation weight coefficients;
[0040] The model with the smallest total evaluation index value is selected as the optimal model.
[0041] Beneficial Effects: The disclosed method for predicting groundwater quality grades based on multi-source data fusion and machine learning integrates water quality indicators and non-water quality indicators, incorporating multi-source data into water quality grade prediction, enabling more accurate predictions of target area water quality grades. This method also leverages the strengths of machine learning models and optimizes model parameters using cross-validation techniques, thereby improving model stability and generalization capabilities. This method is widely applicable to groundwater environmental monitoring, sustainable water resource management, and related decision support systems, demonstrating promising practical value and widespread adoption. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more apparent.
[0043] Figure 1 This is one of the flow charts of the groundwater quality classification prediction method based on multi-source data fusion and machine learning disclosed in the embodiments;
[0044] Figure 2 This is the second flowchart of the groundwater quality classification prediction method based on multi-source data fusion and machine learning disclosed in the embodiment;
[0045] Figure 3 A map of groundwater sampling points in the target area in the embodiment;
[0046] Figure 4 : This is the spatial distribution diagram of water quality levels in the embodiment. DETAILED DESCRIPTION
[0047] The present invention discloses a groundwater quality classification prediction method based on multi-source data fusion and machine learning. Figure 1 Shown, including:
[0048] S1. Constructing a sample set: Collect groundwater samples from all sampling points in the target area during the same time period, analyze and obtain water quality indicators, and construct attribute vectors of the groundwater samples together with non-water quality indicators; determine the EWQI value of the groundwater samples, classify the water quality according to the EWQI value, and use the water quality grade as the sample label;
[0049] S2, divide the sample set into training set and validation set;
[0050] S3. Use the training set to train the prediction model based on machine learning, and the validation set to prevent overfitting in the training process, and obtain a trained prediction model;
[0051] S4. Use the trained prediction model to predict the groundwater sample to obtain the predicted water quality level.
[0052] This embodiment takes a certain research area A as an example to explain in detail the process as follows: Figure 2 As shown. Groundwater flow in Area A is from southeast to northeast. The permeability of the alluvial layer in the area is estimated to be 467 m2 / day, the average annual rainfall is 1260 mm / year, and the lowest and highest temperatures occur in winter (5°C) and summer (48°C), respectively (DSR, 2018). Groundwater level data from 63 sampling points within the study area between 2019 and 2023 were obtained from the official website of the China Resources and Environmental Science and Data Platform System (https: / / www.resdc.cn / ) to construct the sample set. Multiple surveys were conducted in the area between 2019 and 2023, with sampling at 63 sampling wells in each survey. Each survey was conducted within a single month, with each month considered to be the same time period. During the pre-monsoon period (2019-2023), the average groundwater depth within the study area varied between 5 and 10 m, while during the post-monsoon period, the average groundwater depth varied between 2 and 6 m.
[0053] Step 1: 63 sampling points in the region cover the entire study area, see Figure 3 As shown. Groundwater samples are collected at each sampling point and analyzed to obtain water quality indicators. The water quality indicators in this embodiment include conventional water quality indicators and characteristic water quality indicators. The conventional water quality indicators include: pH value, total dissolved solids TDS, total hardness TH, Ca 2+ concentration, Mg 2+ concentration, Na + concentration, K + concentration, HCO3ˉ concentration, Clˉ concentration, SO4 2- concentration, NO3 - concentration, Fˉ concentration and PO4 3- concentration, a total of 13 conventional water quality parameters; the characteristic water quality indicators include the concentrations of characteristic pollutants in the target area. After investigation and confirmation, the characteristic pollutants in the target area A in this embodiment are copper and vinyl chloride, so the characteristic water quality indicators include two parameters: copper ion concentration and vinyl chloride concentration. In this way, the water quality indicators have a total of 15 water quality parameters. Before sampling, the sample collection bottle was rinsed twice with distilled water to remove residual impurities and pollutants in the bottle, avoid cross-contamination, and avoid secondary pollution caused by the use of impure water sources such as tap water; the sample collection bottle was made of high-density polyethylene bottle. Immediately after sampling, the TDS and pH values were measured with a portable conductivity meter and pH meter. The groundwater samples were then preserved in an EPS thermocol refrigerator and taken to the laboratory. The samples were refrigerated at 4°C for further analysis. The pH value and TDS concentration were measured on site, while the other parameters were analyzed within 10 days after sample collection. The Na in the groundwater sample was analyzed using a flame photometer + Concentration and K +Concentration; SO4 is measured using colorimetry and a double-beam spectrophotometer 2- and PO4 3- concentration; HCO3ˉ concentration in groundwater samples using titration and a Microlit E burette; NO3 analysis using an electrode method and an ion meter (Metrohm 781) - concentration, Fˉ and Clˉ concentration; TH, Ca 2+ and Mg 2+ Concentration. The analytical precision of the data was obtained by screening water samples with an ion charge balance of ±10%. Duplicate subsamples of each groundwater sample were used to ensure quality control, and each subsample was analyzed four times. A preliminary check was performed on the four analytical results to see if there were any outliers: if there was one obvious outlier, it was removed and only the remaining three analytical results were retained. If there were two or more outliers, the analysis would need to be repeated or the subsample data would need to be discarded. If there were no obvious outliers or the remaining three results were stable after removal, their average value was used as the measured value of the sample.
[0054] Determining the EWQI value of the groundwater sample, classifying the water quality according to the EWQI value, and using the water quality grade as a label for the sample includes the following steps:
[0055] S11. Analyze groundwater samples collected from all sampling wells in the target area within a time period t, where m is the number of sampling wells in the target area. The water quality indicators obtained by analyzing the water samples collected from each well include n water quality parameters, which are expressed as a matrix:
[0056]
[0057] where p ij represents the jth water quality parameter obtained by analyzing the groundwater sample collected from the i-th sampling well, i = 1, 2, 3, ..., m, j = 1, 2, 3 ... n;
[0058] S12, matrix M t After standardization, M t The element r in row i and column j ij for:
[0059]
[0060] In this embodiment, there are 63 sampling points, that is, m is 63, and there are 15 water quality parameters in the water quality index, that is, n is 15.
[0061] S13. Calculate the entropy value of each water quality parameter. The entropy value of the j-th water quality parameter is E j for:
[0062] where e ij for:
[0063] S14. Calculate the entropy weight of each water quality parameter. The entropy weight W of the j-th water quality parameter is j for:
[0064]
[0065] Here D j is the diversity degree of the jth water quality parameter, D j =1-E j ; The calculated entropy weight W j Has the following properties: 0≤W j ≤1,
[0066] S15. Calculate the matrix M t Corresponding parameter quality score The parameter quality score Q of the jth water quality parameter of the i-th well is ij for:
[0067] Among them C test,ij M t The measured value of the jth water quality parameter in the i-th well, C test,ij =p ij ; C best,j is the ideal value of the jth water quality parameter, the ideal value of pH is 7, and the ideal values of other parameters are 0; S std,j represents the standard value of the jth water quality parameter recommended by the Groundwater Quality Standard (GB / T 14848-2017);
[0068] Calculate the EWQI value of the groundwater sample from each sampling well. The EWQI value of the i-th sampling well is:
[0069] S16, according to EWQI i The value of the groundwater quality grade G at the location of the i-th well is obtained i , G i As samples i =[p i1 ,p i2 ,…,p in ] tag.
[0070] The water quality indicators of the groundwater samples in this embodiment and the calculated EWQI statistics are shown in Table 1:
[0071] Table 1 Groundwater physicochemical parameters and calculated EWQI statistics
[0072]
[0073] Based on the calculated groundwater quality index (EWQI) values, water quality is divided into five grades: 0-50 (excellent), 51-100 (good), 101-150 (moderate), 151-200 (poor), and >200 (very poor). This gives the water quality grade for each sampling well.
[0074] Taking into account the various environmental factors that affect the quality level of groundwater, and not relying on a single source of evidence, the present invention also uses non-water quality indicators as sample attributes. The non-water quality indicators are numerical expressions of land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters, and geological factor parameters at the sampling point at the time of sampling. Specifically, land use parameters include the proportion of farmland, industrial land, residential areas, and green space; topographic parameters include altitude, elevation, slope, and watershed boundaries; hydrological characteristic parameters include rainfall, groundwater depth, water temperature, and flow rate; meteorological condition parameters include temperature, humidity, and wind speed; human activity parameters include regional industrial density, agricultural fertilization intensity, and population density; and geological factor parameters include soil type, stratigraphic structure, and lithology. Non-water quality indicators are structured summer data, which are encoded using LabelEncoding, and the encoded values are used as numerical expressions of the corresponding parameters. Therefore, the sample attribute vector includes water quality indicators and non-water quality indicators. The water quality indicators are 15-dimensional, and the non-water quality indicators are 21-dimensional, which together constitute a 36-dimensional attribute vector.
[0075] Step 2: Randomly divide the sample set constructed above into a training set and a validation set in a ratio of 80% and 20%. To ensure the randomness and balance of the data division, use a random number generator to shuffle the data.
[0076] Step 3: Use the training set to train the prediction model based on machine learning, and the validation set to prevent overfitting in the training process to obtain a trained prediction model;
[0077] The prediction model takes as input the attribute vectors of groundwater samples and outputs the water quality grade. Samples from the training set are fed into the model in batches, repeatedly tested to prevent overfitting. In each training iteration, a batch of data is fed into the model, and the model performs forward propagation based on the current parameters to calculate the predicted value. The mean squared error (MSE) is used as the loss function to calculate the error between the predicted value output by the model and the true value of the sample. The specific calculation formula is:
[0078]
[0079] Where N1 is the number of batch data samples, y h is the true value, p his the predicted value. Then, the gradient of the mean square error function with respect to the model parameters is calculated through the back-propagation algorithm. Based on the gradient information, the SGD algorithm is used to update the model weights and bias parameters. After each training epoch, the performance of the model is evaluated on the validation set. The loss value and other evaluation indicators such as accuracy and recall are calculated on the validation set. If the loss of the validation set does not decrease within 10 consecutive epochs, training is stopped to avoid overfitting. The loss value of the validation set is calculated according to the following formula:
[0080]
[0081] in, is the loss value of the validation set, y h represents the true value, represents the predicted value, and N2 is the number of samples in the validation set.
[0082] This embodiment compares three prediction models using extreme gradient boosting XGBoost, artificial neural network ANN and deep learning model DL. When the prediction model is XGBoost, the multi-classification objective function (objective = 'multi:softmax') is adopted, and the number of categories is dynamically determined according to the number of different categories in the label data set (num_class = len(y.unique())). The maximum depth of the tree is set to 6 (max_depth = 6) to control the complexity of the model and prevent overfitting. The learning rate (learning_rate) is set to 0.1 to balance the model convergence speed and performance. The number of weak classifiers, that is, the number of iterations (n_estimators), is set to 100. In addition, in order to enhance the generalization ability of the model, the subsample sampling ratio (subsample = 0.8) and the feature sampling ratio (colsample_bytree = 0.8) are set. The random seed (seed = 42) is used to ensure the repeatability of the experiment.
[0083] The ANN model is based on a Sequential structure. The feature dimension of the input layer is the attribute vector dimension of the groundwater sample. The first layer is a fully connected layer with 64 neurons, and the activation function uses ReLU, followed by a Dropout layer with a dropout rate of 0.3 to reduce the risk of overfitting; the middle layer is a fully connected layer with 32 neurons, and the activation function uses ReLU, followed by a Dropout layer with a dropout rate of 0.2; the number of neurons in the output layer is the number of water quality grades, and the Softmax activation function is used to achieve multi-classification output.
[0084] The DL model also uses a Sequential structure, but with deeper layers and a larger network size. First, a fully connected layer with 128 neurons is input, with the activation function being ReLU (activation = 'relu'), and batch normalization is introduced to accelerate convergence and improve stability. This is followed by a Dropout layer with a dropout rate of 0.4. The intermediate layers are successively set with fully connected layers of 64 and 32 neurons, each using the ReLU activation function, and a Dropout layer with a dropout rate of 0.3 is added after the 64-neuron layer to prevent overfitting. Finally, the output layer also sets the number of neurons according to the number of categories, and uses the Softmax activation function to complete the classification prediction.
[0085] Step 4: All three prediction models can accurately predict the level of groundwater quality.
[0086] This example evaluates three models and selects the optimal model as the final prediction model, specifically including:
[0087] Input the samples in the test set into each trained prediction model to obtain the prediction results;
[0088] Calculate the evaluation index of each prediction model, the evaluation index includes:
[0089]
[0090] Where K is the number of samples in the test set, b k and b k ′ are the predicted value and true value of the kth sample in the test set, b mean It is the average of the prediction results of multiple prediction models for the kth sample in the test set;
[0091] Calculate the total evaluation index: J = α1MSE + α2RSR + α3(1-R 2 )+α4MAPE;
[0092] α1, α2, α3, and α4 are preset evaluation weight coefficients; in this embodiment, the values of α1, α2, α3, and α4 are all set to 0.25.
[0093] The model with the smallest total evaluation index value is selected as the optimal model to predict the groundwater samples to be predicted.
[0094] In this example, the XGBoost model showed better performance in multiple evaluation indicators compared to other models. Specifically, its mean square error (MSE=7.0321) was significantly lower than that of other models, indicating that it has obvious advantages in prediction accuracy and error control. At the same time, the XGBoost model obtained a higher coefficient of determination R 2 (R 2 =0.7869), reflecting its excellent performance in fitting ability and explaining variable variance. Overall, XGBoost not only outperforms other models in predictive accuracy but also demonstrates strong comprehensive capabilities in execution efficiency and stability, further validating its applicability and reliability in this research scenario.
[0095] The prediction model outputs the water quality level at each sampling well location, thereby obtaining the water quality level of the target area as follows: Figure 4 As shown, the model prediction results show that most of the study area falls into the good to moderate category (approximately 87.10% of the total area), while the central, southeastern, and northwestern parts of the study area mainly fall into the "moderate" to "very poor" quality category. The relatively low groundwater quality in Study Area A may be due to the shallow groundwater table or ongoing intensive agricultural practices in the area.
[0096] The present invention provides a method and concept for groundwater quality classification prediction based on multi-source data fusion and machine learning. There are numerous methods and approaches for implementing this technical solution. The above is merely a preferred embodiment of the present invention. It should be noted that those skilled in the art may make various improvements and modifications without departing from the principles of the present invention, and such improvements and modifications are also within the scope of protection of the present invention. Any components not specified in this embodiment may be implemented using existing technologies.
Claims
1. A groundwater quality classification prediction method based on multi-source data fusion and machine learning, characterized by: include: S1. Constructing a sample set: Collect groundwater samples from all sampling points in the target area during the same time period, analyze and obtain water quality indicators, and construct attribute vectors of the groundwater samples together with non-water quality indicators; determine the EWQI value of the groundwater samples, classify the water quality according to the EWQI value, and use the water quality grade as the sample label; S2, divide the sample set into training set and validation set; S3. Use the training set to train the prediction model based on machine learning, and the validation set to prevent overfitting in the training process, and obtain a trained prediction model; S4. Use the trained prediction model to predict the groundwater sample to obtain the predicted water quality level.
2. The groundwater quality classification prediction method according to claim 1, characterized in that: The water quality indicators include conventional water quality indicators and characteristic water quality indicators. The conventional water quality indicators include: pH value, total dissolved solids TDS, total hardness TH, Ca 2+ concentration, Mg 2+ concentration, Na + concentration, K + concentration, HCO3ˉ concentration, Clˉ concentration, SO4 2- concentration, NO3 - concentration, Fˉ concentration and PO4 3- Concentration; the characteristic water quality indicators include the concentration of characteristic pollutants in the target area.
3. The groundwater quality classification prediction method according to claim 1, characterized in that: The non-water quality indicators are numerical expressions of land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters and geological factor parameters at the sampling point at the sampling time.
4. The groundwater quality classification prediction method according to claim 2, characterized in that: Determining the EWQI value of the groundwater sample, classifying the water quality according to the EWQI value, and using the water quality grade as a label for the sample includes the following steps: S11. Analyze groundwater samples collected from all sampling wells in the target area within a time period t, where m is the number of sampling wells in the target area. The water quality indicators obtained by analyzing the water samples collected from each well include n water quality parameters, which are expressed as a matrix: where p ij represents the jth water quality parameter obtained by analyzing the groundwater sample collected from the i-th sampling well, i = 1, 2, 3, ..., m, j = 1, 2, 3 ... n; S12, matrix M t After standardization, M t The element r in row i and column j ij for: S13. Calculate the entropy value of each water quality parameter. The entropy value of the j-th water quality parameter is E j for: where e ij for: S14. Calculate the entropy weight of each water quality parameter. The entropy weight W of the j-th water quality parameter is j for: S15. Calculate the matrix M t Corresponding parameter quality score The parameter quality score Q of the jth water quality parameter of the i-th well is ij for: Among them C test,ij M t The measured value of the jth water quality parameter in the i-th well, C test,ij =p ij ; C best,j is the ideal value of the jth water quality parameter, S std,j Indicates the jth water quality parameter standard value recommended by the Groundwater Quality Standard; Calculate the EWQI value of the groundwater sample from each sampling well. The EWQI value of the i-th sampling well is: SI ij =W j *Q ij ; S16, according to EWQI i The value of the groundwater quality grade G at the location of the i-th well is obtained i , G i As samples i =[p i1 ,p i2 ,…,p in ] tag.
5. The groundwater quality classification prediction method according to claim 3, characterized in that: The numerical expressions of the land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters and geological factor parameters at the sampling point at the sampling time are determined by: Label encoding is performed on land use parameters, topographic parameters, hydrological characteristic parameters, meteorological condition parameters, human activity parameters and geological factor parameters, and the encoded values are used as the numerical expressions of the corresponding parameters.
6. The groundwater quality classification prediction method according to claim 1, characterized in that: The prediction model based on machine learning is XGBoost, the maximum depth of the tree is set to 6, the learning rate is set to 0.1, the number of iterations is set to 100, the subsample sampling ratio is set to 0.8, the feature sampling ratio is set to 0.8, and the random seed is set to 42.
7. The groundwater quality classification prediction method according to claim 1, characterized in that: The prediction model based on machine learning is an artificial neural network. The feature dimension of the input layer is the attribute vector dimension of the groundwater sample. The first layer is a fully connected layer with 64 neurons, and the activation function uses ReLU, followed by a Dropout layer with a dropout rate of 0.3; the middle layer is a fully connected layer with 32 neurons, and the activation function uses ReLU, followed by a Dropout layer with a dropout rate of 0.2; the number of neurons in the output layer is the number of water quality grades, and the Softmax activation function is used.
8. The groundwater quality classification prediction method according to claim 1, characterized in that: The prediction model based on machine learning is a deep learning model. The input layer is a fully connected layer with 128 neurons, the activation function is ReLU, and batch normalization is introduced, followed by a Dropout layer with a dropout rate of 0.4; the middle layer includes two fully connected layers with 64 and 32 neurons respectively. Each fully connected layer uses the ReLU activation function, and a Dropout layer is set between the two fully connected layers with a dropout rate of 0.3; the number of neurons in the output layer is the same as the number of water quality levels, and the Softmax activation function is used.
9. The groundwater quality classification prediction method according to claim 1, characterized in that: Step S2 divides the sample set into a training set, a validation set, and a test set; The step S3 uses the training set to train multiple prediction models based on machine learning; uses the test set to test the trained multiple prediction models, selects the optimal model as the final prediction model to predict the groundwater sample to be predicted, and obtains the predicted water quality grade.
10. The groundwater quality classification prediction method according to claim 9, characterized in that: The method of using a test set to test multiple trained prediction models and selecting the optimal model includes: Input the samples in the test set into each trained prediction model to obtain the prediction results; Calculate the evaluation index of each prediction model, the evaluation index includes: Where K is the number of samples in the test set, b k and b k ′ are the predicted value and true value of the kth sample in the test set, b mean It is the average of the prediction results of multiple prediction models for the kth sample in the test set; Calculate the total evaluation index: J = α1MSE + α2RSR + α3(1-R 2 )+α4MAPE; α1, α2, α3, and α4 are preset evaluation weight coefficients; The model with the smallest total evaluation index value is selected as the optimal model.
Citation Information
Cited By
Underground water pollution risk assessment method based on underground water environment background value
CN121581653A
