Multispectral water quality prediction method and system based on adaptive random forest

The adaptive random forest and AdaBoost methods are used to process multispectral water quality data, which solves the problem of insufficient accuracy of existing water quality prediction methods in processing complex nonlinear and time-varying features, and achieves highly accurate and robust water quality prediction effects.

CN118673471APending Publication Date: 2024-09-20HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410743735.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-11
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing water quality prediction methods have insufficient prediction accuracy and robustness when dealing with water quality changes with complex nonlinear and time-varying characteristics, especially challenges in large-scale training samples and outlier processing.

Method used

A multispectral water quality prediction method based on adaptive random forest is used to preprocess measured data and multispectral remote sensing images to generate a comprehensive data set. The random forest algorithm and AdaBoost method are used for model training and integrated learning to reduce the risk of overfitting. , improve prediction accuracy and robustness.

Benefits of technology

It achieves highly accurate and robust prediction of water quality, can effectively handle high-dimensional data and noise, is suitable for large-scale water monitoring, and reduces the need for feature selection and dimensionality reduction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673471A
    Figure CN118673471A
Patent Text Reader

Abstract

The invention discloses a multispectral water quality prediction method and system based on an adaptive random forest. The method comprises the following steps: acquiring actual measurement data and a multispectral remote sensing image of a water body to be measured in a preset time period; preprocessing the acquired measured data and the multispectral remote sensing image; generating a comprehensive data set according to a preprocessing result, and dividing a training set and a test set; selecting a training set, training based on a random forest RF algorithm, and adjusting model parameters to obtain an optimized RF model; taking the optimized RF model as a weak regression device, carrying out integrated learning by adopting a Boosting method, and obtaining a self-adaptive random forest RFAdaBoost model as a strong regression device; selecting data of the test set, respectively utilizing an RF model and an RFAdaBoost model for prediction, and determining a water quality prediction model based on a prediction result; using the water quality prediction model to predict a to-be-detected water body; according to the method based on integrated learning, multiple base models can be combined, the risk of overfitting is reduced, and prediction accuracy and robustness are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a water quality prediction method and system, and in particular to a multi-spectral water quality prediction method and system based on adaptive random forest, belonging to the technical field of water quality prediction. Background Art

[0002] With the rapid development of industrialization, agriculture and urbanization in my country, water pollution has become increasingly serious, and has to a certain extent endangered the development of society and people's daily life. Therefore, my country is currently committed to monitoring and treating water quality to alleviate the shortage of water resources and protect human health.

[0003] Due to the complexity and uncertainty of biochemical processes in natural water bodies, water quality change is a dynamic process with typical nonlinear and time-varying characteristics. Predicting water quality change is a challenging problem in environmental research. Spectral remote sensing can obtain water reflectance spectral information using optical sensors with multiple discrete bands without contacting the water body. The subsequent use of random forests can effectively process high-dimensional data sets of multiple discrete bands without excessive feature selection or feature engineering. Data often contains various complex nonlinear relationships, and random forests can capture these complex relationships, thereby improving the predictive ability of the model.

[0004] At present, the grey prediction method and support vector machine are the water quality prediction methods. The grey prediction model is mainly used for short-term water quality prediction problems with strong trends and small fluctuations. In the case of less data, it can obtain relatively accurate prediction results. However, the SVM algorithm is difficult to implement for large-scale training samples and is sensitive to parameter adjustment and function selection. Summary of the invention

[0005] Purpose of the invention: The purpose of the present invention is to provide a multispectral water quality prediction method and system based on adaptive random forests that can improve prediction accuracy and robustness.

[0006] Technical solution: The multispectral water quality prediction method based on adaptive random forest described in the present invention comprises:

[0007] Step 1: Obtain measured data and multispectral remote sensing images of the water body to be measured for a preset time period;

[0008] Step 2: Preprocess the acquired measured data and multispectral remote sensing images;

