Fire coal sulfur oxide gas detection method based on photoacoustic spectrum and NGBoost
By combining photoacoustic spectroscopy technology and NGBoost algorithm, and using an improved particle swarm optimization algorithm, the complex and long-cycle problems of traditional coal-fired sulfur oxide gas detection methods are solved, achieving fast and accurate detection, meeting the needs of industrial and environmental monitoring. Real-time needs.
Patent Information
- Application Number
- CN202410658002.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2024-10-15
AI Technical Summary
Traditional coal-fired sulfur oxide gas detection methods have complicated operations and long detection cycles, making it difficult to achieve rapid and accurate detection and unable to meet the real-time needs of industrial and environmental monitoring.
Combining photoacoustic spectroscopy technology and the NGBoost algorithm, by acquiring the photoacoustic spectrum data of sulfur oxides, performing data preprocessing, dimensionality reduction and model construction, and using the improved particle swarm optimization algorithm to optimize the NGBoost model to achieve the analysis of coal-fired sulfur oxide gases. Highly sensitive detection.
It achieves rapid and accurate detection of coal-burning sulfur oxide gas, has high sensitivity, real-time performance and adaptability, and is suitable for industrial production sites and environmental detection.
Smart Images

Figure CN118777216A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of pollutant detection, and in particular to a method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost. Background Art
[0002] Coal combustion sulfur oxide gas detection technology is of great significance in industrial and environmental monitoring. Coal combustion is a major source of energy. However, coal combustion releases a large amount of sulfur oxides (SO x ), including harmful gases such as sulfur dioxide (SO2), sulfur trioxide (SO3) and hydrogen sulfide (H2S). These sulfur oxides cause serious harm to the environment and human health, such as causing acid rain, air pollution and health problems. Therefore, it is very important to detect and monitor coal-fired sulfur oxide gas emissions in a timely and accurate manner.
[0003] Traditional coal-fired sulfur oxide gas detection methods include chemical analysis, mass spectrometry, infrared spectroscopy, etc. Although these methods can detect sulfur oxide gas, they have shortcomings such as complex operation, long detection cycle, and sample processing. Therefore, it is urgent to develop a new detection technology that can quickly and accurately detect coal-fired sulfur oxide gas.
[0004] Photoacoustic spectroscopy is an analytical technique that combines the principles of optics and acoustics. By exposing the sample to a light source, the sample absorbs light energy, generates heat energy, causes instantaneous expansion, and then generates sound waves. Photoacoustic spectroscopy combines the high sensitivity of optics and the high resolution of acoustics, and has the advantages of high sensitivity and non-destructive detection of gases. The NGBoost algorithm is a probabilistic prediction model that is optimized using the natural gradient boosting method. It has the advantages of strong probabilistic prediction capabilities, better convergence, adaptability to features, and robustness to outliers and noise.
[0005] In view of this, combining photoacoustic spectroscopy with the NGBoost algorithm can fully utilize the advantages of photoacoustic spectroscopy for highly sensitive detection of gas samples and the NGBoost algorithm for efficient processing of complex data to achieve accurate detection of sulfur oxide gas from coal combustion. This method not only has high sensitivity and high accuracy, but also has the characteristics of real-time and strong adaptability, and is suitable for sulfur oxide gas detection needs in industrial production sites and environmental testing. Summary of the invention
[0006] The present invention aims to use photoacoustic spectroscopy technology, combined with the NGBoost algorithm, to propose a method for detecting sulfur oxide gas from coal combustion. By selecting appropriate spectral features, optimized data processing methods and efficient pattern recognition algorithms, high-sensitivity and high-selectivity detection of coal-fired pollutant gases can be achieved, providing technical support and scientific basis for environmental protection and air pollution prevention and control.
[0007] To achieve the above object, the technical solution adopted by the present invention is: a method for detecting sulfur oxide gas in coal combustion based on photoacoustic spectroscopy and NGBoost, comprising the following steps:
[0008] S1: Photoacoustic spectroscopy dataset of sulfur oxides obtained experimentally;
[0009] S2: Divide the collected spectral data set into a training set and a test set in a ratio of 7:3;
[0010] S3: perform data preprocessing on the photoacoustic spectroscopy data of the training set and the test set;
[0011] S4: Perform KPCA dimensionality reduction on the preprocessed data;
[0012] S5: Establish the photoacoustic spectroscopy sulfur oxide gas NGBoost model;
[0013] S6: Optimize the NGBoost model using the improved particle swarm optimization algorithm (IPSO);
[0014] S7: Input spectral data to test the model.
[0015] Furthermore, in S1, a quantum cascade laser is used to excite sulfur oxide gas to obtain a photoacoustic spectrum data set of sulfur oxide gas.
[0016] Furthermore, in S2, the data collected in the experiment are divided into a training set and a test set in a ratio of 7:3.
[0017] Furthermore, in S3, the data of the training set and the test set are preprocessed respectively, using the SG smoothing filter method, as follows:
[0018] S31: Given a signal sequence y of length N i (i=0,1,2,...,N-1), hoping to obtain a smooth output sequence through SG smoothing filtering
[0019] S32: The basic principle of SG smoothing filtering is to perform local polynomial fitting on the data at each data point. Specifically, for the i-th data point, a window of length 2M+1 is used, and a K-order polynomial fitting is performed within the window, where M is half the width of the window and K is the order of the polynomial.
[0020] S33: The recursive formula of SG smoothing filter can be expressed as:
[0021]
[0022] in, is the ith output data point, c j is the coefficient of the filter, y i+j There are 2M+1 data points in the window.
[0023] S34: SG smoothing filter coefficient c j It can be obtained by the least squares method; specifically, it is hoped that the filter can minimize the square error between the original data points and the fitting polynomial, which can be obtained by solving the following normal equations:
[0024] X T XXc=X T y
[0025] Where X is an N×(2M+1) matrix, each row is a data point in a window, y is a column vector of length N, containing the original signal sequence, and c is a column vector of length 2M+1, containing the filter coefficients;
[0026] S35: Solving the above normal equations can obtain the coefficient c of the filter j , and then calculate the smoothed output sequence
[0027] Furthermore, in S4, the spectral data is subjected to dimension reduction operation, and the KPCA method is used for dimension reduction. The specific method is as follows:
[0028] S41: KPCA uses a mapping function to map data from the original space to a high-dimensional feature space H, making the data separable in the high-dimensional space. The covariance matrix of the mapping function data in H is expressed as:
[0029]
[0030] S42: Calculate the covariance matrix C H The eigenvalue and eigenvector of , its eigenvalue is λ, eigenvector is β, then define the matrix M=(M i,j ) n×n , It can be determined by the kernel function, βk is the kth eigenvector of β, which is normalized to be β k β k = 1, the mapping data of any sample x in the original space can be obtained In the feature vector β k The projection on is:
[0031]
[0032] Where: * represents the inner product of two vectors;
[0033] S43: The nonlinear principal component of the k-th dimension of the data is obtained by centralizing the mapping data:
[0034]
[0035] Further, in S5, a photoacoustic spectroscopy sulfur oxide gas NGBoost model is constructed, characterized in that a prediction model is constructed;
[0036] The parameters of the NGBoost model mainly include: base learner f, hypothesis parameter θ of parameterized probability distribution P, scoring rule S, maximum number of iterations M and learning rate η;
[0037] S51: First, select a suitable scoring rule. The scoring rule S is related to the probability distribution P and the output value y, denoted as S(P,y). For the correct probability distribution, the scoring rule is expected to achieve the best value. This scoring rule expectation can be regarded as a loss function about the probability distribution. The more accurate the probability prediction, the smaller the loss, so:
[0038]
[0039] Among them, Q is the correct probability distribution, and P is the predicted probability distribution;
[0040] S52: Define the divergence of the scoring rule:
[0041] D S (Q||P)=E y~Q [S(P,y)]-E y~Q [S(Q,y)]
[0042] The definition of the scoring rule needs to make the divergence non-negative and be able to measure the distance between distributions. In this paper, we use the maximum likelihood estimation method L as the scoring rule, and the scoring calculation formula is as follows:
[0043] L(θ,y)=-logP θ (y)
[0044] S53: Calculate the generalized naturalness, the likelihood function ∑log(Pθ (y)) to obtain the maximum value, and add a negative sign to obtain the minimum value, so that the divergence becomes the KL divergence, that is:
[0045]
[0046] S54: Calculate the Fisher information quantity, the formula is as follows:
[0047]
[0048] in, Represents the gradient representation of the score L in the parameter θ and the result value y, and the selection of the traditional gradient direction:
[0049]
[0050] Among them, d is the metric. The probability distribution calculated along the gradient direction obtained by different parameter selection methods is also different, so the metric is replaced by the divergence mentioned in the above formula:
[0051]
[0052] Solving the above formula yields:
[0053]
[0054] S55: Use NGBoost algorithm to predict the concentration of sulfur oxide gas from coal combustion. First, build M base learners based on the minimum score initialization parameter θ0. For each learner, the learned parameter gradient is based on the set of learners in the previous stage. Before fitting the parameter gradient, use the natural gradient to obtain the gradient value of the sample at this time. Then, the learner is used to fit the sample gradient data and the learner scaling value p is obtained by line search. m , and finally update the parameters, η is the step size, the specific steps are as follows:
[0055] S551: Calculate the initialization parameter θ0:
[0056]
[0057] S552: Input the training subset data into the NGBoost model, and obtain the base learner corresponding to the mth iteration based on the natural gradient fitting of the score value of the mth iteration, where the fitting operation formula is:
[0058]
[0059] Among them, f (m) represents the base learner of the mth iteration, fit represents the fitting operation of the base learner, x i Represents the multi-dimensional features of training samples;
[0060] S553: Based on the base learner corresponding to the mth iteration and the assumed parameters of the current probability distribution The proportional coefficient of the mth iteration is calculated, where the formula of the proportional coefficient is:
[0061]
[0062] S554: cyclically train the multi-dimensional features in the subset, and use the scale coefficient of the mth iteration and the base learner to update the hypothesis parameters, wherein the formula for updating the hypothesis parameters is:
[0063]
[0064] S555: Repeat the above three formulas until the maximum number of iterations is completed, and obtain the proportional coefficient and the base learner set:
[0065] Furthermore, in S6, the hyperparameter tuning of the NGBoost algorithm is difficult, and the traditional particle swarm optimization algorithm tends to converge to the local optimal value, thereby reducing the optimization effect. Therefore, in order to improve the local and global search capabilities of the particle swarm optimization algorithm, a particle swarm optimization algorithm based on dual improvements of evolution strategy and parameter adjustment strategy is proposed, which improves the traditional particle swarm optimization algorithm in terms of evolution strategy and parameter setting;
[0066] S61: Add mutation operation:
[0067] In order to increase the diversity of particles and enable them to jump out of the local optimal value, the mutation operation is introduced into the particle swarm optimization algorithm. In each iteration, each particle has a certain probability of mutation, and the position and speed of the mutated particles will be randomly initialized again;
[0068] Assume that the current position of particle i is x i , the current speed is v i , for the particles that undergo mutation operations, re-randomly initialize their positions and velocities:
[0069] x i ′ = random_position
[0070] v i ′ = random_velocity
[0071] Among them, random_position and random_velocity are the randomly generated new position and velocity respectively;
[0072] S62: Dynamically adjust inertia weight, individual learning factor, group learning factor and maximum speed:
[0073] In order to better balance the local search ability and global search ability of the particle swarm optimization algorithm, the inertia weight, individual learning factor, group learning factor and maximum speed are dynamically adjusted. The inertia weight, individual learning factor, group learning factor and maximum speed of the tth generation are shown as follows:
[0074]
[0075]
[0076] Among them, a max is the maximum inertia weight; a min is the minimum inertia weight; b 1max is the maximum individual learning factor; b 1min is the minimum individual learning factor; b 2max is the maximum group learning factor; b 2min is the minimum group learning factor; v1 is the maximum speed limit; v2 is the minimum speed limit;
[0077] S63: Specific steps of IPSO-NGBoost algorithm:
[0078] S631: Determine the search range of the particle swarm and initialize the position and velocity of the particle swarm, where the position of each particle represents the initial hyperparameter of the NGBoost model;
[0079] S632: Initialize the hyper parameters of the corresponding NGBoost model according to each particle;
[0080] S633: Use the training set to train each NGBoost model. The loss of the training set (such as the mean square error) is used as the fitness function F, and the fitness function F of each particle is calculated. The expression of the fitness function F is shown as follows:
[0081]
[0082] Among them, u is the number of samples in the training set, y i is the true value of the i-th training set sample, x i is the predicted value of the i-th training set sample;
[0083] S634: Determine the individual extreme value and the group extreme value of the particle according to the fitness function F of the particle;
[0084] S635: Update weight coefficient, individual learning factor, group learning factor, speed upper limit and other parameters;
[0085] S636: Perform particle mutation operation;
[0086] S636: Determine whether the number of iterations reaches the maximum number of iterations. If the number of iterations is less than the maximum number of iterations, update the speed and position of the particle, and ensure that the position and speed of the particle are within the set range, and then go to step S633; if the number of iterations is greater than the maximum number of iterations, execute S637;
[0087] S637: When the fitness function value is less than or equal to the set minimum error value, or the number of iterations exceeds the maximum value, the optimal hyperparameters of the NGBoost model are output, the NGBoost model is initialized using the optimal hyperparameters, the NGBoost model is trained, and the performance of the NGBoost model is tested.
[0088] Furthermore, in S7, relevant data affecting the sulfur oxide gas concentration is input for testing, and various parameters in the model are adjusted; using the adjusted prediction model, spectral data is input for testing, and the sulfur oxide gas concentration in the future is predicted. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] Figure 1 A flow chart of a method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost;
[0090] Figure 2 This is a flow chart of optimizing NGBoost parameters using an improved particle swarm algorithm (IPSO) used in the NGBoost coal-fired sulfur oxide gas detection method based on photoacoustic spectroscopy. DETAILED DESCRIPTION
[0091] The following is combined with Figure 1 and attached Figure 2 , a specific embodiment of the present invention is described in detail, but it should be understood that the protection scope of the present invention is not limited by the specific embodiment.
[0092] The present invention proposes a coal-fired sulfur oxide gas detection method based on photoacoustic spectroscopy and NGBoost, aiming to solve the problems existing in the existing methods and provide a more effective solution for coal-fired sulfur oxide gas concentration detection.
[0093] In order to achieve the above purpose, this embodiment proposes a coal-fired sulfur oxide gas detection method based on photoacoustic spectroscopy and NGBoost, using NGBoost as the core algorithm of the regression model, using the photoacoustic spectroscopy data obtained by laser excitation gas, and training the model with relevant data that affects the sulfur oxide gas concentration. In view of the difficulty of hyperparameter tuning of the NGBoost algorithm, a particle swarm optimization algorithm based on dual improvements of evolution strategy and parameter adjustment strategy is proposed, which improves the traditional particle swarm optimization algorithm in terms of evolution strategy and parameter setting, thereby better optimizing the NGBoost model.
[0094] It should be noted that the regression model of the present invention is based on the ensemble learning algorithm NGBoost, which has fast speed, strong probability prediction ability, better convergence, adaptability to features, and robustness to outliers and noise.
[0095] Combined with Figure 1 As shown, in order to solve all or part of the deficiencies of the existing technology, the embodiment of the present invention provides a method for detecting sulfur oxide gas in coal combustion based on photoacoustic spectroscopy and NGBoost, comprising the following steps:
[0096] S1: Photoacoustic spectroscopy dataset of sulfur oxides obtained experimentally;
[0097] S2: Divide the collected spectral data set into a training set and a test set in a ratio of 7:3;
[0098] S3: perform data preprocessing on the photoacoustic spectroscopy data of the training set and the test set;
[0099] S4: Perform KPCA dimensionality reduction on the preprocessed data;
[0100] S5: Establish the photoacoustic spectroscopy sulfur oxide gas NGBoost model;
[0101] S6: Optimize the NGBoost model using the improved particle swarm optimization algorithm (IPSO);
[0102] S7: Input spectral data to test the model.
[0103] Furthermore, in S1, a quantum cascade laser is used to excite sulfur oxide gas to obtain a photoacoustic spectrum data set of sulfur oxide gas.
[0104] Furthermore, in S2, the data collected in the experiment are divided into a training set and a test set in a ratio of 7:3.
[0105] Furthermore, in S3, the data of the training set and the test set are preprocessed respectively, and the spectrum is filtered using the Savitzky-Golay (SG) filtering algorithm, which can effectively suppress random noise and improve the signal-to-noise ratio. The original input data is replaced by the fitting value of the given polynomial, and this operation is repeated for each data until the smoothed value of all data is obtained. All spectral data also need to be normalized.
[0106] Furthermore, in S4, KPCA dimension reduction processing is performed on the spectral data after preprocessing to extract the main features, reduce the data dimension, and improve the data processing efficiency.
[0107] Furthermore, in S5, first, the preprocessed photoacoustic spectroscopy dataset is divided into a training set and a test set using a cross-validation method, and the training set is used to train the NGBoost model to determine the parameters of the NGBoost model, thereby obtaining a trained NGBoost model.
[0108] Furthermore, in S6, for the hyperparameter tuning of the NGBoost algorithm, the traditional particle swarm optimization algorithm tends to converge to the local optimal value, thereby reducing the optimization effect. Therefore, in order to improve the local and global search capabilities of the particle swarm optimization algorithm, a particle swarm optimization algorithm based on dual improvements of evolutionary strategy and parameter adjustment strategy is proposed.
[0109] Furthermore, in S7, relevant data affecting the concentration of sulfur oxide gas is input for testing, and various parameters in the model are adjusted; using the adjusted prediction model, spectral data is input for testing, and the detection effect of the NGBoost model is analyzed.
[0110] The present invention constructs a photoacoustic spectroscopy regression model of coal-fired sulfur oxide gas based on the IPSO optimized NGBoost algorithm, and proposes a coal-fired sulfur oxide gas detection method based on photoacoustic spectroscopy and NGBoost, which can detect the concentration of coal-fired sulfur oxide gas more quickly, effectively and accurately. The NGBoost algorithm has better convergence, and it also has the characteristics of real-time and strong adaptability, which is very suitable for the sulfur oxide gas detection needs in industrial production sites and environmental monitoring.
[0111] Example:
[0112] like Figure 2As shown, in S6, the hyperparameter tuning of the NGBoost algorithm is difficult, and the traditional particle swarm optimization algorithm tends to converge to the local optimal value, thereby reducing the optimization effect. Therefore, in order to improve the local search ability and global search ability of the particle swarm optimization algorithm, a particle swarm optimization algorithm based on dual improvements of evolution strategy and parameter adjustment strategy is proposed, and the traditional particle swarm optimization algorithm is improved in terms of evolution strategy and parameter setting. The n_estimators and Dist parameters of NGBoost are optimized using the improved particle swarm optimization algorithm (IPSO), and the specific steps are as follows:
[0113] S61: Determine the search range of n_estimators and Dist parameters, such as n_estimators can be set to [50,500], Dist: You can choose the distribution type such as Poisson distribution, and initialize the particle swarm;
[0114] S62: Assume that the number of particle swarm is 30, the position of each particle represents a set of (n_estimators, Dist) parameter combinations, and the speed of each particle can be randomly initialized;
[0115] S63: Define the fitness function. The fitness function F uses the mean square error (MSE) to evaluate the performance of each particle. Each particle initializes an NGBoost model and trains it with the training set, then calculates the MSE.
[0116]
[0117] S64: Determine the individual extreme value and the group extreme value of the particle according to the fitness function F of the particle, and the individual learning factor and the group learning factor can be set to b1, b2 = 1.5, 1.5;
[0118] S65: Iterative optimization: Use adaptive inertia weight and mutation operation to update the position and velocity of particles; the inertia weight range can be set to a_max, a_min = 0.9, 0.4, and the mutation rate is set to 0.1;
[0119] S66: Determine whether the number of iterations reaches the maximum number of iterations. The maximum number of iterations is set to 100. If the number of iterations n is less than 100, update the particle's speed and position, and ensure that the particle's position and speed are within the set range, and then go to step S633; if the number of iterations n is greater than 100, execute S637;
[0120] S67: When the fitness function value is less than or equal to the set minimum error value, or the number of iterations exceeds the maximum value, the optimal n_estimators and Dist parameter combination of the NGBoost model is output, the NGBoost model is initialized with the optimal hyperparameters, the NGBoost model is trained, and the performance of the NGBoost model is tested.
[0121] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0122] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. A method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost, characterized in that: The following steps are involved: S1: Photoacoustic spectroscopy dataset of sulfur oxides obtained experimentally; S2: Divide the collected spectral data set into a training set and a test set in a ratio of 7:3; S3: perform data preprocessing on the photoacoustic spectroscopy data of the training set and the test set; S4: Perform KPCA dimensionality reduction on the preprocessed data; S5: Establishment of the photoacoustic spectroscopy sulfur oxide gas NGBoost model; S6: Optimize the NGBoost model using the improved particle swarm optimization algorithm (IPSO); S7: Input spectral data to test the model.
2. In S3, the data of the training set and the test set are preprocessed respectively, using the SG smoothing filter method, as follows: S31: Given a signal sequence y of length N i (i=0,1,2,...,N-1), hoping to obtain a smooth output sequence through SG smoothing filtering S32: The basic principle of SG smoothing filtering is to perform local polynomial fitting on the data at each data point. Specifically, for the i-th data point, a window of length 2M+1 is used and a K-order polynomial fitting is performed within the window, where M is half the width of the window and K is the order of the polynomial. S33: The recursive formula of SG smoothing filter can be expressed as: in, is the ith output data point, c j is the coefficient of the filter, y i+j are the 2M+1 data points within the window; S34: SG smoothing filter coefficient c j It can be obtained by the least squares method. Specifically, it is hoped that the filter can minimize the square error between the original data points and the fitting polynomial, which can be obtained by solving the following normal equations: X T XXc=X T y Where X is an N×(2M+1) matrix, each row is a data point in a window, y is a column vector of length N, containing the original signal sequence, and c is a column vector of length 2M+1, containing the filter coefficients; S35: Solving the above normal equations can obtain the coefficient c of the filter j , and then calculate the smoothed output sequence 3. According to claim 1, a method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost, characterized in that: In S4, the spectral data is subjected to dimension reduction operation, and the KPCA method is used for dimension reduction. The specific method is as follows: S41: KPCA uses a mapping function to map data from the original space to a high-dimensional feature space H, making the data separable in the high-dimensional space. The covariance matrix of the mapping function data in H is expressed as: S42: Calculate the covariance matrix C H The eigenvalue and eigenvector of , its eigenvalue is λ, eigenvector is β, then define the matrix M=(M i,j ) n×n , It can be determined by the kernel function, β k is the kth eigenvector of β, which is normalized to be β k β k = 1, the mapping data of any sample x in the original space can be obtained In the feature vector β k The projection onto is: Among them, * represents the inner product of two vectors; S43: The nonlinear principal component of the k-th dimension of the data is obtained by centralizing the mapping data:
4. According to claim 1, a method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost, characterized in that: In said S5, a photoacoustic spectroscopy sulfur oxide gas NGBoost model is constructed, characterized in that a prediction model is constructed; The parameters of the NGBoost model mainly include: base learner f, hypothesis parameter θ of parameterized probability distribution P, scoring rule S, maximum number of iterations M and learning rate η; S51: First, select a suitable scoring rule. The scoring rule S is related to the probability distribution P and the output value y, denoted as S(P,y). For the correct probability distribution, the scoring rule is expected to achieve the best value. This scoring rule expectation can be regarded as a loss function about the probability distribution. The more accurate the probability prediction, the smaller the loss, so: Among them, Q is the correct probability distribution, and P is the predicted probability distribution; S52: Define the divergence of the scoring rule: D S (Q||P)=E y~Q [S(P,y)]-E y~Q [S(Q,y)] The definition of the scoring rule needs to make the divergence non-negative and be able to measure the distance between distributions. In this paper, we use the maximum likelihood estimation method L as the scoring rule, and the scoring calculation formula is as follows: L(θ,y) -logP θ (y) S53: Calculate the generalized naturalness, the likelihood function ∑log(P θ (y)) to obtain the maximum value, and add a negative sign to obtain the minimum value, so that the divergence becomes the KL divergence, that is: S54: Calculate the Fisher information quantity, the formula is as follows: in, Represents the gradient representation of the score L in the parameter θ and the result value y, and the selection of the traditional gradient direction: Among them, d is the metric. The probability distribution calculated along the gradient direction obtained by different parameter selection methods is also different, so the metric is replaced by the divergence mentioned in the above formula: Solving the above formula, we can get: S55: Use NGBoost algorithm to predict the concentration of sulfur oxide gas from coal combustion. First, build M base learners based on the minimum score initialization parameter θ0. For each learner, the learned parameter gradient is based on the set of learners in the previous stage. Before fitting the parameter gradient, use the natural gradient to obtain the gradient value of the sample at this time. Then, the learner is used to fit the sample gradient data and the learner scaling value p is obtained by line search. m , and finally update the parameters, η is the step size, the specific steps are as follows: S551: Calculate the initialization parameter θ0: S552: Input the training subset data into the NGBoost model, and obtain the base learner corresponding to the mth iteration based on the natural gradient fitting of the score value of the mth iteration, where the fitting operation formula is: Among them, f (m) represents the base learner of the mth iteration, fit represents the fitting operation of the base learner, and x i Represents the multi-dimensional features of training samples; S553: Based on the base learner corresponding to the mth iteration and the assumed parameters of the current probability distribution And the measured photovoltaic power in the training subset, calculate the proportional coefficient of the mth iteration, where the formula of the proportional coefficient is: S554: cyclically train the multi-dimensional features in the subset, and use the scale coefficient of the mth iteration and the base learner to update the hypothesis parameters, wherein the formula for updating the hypothesis parameters is: S555: Repeat the above three formulas until the maximum number of iterations is completed, and obtain the proportional coefficient and the base learner set:
5. According to claim 1, a method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost, characterized in that: In S6, the hyperparameter tuning of the NGBoost algorithm is difficult, and the traditional particle swarm optimization algorithm tends to converge to a local optimal value, thereby reducing the optimization effect. Therefore, in order to improve the local search ability and global search ability of the particle swarm optimization algorithm, a particle swarm optimization algorithm based on dual improvements of evolutionary strategy and parameter adjustment strategy is proposed; S61: Add mutation operation: In order to increase the diversity of particles and enable them to jump out of the local optimal value, the mutation operation is introduced into the particle swarm optimization algorithm. In each iteration, each particle has a certain probability of mutation, and the position and speed of the mutated particle will be randomly initialized. Assume that the current position of particle i is x i , the current speed is v i , for the particles that undergo mutation operations, re-randomly initialize their positions and velocities: x i ′=random_position v i ′=random_velocity Among them, random_position and random_velocity are the randomly generated new position and velocity respectively; S62: Dynamically adjust inertia weight, individual learning factor, group learning factor and maximum speed: In order to better balance the local search ability and global search ability of the particle swarm optimization algorithm, the inertia weight, individual learning factor, group learning factor and maximum speed are dynamically adjusted. The inertia weight, individual learning factor, group learning factor and maximum speed of the tth generation are shown in the following formula: Among them, a max is the maximum inertia weight; a min is the minimum inertia weight; b 1max is the maximum individual learning factor; b 1min is the minimum individual learning factor; b 2max is the maximum group learning factor; b 2min is the minimum group learning factor; v1 is the maximum speed limit; v2 is the minimum speed limit; S63: Specific steps of IPSO-NGBoost algorithm: S631: Determine the search range of the particle swarm and initialize the position and velocity of the particle swarm, where the position of each particle represents the initial hyperparameter of the NGBoost model; S632: Initialize the hyper parameters of the corresponding NGBoost model according to each particle; S633: Use the training set to train each NGBoost model, use the loss of the training set (such as mean square error) as the fitness function F, and calculate the fitness function F of each particle; S634: Determine the individual extreme value and the group extreme value of the particle according to the fitness function F of the particle; S635: Update weight coefficient, individual learning factor, group learning factor, speed upper limit and other parameters; S636: Perform particle mutation operation; S636: Determine whether the number of iterations reaches the maximum number of iterations. If the number of iterations is less than the maximum number of iterations, update the speed and position of the particle, and ensure that the position and speed of the particle are within the set range, and then go to step S633; if the number of iterations is greater than the maximum number of iterations, execute S637; S637: When the fitness function value is less than or equal to the set minimum error value, or the number of iterations exceeds the maximum value, the optimal hyperparameters of the NGBoost model are output, the NGBoost model is initialized using the optimal hyperparameters, the NGBoost model is trained, and the performance of the NGBoost model is tested.
6. According to claim 1, a method for detecting sulfur oxide gas from coal combustion based on photoacoustic spectroscopy and NGBoost, characterized in that: In S7, relevant data affecting the sulfur oxide gas concentration is input for testing, and various parameters in the model are adjusted; using the adjusted prediction model, spectral data is input for testing, and the sulfur oxide gas concentration in the future is predicted.