[0009] Step 3: Generate a comprehensive data set based on the preprocessing results and divide it into a training set and a test set; select the training set, train it based on the random forest RF algorithm, and adjust the model parameters to obtain the optimized RF model;

[0010] Step 4: Use the optimized RF model as a weak regressor to train the trained RF model, use the Boosting method for ensemble learning, and obtain the adaptive random forest RF_AdaBoost model as a strong regressor to complete the training of the RF_AdaBoost model;

[0011] Step 5: Select the data of the test set, use the trained RF model and the trained RF_AdaBoost model to make predictions, and based on the prediction results, verify and evaluate the accuracy of the trained RF model and the trained RF_AdaBoost model to determine the water quality prediction model;

[0012] Step 6: Use the water quality prediction model to predict the water body to be tested.

[0013] Furthermore, step 1 is to obtain measured data of the water body to be tested for a preset time period. Specifically, within the preset time period, the water body to be tested is sampled by a multi-parameter water quality meter using a spectrophotometer, and filtered and acidified, the instrument is calibrated, a standard curve is prepared, and absorbance is measured to calculate the concentration data of the detection substance in the sample.

[0014] Furthermore, the step 1 of obtaining a multispectral remote sensing image of the water body to be measured within a preset time period specifically involves using a multispectral remote sensing sensor to collect images of the water body to be measured within a preset time period.

[0015] Furthermore, the specific method of step 2 is:

[0016] Step 2.1: Check the missing values ​​and outliers in the measured data, delete the outliers and treat them as missing values, use interpolation to fill all missing values, unify the units of all values, and then perform data normalization;

[0017] Step 2.2: Perform geometric correction, radiation calibration, atmospheric correction, feature extraction and spatial analysis on the multispectral remote sensing image to obtain the image data of the water body to be measured.

[0018] Furthermore, in step 2.1, all missing values ​​are filled by interpolation, and the specific method is as follows:

[0019] Given two known data points (x1, y1) and (x2, y2), let x be the horizontal coordinate of the missing value to be interpolated, x1<x<x2;

[0020] Calculate the proportion t of the horizontal coordinate x corresponding to the missing value between the known data points:

[0021]

[0022] Estimate the ordinate y of the missing value based on the ordinate of the known data point and the value of t. The linear interpolation formula is as follows:

[0023] y=y1+(y2-y1)×t

[0024] Furthermore, in the normalization process described in step 2.1, the normalization corresponding equation and the anti-normalization equation are respectively:

[0025]

[0026] q=(q max -q min )·p i ′+q m@n

[0027] In the formula, q is the normalized data, p i is the data filled by interpolation, p min and p max are the minimum and maximum values ​​of the data after interpolation, q min and q max as a parameter.

[0028] Furthermore, the specific method of step 3 is:

[0029] Step 3.1: Match the preprocessed measured data of the same time period with the multispectral remote sensing image, interpolate the measured data, and align the time points of the measured data with the multispectral remote sensing image; extract the spectral features of different bands from the multispectral remote sensing image, and splice and merge them with the interpolated measured data to generate a comprehensive data set;

[0030] Step 3.2: Divide the comprehensive dataset into training set and test set according to the preset ratio;

[0031] Step 3.3: Based on the RF algorithm, set the RF initial parameters, use the spectral data of different spectral bands as the input of the random forest model, use the corresponding water quality parameters as the output of the random forest model, and select the training set for training;

[0032] Step 3.4: Based on the number of RF decision trees and the minimum number of leaves, the model performance is optimized through the grid search method to obtain the optimized RF model.

[0033] Furthermore, the specific method of step 4 is:

[0034] Step 4.1: Use the trained RF model as a weak regressor, initialize the RF parameters, set the number of weak regressors K; initialize the weight D of each weak regressor so that the initial weights are evenly distributed;

[0035] Step 4.2: Weak regressor regression, loop iteration K times, each iteration training a weak regressor k;

[0036] Step 4.3: Use the TreeBagger function to train a weak regressor based on a decision tree, pass in the training set data, the number of decision trees, and the minimum number of leaves, and train the optimized RF model;

[0037] Step 4.4: Use the trained RF model to predict the training set and test set respectively; calculate the prediction error, and calculate the error between the predicted value and the actual value;

[0038] Step 4.5: Adjust the weight of the weak regressor according to the error. Specifically, when the error is greater than the preset threshold, increase the corresponding weight, otherwise keep it unchanged, and normalize it so that the sum of the weights is 1;

[0039] Step 4.6: Take a weighted average of the outputs of all weak regressors, use the adjusted weights to weight the sum of the prediction results of all weak regressors, and obtain the strong regressor with the adaptive random forest RF_AdaBoost model as the training of the RF_AdaBoost model;

[0040] Step 4.7: Use the mapminmax function to back-map the normalized output to the preprocessed data range.

[0041] Furthermore, the specific method of step 5 is:

[0042] Step 5.1: Use the trained RF model to predict the test set data;

[0043] Step 5.2: Use the trained RF_AdaBoost model to predict the test set data;

[0044] Step 5.3: Calculate the RMSE and R of the prediction results of step 5.1 and step 5.2 respectively. 2 and MAE;

[0045] Step 5.4: Evaluate the prediction performance according to the calculated results, and select the model corresponding to the result with better prediction performance as the water quality prediction model; the evaluation method is as follows: when RMSE and MAE are smaller, R 2 The closer it is to 1, the better the prediction performance of the corresponding model.

[0046] Based on the same inventive concept, the present invention also provides a multispectral water quality prediction system based on adaptive random forest, comprising:

[0047] The acquisition module is used to obtain the measured data and multispectral remote sensing images of the water body to be measured in a preset time period;

[0048] The preprocessing module preprocesses the acquired measured data and multispectral remote sensing images;

[0049] The optimization module is used to generate a comprehensive data set based on the preprocessing results, and divide it into a training set and a test set; select the training set, train it based on the random forest RF algorithm, and adjust the model parameters to obtain the optimized RF model;

[0050] The training module is used to train the optimized RF model as a weak regressor to obtain the trained RF model, and use the Boosting method for ensemble learning to obtain the adaptive random forest RF_AdaBoost model as a strong regressor to complete the training of the RF_AdaBoost model;

[0051] The comparison module is used to select the data of the test set, use the trained RF model and the trained RF_AdaBoost model to make predictions, and verify and evaluate the accuracy of the trained RF model and the trained RF_AdaBoost model based on the prediction results to determine the water quality prediction model;

[0052] The prediction module is used to use the water quality prediction model to predict the water body to be tested.

[0053] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages: 1. The present invention uses multispectral remote sensing technology to detect water quality, and its data has the characteristics of wide-area coverage and high spatiotemporal resolution, which can realize the monitoring of a large range of waters; 2. The present invention uses random forest and AdaBoost algorithms to effectively process high-dimensional data, which is suitable for a large amount of spectral feature data provided by multispectral remote sensing, and does not require excessive feature selection or dimensionality reduction processing; 3. Random forest and AdaBoost algorithms are both based on ensemble learning methods, which can combine multiple base models, reduce the risk of overfitting, and improve prediction accuracy and robustness; 4. Random forest and AdaBoost algorithms have strong robustness to outliers and noise, and can effectively process noise and anomalies in multispectral remote sensing data. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 is a flow chart of the method of the present invention;

[0055] Figure 2 It is a schematic diagram of the process of an embodiment of the present invention;

[0056] Figure 3 A schematic diagram of a data set merging method according to an embodiment of the present invention;

[0057] Figure 4 A schematic diagram of a water quality prediction model selection process according to an embodiment of the present invention;

[0058] Figure 5 Schematic diagram of comparison between the model prediction results and the true values ​​of an embodiment of the present invention. DETAILED DESCRIPTION

[0059] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.

[0060] As attached Figure 1 As shown, the multispectral water quality prediction method based on adaptive random forest in this embodiment includes:

[0061] Step 1: Obtain measured data and multispectral remote sensing images of the water body to be measured for a preset time period;

[0062] Step 2: Preprocess the acquired measured data and multispectral remote sensing images;

[0063] Step 3: Generate a comprehensive data set based on the preprocessing results and divide it into a training set and a test set; select the training set, train it based on the random forest RF algorithm, and adjust the model parameters to obtain the optimized RF model;

[0064] Step 4: Use the optimized RF model as a weak regressor to train the trained RF model, use the Boosting method for ensemble learning, and obtain the adaptive random forest RF_AdaBoost model as a strong regressor to complete the training of the RF_AdaBoost model;

[0065] Step 5: Select the data of the test set, use the trained RF model and the trained RF_AdaBoost model to make predictions, and based on the prediction results, verify and evaluate the accuracy of the trained RF model and the trained RF_AdaBoost model to determine the water quality prediction model;

[0066] Step 6: Use the water quality prediction model to predict the water body to be tested.

[0067] Specific steps, such as Figure 2 As shown: Step 1, collect lake water samples, determine the appropriate sampling points and sampling frequency, and strive to obtain the most representative samples at the lowest sampling frequency, which must not only meet the requirements of reflecting the water quality conditions, but also be practical. Collect lake water samples at five fixed locations in the lake at 8 am every day, store them in transparent plastic cups and label them separately, and the water sample storage time shall not exceed 24 hours.

[0068] The equipment needed for multi-parameter measurement includes a multi-parameter water quality meter, an intelligent multi-parameter digestion instrument, a portable temperature pH meter, a beaker, several 30mm cuvettes, several 10mm cuvettes, several 150mm sealed test tubes, several 100mm sealed test tubes, several open test tubes, two large and small pipettes, and supporting reagents. The actual data acquisition methods include:

[0069] To measure the total nitrogen content in water, chromotropic acid spectrophotometry is used. Under alkaline conditions, potassium persulfate is used as an oxidant. After high temperature and high pressure digestion, all nitrogen-containing compounds are converted into nitrate nitrogen. The remaining potassium persulfate is eliminated by adding excess sodium pyrosulfite. Nitrate-nitrogen reacts with chromotropic acid under strong acidic conditions to form yellow compounds. The absorbance value of the color developing solution is proportional to the total nitrogen content in the water sample. First, turn on the digestion instrument switch to select the total nitrogen digestion mode, turn on the water quality analyzer to select the total nitrogen mode, prepare several 150mm sealed reaction tubes and place them on the empty cooling tank of the cooling rack. Accurately measure 5mL of distilled water and each water sample into the reaction tube, add 2mL of special reagent NTA to each reaction tube in turn, tighten the bottle cap and shake the water sample, and put each reaction tube into the digestion instrument in turn for digestion at 122 degrees Celsius for 40 minutes. After the digestion is completed, place the sample on the cooling rack to air cool for 2 minutes and then water cool for 2 minutes. After cooling, add 1mL of NTB reagent to each reaction tube and shake well. Prepare several 100mm sealed colorimetric tubes and place them on the test tube rack. Accurately measure 4mL of NTC reagent and add it to the prepared sealed colorimetric tubes. Measure 1mL of each treated water sample and add it to the colorimetric tube with NTC reagent added along the wall. After adding the water sample, tighten the bottle cap immediately, flip and shake well 10 times, put it in the cooling tank, and cool it with water for 10 minutes. After the water cooling is completed, take out each reaction tube from the cooling tank, wipe the tube wall clean, and put it into the water quality analyzer to measure the total nitrogen content.

[0070] The method for acquiring multispectral remote sensing images is to conduct a pre-flight check on the drone to ensure flight safety and data collection quality, and select five fixed areas of the lake for multispectral imaging. Use Map Pilot route planning software to develop a suitable flight path based on the lake's terrain, size, and shooting requirements. The drone flies at a constant speed of 5.6 meters per second at an altitude of 55 meters, with a shooting interval of 2 seconds. Then, according to the flight plan, the drone is started to fly. The drone uses a multispectral camera to take multiple pictures of the lake to obtain image data in different bands.

[0071] In step 2, missing values ​​and outliers in the measured data are checked, outliers are deleted and also treated as missing values, all missing values ​​are filled by interpolation, the units of all values ​​are unified, and then data normalization is performed;

[0072] The method for outlier confirmation is as follows. First, calculate the mean (μ) and standard deviation (σ) of the spectral data, and calculate the threshold value according to the mean and standard deviation, as shown in Equation (1); check whether any value in the spectral data exceeds the threshold, as shown in Equation (2). If a certain value (x i ) exceeds the threshold, it is regarded as an outlier.

[0073]

[0074] where n is the number of samples, and x i is the value of the i-th sample.

[0075] threshold = μ ± κ × σ (2)

[0076] where k is the multiple of the standard deviation and can be selected as needed. In this embodiment, k = 2.8 is selected.

[0077] Use the interpolation processing method to estimate and replace the missing values. The formula is as follows. Suppose there are two known data points (x1, y1) and (x1, y2), where x1 < x < x2 is the abscissa of the missing value to be interpolated. The goal of linear interpolation is to estimate the ordinate y of the missing value based on the linear relationship between the known data points.

[0078] First, calculate the proportion t of the position of the abscissa x corresponding to the missing value among the known data points, that is:

[0079]

[0080] Then, estimate the ordinate y of the missing value according to the ordinates of the known data points and the value of t. The formula for linear interpolation is as follows:

[0081] y = y1 + (y2 - y1) × t

[0082] This formula indicates that the ordinate y of the missing value is determined by the ordinates y1 and y2 between the known data points and the position t of the missing value on the abscissa.

[0083] Normalize the data to the range [0, 1]. The corresponding normalization equation and denormalization equation are:

[0084]

[0085] q = (q max - q min ) · p i ′ + q min

[0086] In the formula, q is the normalized data, and p iis the data filled by interpolation, P min and p max are the minimum and maximum values ​​of the data after interpolation, q min and q max It is a parameter that you can set yourself. The default values ​​are -1 and 1.

[0087] The preprocessing method of multispectral remote sensing images is to transfer the captured multispectral image data to a computer, use QGIS remote sensing image processing software to perform preprocessing operations such as image correction, distortion removal, and registration, and extract information related to lake water quality.

[0088] Since the reflectance peaks and troughs in specific bands may be associated with the total nitrogen content in the water body, extracting water quality-related features from multispectral remote sensing data can be achieved by analyzing the reflectance curves of different bands.

[0089] Step 3.1: Under the premise of unified formats of measured data and spectral remote sensing data, use data processing software MATLAB to merge measured data and spectral remote sensing data into a unified data set according to common fields such as timestamp and spatial coordinates to ensure that each sample contains measured water quality parameters and corresponding spectral features. Specifically, interpolate the measured data to align the time points of the measured data with those of the multispectral remote sensing images; extract spectral features of different bands from the multispectral remote sensing images, and splice and merge them with the interpolated measured data, such as Figure 3 shown.

[0090] Step 3.2: Establish a suitable model ensemble algorithm model and randomly split the data set into training set and test set in a ratio of 7:3.

[0091] Step 3.3: Use the spectral band data as input data and the measured total nitrogen content data as output data to build a model and use the training set to train the model.

[0092] Step 3.4: Set the initial parameters of the random forest, i.e. the number of decision trees and the minimum number of leaves, train the model, and adjust the model parameters to optimize the model performance through the grid search method.

[0093] In step 4, step 4.1: Initialize parameters, set the number of weak regressors (K), the number of decision trees (trees), the minimum number of leaves (leaf) and other parameters; weight initialization, initialize the weight of each weak regressor (D), the initial weight is uniformly distributed. These weights are used to control the contribution of each weak regressor in ensemble learning;

[0094] Step 4.2: Iterate the loop K times, and train a weak regressor k in each iteration. In each iteration, a weak regressor based on a decision tree is constructed through training data;

[0095] Step 4.3: Use the TreeBagger function to train a weak regressor based on a decision tree, passing in the training data and corresponding parameters for model training;

[0096] Step 4.4: Use the trained model to predict the test data and get the prediction results; calculate the error between the predicted value and the actual value for subsequent weight adjustment and model optimization. The prediction error is measured using the root mean square error (RMSE), and the formula is as follows:

[0097]

[0098] Where: N is the number of samples, y i is the actual observed value, is the model prediction value.

[0099] RMSE represents the average difference between the actual observations and the model predictions. The smaller the value, the more accurate the model predictions.

[0100] Step 4.5: Calculate the weight of each weak regressor and determine the weight according to the error. Specifically, adjust the weight of the weak regressor according to the error. If the error is greater than E, increase the corresponding weight, otherwise keep it unchanged and normalize the weight. In this embodiment, E is set to 0.03.

[0101] Step 4.6: Take a weighted average of the outputs of all weak regressors to improve the accuracy and generalization ability of the model by combining the outputs of multiple weak learners; use the adjusted weights to weight the sum of the prediction results of all weak regressors to obtain the strong regressor with the adaptive random forest RF_AdaBoost model as the training of the RF_AdaBoost model;

[0102] Step 4.7: Use the mapminmax function to reverse-map the normalized output to the original data range. Output the predicted values ​​for the test set.

[0103] Step 5: Use the trained random forest model and RF_AdaBoost model to predict the data of the test set respectively. Specifically:

[0104] Step 5.1: Use the trained RF model to predict the test set data;

[0105] Step 5.2: Use the trained RF_AdaBoost model to predict the test set data;

[0106] Step 5.3: Calculate the RMSE and R of the prediction results of step 5.1 and step 5.2 respectively.2 and MAE;

[0107] Step 5.4: Evaluate the prediction performance based on the results, and select the model with better prediction performance as the water quality prediction model. The overall model construction selection process is as follows: Figure 4 As shown in the figure, the evaluation method is specifically that when RMSE and MAE are smaller, R 2 The closer it is to 1, the better the prediction performance of the corresponding model.

[0108] The results show that the RF_AdaBoost model has improved prediction performance compared to the random forest model. The model effects in this embodiment are shown in Table 1:

[0109] Table 1 Comparison of model prediction effects

[0110] Model Type <![CDATA[R 2 ]]> RMSE MAE RF 0.93507 0.1996 0.11748 RF_AdaBoost 0.94164 0.18923 0.07689

[0111] According to the comparison results, the RF_AdaBoost model is selected as the water quality prediction model of this embodiment.

[0112] Step 6: Use the water quality prediction model to predict the water quality of the water body to be tested.

[0113] The method of this embodiment further includes step 7, based on the prediction result of step 6, drawing a comparison chart of the true value and the predicted value to show the fitting effect of the model; the comparison results and relationship curves of the predicted values ​​and the true values ​​of the RF model and the RF_AdaBoost model are shown in FIG. Figure 5 shown.

[0114] Based on the same inventive concept, the present invention also provides a multispectral water quality prediction system based on adaptive random forest, comprising:

[0115] The acquisition module is used to obtain the measured data and multispectral remote sensing images of the water body to be measured in a preset time period;

[0116] The preprocessing module preprocesses the acquired measured data and multispectral remote sensing images;

[0117] The optimization module is used to generate a comprehensive data set based on the preprocessing results, and divide it into a training set and a test set; select the training set, train it based on the random forest RF algorithm, and adjust the model parameters to obtain the optimized RF model;

[0118] The training module is used to train the optimized RF model as a weak regressor to obtain the trained RF model, and use the Boosting method for ensemble learning to obtain the adaptive random forest RF_AdaBoost model as a strong regressor to complete the training of the RF_AdaBoost model;

[0119] The comparison module is used to select the data of the test set, use the trained RF model and the trained RF_AdaBoost model to make predictions, and verify and evaluate the accuracy of the trained RF model and the trained RF_AdaBoost model based on the prediction results to determine the water quality prediction model;

[0120] The prediction module is used to use the water quality prediction model to predict the water body to be tested.

[0121] Compared with the grey prediction method and support vector machine algorithm, random forest has higher accuracy, better robustness, stronger scalability and processing ability, as well as simpler usage and better interpretability. The present invention combines remote sensing data and measured data, uses a machine learning model, and realizes the prediction of total nitrogen content of lake water quality parameters, which has broad application prospects and practical value.

Claims

1. A multispectral water quality prediction method based on adaptive random forest, characterized in that: include: Step 1: Obtain measured data and multispectral remote sensing images of the water body to be measured for a preset time period; Step 2: Preprocess the acquired measured data and multispectral remote sensing images; Step 3: Generate a comprehensive data set based on the preprocessing results and divide it into a training set and a test set; select the training set, train it based on the random forest RF algorithm, and adjust the model parameters to obtain the optimized RF model; Step 4: Use the optimized RF model as a weak regressor to train the trained RF model, use the Boosting method for ensemble learning, and obtain the adaptive random forest RF_AdaBoost model as a strong regressor to complete the training of the RF_AdaBoost model; Step 5: Select the data of the test set, use the trained RF model and the trained RF_AdaBoost model to make predictions, and based on the prediction results, verify and evaluate the accuracy of the trained RF model and the trained RF_AdaBoost model to determine the water quality prediction model; Step 6: Use the water quality prediction model to predict the water body to be tested.

2. The water quality multispectral remote sensing prediction method according to claim 1, characterized in that: Step 1 is to obtain the measured data of the water body to be tested for a preset time period. Specifically, within the preset time period, the water body to be tested is sampled by a multi-parameter water quality meter using a spectrophotometer, and filtered and acidified, the instrument is calibrated, a standard curve is prepared, and absorbance is measured to calculate the concentration data of the detection substance in the sample.

3. The multispectral water quality prediction method based on adaptive random forest according to claim 1 is characterized in that: The step 1 of obtaining a multispectral remote sensing image of the water body to be measured within a preset time period specifically involves using a multispectral remote sensing sensor to collect images of the water body to be measured within a preset time period.

4. The multispectral water quality prediction method based on adaptive random forest according to claim 1 is characterized in that: The specific method of step 2 is: Step 2.1: Check the missing values ​​and outliers in the measured data, delete the outliers and treat them as missing values, use interpolation to fill all missing values, unify the units of all values, and then perform data normalization; Step 2.2: Perform geometric correction, radiation calibration, atmospheric correction, feature extraction and spatial analysis on the multispectral remote sensing image to obtain the image data of the water body to be measured.

5. The multispectral water quality prediction method based on adaptive random forest according to claim 4 is characterized in that: In step 2.1, interpolation is used to fill in all missing values. The specific method is: Given two known data points (x1, y1) and (x2, y2), let x be the horizontal coordinate of the missing value to be interpolated, x1<x<x2: Calculate the proportion t of the horizontal coordinate x corresponding to the missing value between the known data points: Estimate the ordinate y of the missing value based on the ordinate of the known data point and the value of t. The linear interpolation formula is as follows: y=y1+(y2-y1)×t.

6. The multispectral water quality prediction method based on adaptive random forest according to claim 4 is characterized in that: In the normalization process described in step 2.1, the normalization corresponding equation and the anti-normalization equation are respectively: q=(q max -q min )·p i ′+q min In the formula, q is the normalized data, p i is the data filled by interpolation, p min and p max are the minimum and maximum values ​​of the data after interpolation, q min and q max as a parameter.

7. The multispectral water quality prediction method based on adaptive random forest according to claim 1 is characterized in that: The specific method of step 3 is: Step 3.1: Match the preprocessed measured data of the same time period with the multispectral remote sensing image, interpolate the measured data, and align the time points of the measured data with the multispectral remote sensing image; extract the spectral features of different bands from the multispectral remote sensing image, and splice and merge them with the interpolated measured data to generate a comprehensive data set; Step 3.2: Divide the comprehensive dataset into training set and test set according to the preset ratio; Step 3.3: Based on the RF algorithm, set the RF initial parameters, use the spectral data of different spectral bands as the input of the random forest model, use the corresponding water quality parameters as the output of the random forest model, and select the training set for training; Step 3.4: Based on the number of RF decision trees and the minimum number of leaves, the model performance is optimized through the grid search method to obtain the optimized RF model.

8. The multispectral water quality prediction method based on adaptive random forest according to claim 1 is characterized in that: The specific method of step 4 is: Step 4.1: Use the optimized RF model as a weak regressor, initialize the RF parameters, set the number of weak regressors K; initialize the weight D of each weak regressor so that the initial weights are evenly distributed; Step 4.2: Weak regressor regression, loop iteration K times, each iteration training a weak regressor k; Step 4.3: Use the TreeBagger function to train a weak regressor based on a decision tree, pass in the training set data, the number of decision trees, and the minimum number of leaves, and train the optimized RF model; Step 4.4: Use the trained RF model to predict the training set and test set respectively; calculate the prediction error, and calculate the error between the predicted value and the actual value; Step 4.5: Adjust the weight of the weak regressor according to the error. Specifically, when the error is greater than the preset threshold, increase the corresponding weight, otherwise keep it unchanged, and normalize it so that the sum of the weights is 1; Step 4.6: Take a weighted average of the outputs of all weak regressors, use the adjusted weights to weight the sum of the prediction results of all weak regressors, and obtain the strong regressor with the adaptive random forest RF_AdaBoost model as the training of the RF_AdaBoost model; Step 4.7: Use the mapminmax function to back-map the normalized output to the preprocessed data range.

9. The multispectral water quality prediction method based on adaptive random forest according to claim 1, characterized in that: The specific method of step 5 is: Step 5.1: Use the trained RF model to predict the test set data; Step 5.2: Use the trained RF_AdaBoost model to predict the test set data; Step 5.3: Calculate the RMSE and R of the prediction results of step 5.1 and step 5.2 respectively. 2 and MAE; Step 5.4: Evaluate the prediction performance according to the calculated results, and select the model corresponding to the result with better prediction performance as the water quality prediction model; the evaluation method is as follows: when RMSE and MAE are smaller, R 2 The closer it is to 1, the better the prediction performance of the corresponding model.

10. A multispectral water quality prediction system based on adaptive random forest, characterized in that: include: The acquisition module is used to obtain the measured data and multispectral remote sensing images of the water body to be measured in a preset time period; The preprocessing module preprocesses the acquired measured data and multispectral remote sensing images; The optimization module is used to generate a comprehensive data set and divide it into training set and test set according to the preprocessing results; Select a training set, perform training based on the random forest RF algorithm, and adjust the model parameters to obtain an optimized RF model; The training module is used to train the optimized RF model as a weak regressor to obtain the trained RF model, and use the Boosting method for ensemble learning to obtain the adaptive random forest RF_AdaBoost model as a strong regressor to complete the training of the RF_AdaBoost model; The comparison module is used to select the data of the test set, use the trained RF model and the trained RF_AdaBoost model to make predictions, and verify and evaluate the accuracy of the trained RF model and the trained RF_AdaBoost model based on the prediction results to determine the water quality prediction model; The prediction module is used to use the water quality prediction model to predict the water body to be tested.

Citation Information

Cited By

  • Landslide susceptibility evaluation method based on Bayesian optimization adaptive enhancement integrated extreme random tree

    CN119691363A