A method for predicting gasoline quality indicators and analyzing their causes
Through improved genetic algorithms, optimize the hyperparameters of the LightGBM model and combine it with the SHAP analysis framework, the problem of difficulty in achieving reliable online quality indicator analysis during gasoline blending is solved, and prediction accuracy and model interpretability are improved.
Patent Information
- Application Number
- CN202210634546.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-06
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-06-06
AI Technical Summary
The prior art is difficult to achieve reliable online quality indicator analysis during gasoline blending, resulting in production losses and economic benefits being affected. At the same time, traditional genetic algorithms tend to immature converge when optimizing the hyperparameters of LightGBM models, resulting in slower search speed.
The improved genetic algorithm (IGA) is adopted to introduce orthogonal variation, two-point variation operators and queen competition mechanisms to optimize the hyperparameters of the LightGBM model, and interpret the prediction results in combination with the SHAP analysis framework to improve the interpretability and prediction accuracy of the model.
The model parameter adjustment process is significantly simplified, the training speed and prediction accuracy of the LightGBM model are improved, making the prediction of gasoline quality indicators more reliable and efficient, and the interpretability of the model is enhanced.
Smart Images

Figure CN114841468B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of oil product index prediction, and more particularly to a gasoline quality index prediction and cause analysis method. Background Art
[0002] In the production process of finished gasoline, oil quality is the key to oil production. The quality of oil directly affects the production efficiency. Ensuring that the quality of oil meets the standards and can achieve the optimization of blending efficiency is the fundamental reason for enterprises to continuously improve the blending formula of finished gasoline.
[0003] However, at present, in the actual production process of enterprises, due to the concern about production losses caused by the oil blending formulas generated by some unexplainable data-driven models, enterprises often rely on experienced oil blending experts to manually add blending components, and then conduct offline testing of the quality indicators of the blended finished gasoline. In order to prevent secondary readjustment due to unqualified oil quality indicators, manual experience-based blending often results in excess quality, which seriously affects the economic benefits of the enterprise. In addition, offline testing of oil blending quality indicators leads to production stagnation.
[0004] In view of the above problems, it is urgent to conduct reliable online quality index analysis of finished gasoline before the blending formula is produced. Considering the excellent model performance of the lightweight gradient boosting tree (LightGBM) in actual engineering applications, it is used to establish a prediction model for the quality index of finished gasoline. However, due to its large number of hyperparameters, single parameter trial and error, grid search or random search cannot necessarily find the global optimal parameter. Although there are precedents for optimizing the network parameters of lightweight gradient boosting trees using genetic algorithms (GA) in other prediction fields, the traditional GA algorithm is prone to immature convergence and cannot find the optimal solution. The algorithm cannot use the feedback information in the network in time, which leads to a slow search speed. Even if the optimization parameters tend to the optimal solution of the lightweight gradient boosting tree to a certain extent, the search time will undoubtedly increase.
[0005] Therefore, how to improve the genetic algorithm (GA) and establish an optimized LightGBM network and an interpretable finished gasoline quality index prediction model based on the improved genetic algorithm (GA) is an urgent problem that technical personnel in this field need to solve. Summary of the invention
[0006] In view of this, the present invention provides a method for predicting and analyzing the causes of gasoline quality indicators. Taking into account the advantages of the lightweight gradient boosting tree algorithm (LightGBM) in training speed and nonlinear processing, it is applied to the predictive modeling of finished gasoline quality indicators, and the interpretable machine learning framework SHAP is used to explain the causes of indicator prediction. At the same time, in view of the difficulty in parameter selection in the gradient boosting tree network (GBDT) training process, an improved genetic algorithm (IGA) is used to optimize the relevant parameters, eliminating the inconvenience of manual experience and iterative trial and error parameter selection, and greatly simplifying the parameter adjustment process of the model.
[0007] In order to achieve the above object, the present invention adopts the following technical solution:
[0008] A gasoline quality index prediction and cause analysis method, characterized by comprising the following steps:
[0009] S1. Use gasoline historical production data to build the LightGBM model offline;
[0010] S2. Optimize the hyperparameters of the LightGBM model by introducing the IGA algorithm with orthogonal mutation, double-point mutation operator and queen bee competition mechanism;
[0011] S3, obtaining finished gasoline formula components and quality index data, dividing them into training set and test set, training the optimized LightGBM model to obtain a trained LightGBM model;
[0012] S4. Use the SHAP learning framework to analyze the prediction results obtained by the trained LightGBM model to obtain the degree and direction of influence of each sample feature on the prediction results.
[0013] Preferably, in S2, the step of optimizing the hyperparameters of the LightGBM model by the IGA algorithm includes:
[0014] S21: Determine the optimization parameters, perform binary encoding on them, randomly generate individuals by the binary encoding, and initialize the population;
[0015] S22: Construct a fitness function, the fitness function is:
[0016]
[0017] In the formula, i is the sample individual, n is the total number of samples, represents the simulation prediction value, y i Indicates actual value;
[0018] S23: Calculating the fitness of the initialized population according to the fitness function, and introducing a queen bee competition mechanism;
[0019] S24: Population evolution, using roulette wheel to select parameter groups, performing double-point crossover according to the crossover rate, using mutation rate combined with the number of iterations to select orthogonal mutation or double-point mutation, iteratively generating new populations,
[0020] Compare the optimal fitness value of the current population parameter group with the optimal fitness value of the new population parameter group, introduce the queen competition mechanism to make the population optimization converge, generate a new population, and end the optimization when the termination condition is met.
[0021] Preferably, in S3, before dividing the training set and the test set, outliers are removed according to the Laida criterion, where the Laida criterion is a precision measurement of the measured variable, and X1, X2, ...X n , and then calculate its arithmetic mean X,
[0022] According to the arithmetic mean X, the standard error σ is calculated according to the following formula:
[0023]
[0024] Determine whether the measured variable satisfies the following formula:
[0025] |v i |=|x i -x|>3σ
[0026] If it meets the requirement, it is considered that x i Contains gross errors and is unqualified data, so it should be discarded.
[0027] Preferably, in S3, before dividing the training set and the test set, the step further includes normalizing the data, wherein the normalization adopts a min-max normalization method to convert the finished gasoline formula components and quality index data obtained in S3 into values within the interval [0,1],
[0028] The standardized conversion function is:
[0029]
[0030] In the formula, f is the actual measured value, f min As the minimum value of sample data, f max is the maximum value of the sample data.
[0031] Preferably, in S3, the obtained finished gasoline formula components and quality index data are divided using a self-help method.
[0032] When the total number of samples is n, the bootstrap method is to sample n times with replacement to obtain n data, and after removing the repeated data, m data are obtained, the m data are the training set data, and the remaining nm data are the test set data.
[0033] Preferably, in S3, the optimized LightGBM model is trained using a unilateral sampling algorithm and a mutually exclusive feature bundling algorithm, and a leaf-wise leaf growth strategy is used to limit the splitting depth.
[0034] Preferably, the prediction results obtained by the trained LightGBM model are analyzed using a SHAP learning framework to obtain a SHAP summary graph, a feature interaction SHAP graph, and a feature SHAP dependency graph. The feature interaction SHAP graph is sorted from large to small according to the SHAP value, and is used to measure the contribution and influence of the feature on the model prediction value.
[0035] Preferably, after the LightGBM model is trained in S3, the performance of the trained LightGBM model is evaluated using common performance indicators, including mean square error (MSE), mean absolute error (MAE), and determination coefficient (R). 2 , the calculation formula is as follows:
[0036]
[0037]
[0038]
[0039] Where N is the number of test set samples, represents the parameter prediction value, y i Indicates the actual value, Represents the mean.
[0040] Preferably, the performance of the trained LightGBM model is evaluated by using a prediction error distribution PED, which is obtained by the following formula:
[0041]
[0042] Where num(υ≤δ) represents the number of prediction errors within the error range of δ, num(N) represents the total number of predicted values, υ represents the set of errors between the predicted values and the true values, and δ is determined according to the lower limit standard of National VI gasoline and the upper limit standard of the enterprise.
[0043] It can be seen from the above technical solution that, compared with the prior art, the present invention discloses a method for predicting and analyzing the causes of gasoline quality indicators, which uses orthogonal variation and queen competition mechanism to ensure population diversity and accelerate the convergence speed of the algorithm, making it faster and easier to optimize the key hyperparameters of the LightGBM model, eliminating the inconvenience of manual parameter selection and iterative trial and error parameter selection, and greatly simplifying the adjustment process of model parameters; at the same time, the SHAP analysis framework is introduced to explain the global and interactive effects of the features in the LightGBM prediction model on the oil quality indicators, and the reasons for the model's prediction of oil indicators are explained from a global and individual perspective, which enhances the credibility of the LightGBM model prediction results, and at the same time provides an analytical basis for the optimization strategy of the finished gasoline blending components, laying a foundation for improving the quality and efficiency of enterprise production. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0045] Figure 1 The accompanying drawing shows the overall research route for optimizing the LightGBM model using IGA provided by the present invention;
[0046] Figure 2 The accompanying drawing shows the training process of the LightGBM model provided by the present invention;
[0047] Figure 3 The accompanying drawing is a SHAP learning framework diagram provided by the present invention;
[0048] Figure 4 The accompanying drawings are the optimal parameter curves of the traditional genetic algorithm (GA) and the improved genetic algorithm (IGA) provided by the present invention;
[0049] Figure 5 The accompanying drawings are octane number prediction results based on different models provided by the present invention;
[0050] Figure 6 The accompanying drawing is a performance comparison diagram of quality index prediction by different models provided by the present invention. DETAILED DESCRIPTION
[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0052] This embodiment is driven by the demand for accurate prediction of quality indicators in the blending process of finished gasoline, and adopts a new method of improving GA for optimizing LightGBM network. This method mainly introduces GA improved orthogonal variation and queen bee competition mechanism to quickly converge and select the optimal parameter group. Finally, the optimal model parameter group is used for the prediction of quality indicators of LightGBM model, and the interpretable machine learning framework SHAP is used to analyze the coupling influence of characteristic components of model input on important quality indicators of blended oil. This method, based on the combination of industrial data-driven and interpretable machine learning methods, provides a reference for optimizing the blending components of finished gasoline and improving the quality indicators of blended oil.
[0053] Specifically, the gasoline quality index prediction and cause analysis method disclosed in the embodiment of the present invention is implemented through the following steps:
[0054] S1. Use gasoline historical production data to build the LightGBM model offline;
[0055] The LightGBM model is an open source integrated algorithm based on the improved gradient boosting decision tree framework GBDT. In view of the shortcomings of GBDT, such as the need to traverse the data set multiple times during the iteration process, resulting in slow training speed and large memory consumption, it is proposed to use the histogram algorithm to build a decision tree model, which saves about half the time of the gradient boosting decision tree algorithm.
[0056] S2. The hyperparameters of the LightGBM model are optimized by introducing the IGA algorithm with orthogonal mutation, double-point mutation operator and queen bee competition mechanism.
[0057] In traditional genetic algorithms, some gene values in genetic coding are lost too early, resulting in convergence before tending to the optimal solution, that is, convergence before maturity, or too slow convergence. Even if the optimization parameters are made to tend to the optimal solution of the lightweight gradient boosting tree to a certain extent, the search time will undoubtedly increase, which is the biggest problem of the standard genetic algorithm. In order to prevent the individuals of the population from falling into the same extreme value and stopping evolution and to ensure the diversity of the population, the present invention adopts an improved genetic algorithm IGA, which maintains the diversity of the population and improves the convergence speed by introducing orthogonal mutation, double-point mutation operator and queen competition mechanism.
[0058] In one embodiment, seven hyperparameters directly related to model accuracy and training speed are selected for optimization, namely n_estimators, learning_rate, max_depth, min_data_in_leaf, min_child_weight, L1_alpha, and L2_lambda. The overall research route for optimization is as follows: Figure 1 The overall training process is as shown in Figure 2 As shown;
[0059] And the optimization steps are:
[0060] S21: Determine the optimization parameters, perform binary encoding on them, randomly generate individuals by the binary encoding, and initialize the population;
[0061] S22: Construct a fitness function based on the objective function, where the objective function is:
[0062]
[0063] In the formula, i is the sample individual, n is the total number of samples, represents the simulation prediction value, y i Indicates actual value;
[0064] S23: Calculating the fitness of the initialized population according to the fitness function, and introducing a queen bee competition mechanism;
[0065] S24: Population evolution, using roulette wheel to select parameter groups, performing double-point crossover according to the crossover rate, using mutation rate combined with the number of iterations to select orthogonal mutation or double-point mutation, iteratively generating new populations,
[0066] Compare the optimal fitness value of the current population parameter group with the optimal fitness value of the new population parameter group, introduce the queen competition mechanism to make the population optimization converge, generate a new population, and end the optimization when the termination condition is met.
[0067] The population evolution process is:
[0068] a. Decode the individual, calculate the fitness value of the individual, and retain the optimal solution individual, denoted as O;
[0069] b. Use roulette wheel to select operations;
[0070] c. Double-point crossover of the parent individuals to produce new individuals;
[0071] d. In the early stage of algorithm iteration, orthogonal mutation operator is used to generate new offspring individuals, and in the later stage of evolution, double-point mutation is used to generate new offspring individuals;
[0072] e. Calculate the fitness value of the new offspring and find the optimal solution individual, denoted as N;
[0073] f. Introduce the queen bee competition mechanism, compare the size of the optimal solution individual O of the current population with the optimal solution individual N of the new offspring. If O < N, replace O with N and retain it; otherwise, continue to retain O.
[0074] g. Repeat (b - f) until the termination condition is met and end the optimization.
[0075] S3. Obtain the component and quality index data of the finished gasoline formula, divide them into a training set and a test set, and train the optimized LightGBM model to obtain the trained LightGBM model.
[0076] When training the model, to reduce the error of abnormal data and facilitate systematic analysis and processing of the data, the following processing needs to be performed on the data before dividing the training set and the test set:
[0077] 1) According to the Pauta criterion, that is, the 3σ criterion, remove outliers; when collecting and measuring data, considering the errors of the collection and measurement equipment and manual measurement, resulting in some incorrect and missing data, it is necessary to delete unqualified and missing data using the 3σ criterion in combination with the National VI vehicle gasoline standard.
[0078] The 3σ criterion, that is, for the precision measurement of the measured variable, obtain X1, X2...X n , and then calculate its arithmetic mean X.
[0079] According to the arithmetic mean X, calculate the standard error σ according to the following formula:
[0080]
[0081] Judge whether the measured variable satisfies the following formula:
[0082] |v i | = |x i - x| > 3σ
[0083] If it meets the condition, it is considered that x i contains gross errors and is unqualified data, which should be剔除.
[0084] 2) Normalize the data. To avoid prediction result errors caused by the dimensional differences of the values of different feature data and degrade the model performance, the present invention adopts the min - max normalization method to convert the data obtained in S3 into values within the range of [0, 1].
[0085] The standardization conversion function is:
[0086]
[0087] In the formula, f is the actual measured value, fmin As the minimum value of sample data, f max is the maximum value of the sample data.
[0088] After the model is established, it is necessary to test and analyze the performance of the established model, and use the self-help method to divide the obtained finished gasoline formula components and quality index data.
[0089] When the total number of samples is n, the bootstrap method is to sample n times with replacement to obtain n data, and after removing the repeated data, m data are obtained, the m data are the training set data, and the remaining nm data are the test set data;
[0090] Then, the LightGBM model is trained using a unilateral sampling algorithm and a mutually exclusive feature bundling algorithm. This algorithm can greatly improve the training speed of the model without losing prediction accuracy, while reducing memory consumption. In addition, for the traditional growth strategy with low leaf splitting gain in the same layer, LightGBM uses a leaf-wise leaf growth strategy to split the leaves with the largest current splitting gain, continuously cycling to improve training efficiency. In order to prevent overfitting, a maximum depth limit is set.
[0091] After the training is completed, in order to evaluate the performance of the prediction model for the quality index of the finished gasoline blending formula, the performance evaluation index commonly used in the regression model is used and the prediction error distribution is defined to evaluate the performance of the index prediction model:
[0092] 1) Common performance indicators, including mean square error (MSE), mean absolute error (MAE) and coefficient of determination (R) 2 , the calculation formulas are as follows:
[0093]
[0094]
[0095]
[0096] Where N is the number of test set samples, represents the parameter prediction value, y i Indicates the actual value, Represents the mean.
[0097] 2) Prediction error distribution PED. In actual engineering applications, a certain error band is allowed in production. In addition, since there is a certain degree of deviation between the predicted value of the regression model and the actual value, considering the above two points, this paper introduces an error range for the predicted value to measure the prediction accuracy of the model from the perspective of practical application. That is, based on the predicted value of the index, considering the lower limit of the index, the National VI gasoline standard, and the upper limit, the enterprise standard, the error range δ is defined, and the prediction accuracy is evaluated by the proportion of the number of errors less than or equal to δ to the total number of predictions. The more values in the error range δ, the better the prediction performance of the model.
[0098] The prediction error distribution PED is obtained by the following formula:
[0099]
[0100] Where num(υ≤δ) represents the number of prediction errors within the error range of δ, num(N) represents the total number of predicted values, υ represents the set of errors between the predicted values and the true values, and δ is determined according to the lower limit standard of National VI gasoline and the upper limit standard of the enterprise.
[0101] S4. Use the SHAP learning framework to analyze the prediction results obtained by the trained LightGBM model to obtain the degree and direction of influence of each sample feature on the prediction results.
[0102] The SHAP learning framework specifically includes a SHAP summary graph, a feature interaction SHAP graph, and a feature SHAP dependency graph. The feature interaction SHAP graph is sorted from large to small according to the SHAP value, which is used to measure the contribution and influence of the feature on the model prediction value. A positive SHAP value indicates that the feature value helps to improve the prediction value, while a negative SHAP value indicates that the feature has an opposite effect on improving the prediction result.
[0103] In one embodiment, the SHAP summary graph, the feature interaction SHAP graph, and the feature SHAP dependency graph are respectively as follows: Figure 3 As shown in (a), (b) and (c);
[0104] From the SHAP summary diagram and the model input feature interaction SHAP diagram, it can be concluded that the most important feature affecting the octane number prediction results is the generated oil. If the generated oil characteristic value is too large, it will have a reverse effect on the improvement of the octane number prediction results. If the etherified gasoline characteristic value is too large, it will also have an inhibitory effect on the improvement of the octane number prediction results. When the characteristic values of gasoline heavy aromatics, ethylbenzene, xylene, MTBE, etc. are large, they will have a positive promoting effect on the improvement of the octane number prediction results. The dependence diagram of generated oil and ethylbenzene shows that when the generated oil characteristic value is small and the ethylbenzene characteristic value is large, it will have a positive effect on the improvement of the octane number prediction results.
[0105] Since the anti-knock value and octane number are similar in nature, the SHAP analysis results of the anti-knock value prediction are consistent with the octane number. Due to space limitations, the simulation results are not shown.
[0106] In order to verify the advantages of the improved genetic algorithm IGA, random search and traditional genetic algorithm (GA) were used to optimize the hyperparameters of the LightGBM model and compared with them.
[0107] First, based on manual experience and the actual problems of model prediction, after multiple iterations of model parameter trial and error, we selected the optimization ranges of seven hyperparameters that directly affect the training speed and accuracy of the LightGBM model.
[0108] Because there are many hyperparameters to be optimized, random search can improve the speed of parameter search, but it depends on the number of iterations. The search for the optimal parameter combination is random. Within the search range given by the hyperparameters, 21 samples are sampled without replacement, and finally the parameter combination with the smallest root mean square error is selected as shown in Table 1.
[0109]
[0110] Table 1
[0111] Because there is no qualitative regulation for the parameter selection of genetic algorithm, combined with multiple experimental comparisons, this paper applies genetic algorithm to the LightGBM model parameter optimization, selects the population size of 50, the maximum evolutionary generation of 80 generations, the orthogonal mutation generation of 8 generations, and the crossover probability P c =0.6, mutation probability P m =0.1. The optimal parameter search time and fitness curves of the traditional genetic algorithm (GA) and the improved genetic algorithm (IGA) are shown in Table 2. Figure 4 As shown:
[0112]
[0113] Table 2
[0114] Depend on Figure 4 It can be seen that the traditional genetic algorithm (GA) used for parameter optimization of the LightGBM model of finished gasoline quality indicators converges to the optimal solution in about 47 generations, while the improved genetic algorithm (IGA) introduced in the present invention converges to the optimal solution in about 23 generations. Moreover, based on the comparison of the parameter optimization time, it can be seen that the LightGBM model adopts the improved genetic algorithm (IGA) to converge faster for parameter optimization.
[0115] In order to verify the superiority of the LightGBM model with improved genetic algorithm optimization parameters proposed in this paper in quality indicator prediction modeling, the prediction results are compared with those of the K-nearest neighbor regression algorithm, support vector machine, random forest, LightGBM model with random search combined with artificial experience parameter search, and LightGBM model with traditional genetic algorithm optimization parameters. Figure 5 The octane number prediction results based on different models, that is, a, b, c, d, e, and f are the comparisons of the predicted values and true values of the octane number based on the SVM model, KNN model, RF model, LGBM model, GA_LGBM model, and IGA_LGBM model, respectively. It can be seen intuitively from the figure that only a few samples based on the LightGBM model, the LightGBM model with genetic algorithm optimization parameters, and the LightGBM model based on the improved genetic algorithm optimization parameters do not overlap with the true samples, and the overlap is high; while the optimized RF, KNN, and SVM show that the predicted values and the true samples do not overlap in multiple ways, and the overlap decreases in turn (the other five quality indicators also show similar results). It can be seen that the prediction of the quality indicators of finished gasoline based on the LightGBM model considered in this paper is better than most other machine learning models.
[0116]
[0117] Table 3
[0118] Table 3 shows the quantitative comparison of the performance of prediction of different model quality indicators. Figure 6 The performance comparison of different models on quality index prediction is shown in Figure 2.
[0119] From Table 3, Figure 6 It can be seen that compared with other methods, the MSE and MAE values of the LightGBM model proposed in this paper are the smallest. Within the error range of 0.15, the model in this paper also shows good prediction accuracy, and R 2 The overall value is closest to 1, indicating that this model has better accuracy and generalization ability for quality indicator prediction.
[0120]
[0121] Table 4
[0122] Table 4 is a comparison of the average prediction errors of quality indicators of several optimal parameter methods after 5 experiments. It can be seen from Table 4 that the IGA_LightGBM model has a smaller prediction error and more accurate prediction in the prediction of finished gasoline quality indicators. In view of this, the IGA_LightGBM model combined with this paper has excellent prediction performance and can be used for modeling finished gasoline quality indicators.
[0123] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0124] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A gasoline quality index prediction and cause analysis method, characterized in that: The steps include: S1. Use gasoline historical production data to build the LightGBM model offline; S2. Optimize the hyperparameters of the LightGBM model by introducing the IGA algorithm with orthogonal mutation, double-point mutation operator and queen bee competition mechanism; The steps of optimizing the hyperparameters of the LightGBM model by the IGA algorithm include: S21: Determine the optimization parameters, perform binary encoding on them, randomly generate individuals by the binary encoding, and initialize the population; S22: Construct a fitness function, the fitness function is: In the formula, i is the sample individual, n is the total number of samples, represents the simulation prediction value, y i Indicates actual value; S23: Calculating the fitness of the initialized population according to the fitness function, and introducing a queen bee competition mechanism; S24: Population evolution, using roulette wheel to select parameter groups, performing double-point crossover according to the crossover rate, using mutation rate combined with the number of iterations to select orthogonal mutation or double-point mutation, iteratively generating new populations, Compare the optimal fitness value of the current population parameter group with the optimal fitness value of the new population parameter group, introduce the queen competition mechanism to make the population optimization converge, generate a new population, and end the optimization when the termination condition is met; S3, obtaining finished gasoline formula components and quality index data, dividing into training set and test set, training the optimized LightGBM model, and obtaining a trained LightGBM model; S4. Use the SHAP learning framework to analyze the prediction results obtained by the trained LightGBM model to obtain the degree and direction of influence of each sample feature on the prediction results.
2. A gasoline quality index prediction and cause analysis method according to claim 1, characterized in that: In S3, before dividing the training set and the test set, outliers are removed according to the Laida criterion, which is a precision measurement of the measured variable, and X1, X2, ...X n , and then calculate its arithmetic mean X, According to the arithmetic mean X, the standard error σ is calculated according to the following formula: Determine whether the measured variable satisfies the following formula: |v i |=|x i -x|>3σ If it meets the requirement, it is considered that x i Contains gross errors and is unqualified data, so it should be discarded.
3. A gasoline quality index prediction and cause analysis method according to claim 2, characterized in that: In S3, before dividing the training set and the test set, the data is normalized. The normalization adopts the min-max standardization method to convert the finished gasoline formula components and quality index data obtained in S3 into values within the interval [0,1]. The standardized conversion function is: In the formula, f is the actual measured value, f min As the minimum value of sample data, f max is the maximum value of the sample data.
4. A gasoline quality index prediction and cause analysis method according to claim 1, characterized in that: In S3, the obtained finished gasoline formula components and quality index data are divided using a self-help method. When the total number of samples is n, the bootstrap method is to sample n times with replacement to obtain n data, and after removing the repeated data, m data are obtained, the m data are the training set data, and the remaining nm data are the test set data.
5. A gasoline quality index prediction and cause analysis method according to claim 1, characterized in that: In S3, the optimized LightGBM model is trained using a unilateral sampling algorithm and a mutually exclusive feature bundling algorithm, and a leaf-wise leaf growth strategy is used to limit the split depth.
6. A gasoline quality index prediction and cause analysis method according to claim 1, characterized in that: The SHAP learning framework is used to analyze the prediction results obtained by the trained LightGBM model to obtain a SHAP summary graph, a feature interaction SHAP graph, and a feature SHAP dependency graph. The feature interaction SHAP graph is sorted from large to small according to the SHAP value to measure the contribution and influence of the feature on the model prediction value.
7. A gasoline quality index prediction and cause analysis method according to claim 1, characterized in that: After the LightGBM model is trained in S3, the performance of the trained LightGBM model is evaluated using common performance indicators, including mean square error (MSE), mean absolute error (MAE), and determination coefficient (R). 2 , the calculation formula is as follows: In the formula, N is the number of test set samples, represents the parameter prediction value, y i Indicates the actual value, y i Represents the mean.
8. A gasoline quality index prediction and cause analysis method according to claim 7, characterized in that: The performance of the trained LightGBM model is also evaluated using the prediction error distribution PED, which is obtained by the following formula: Where num(υ≤δ) represents the number of prediction errors within the error range of δ, num(N) represents the total number of predicted values, υ represents the set of errors between the predicted values and the true values, and δ is determined according to the lower limit standard of National VI gasoline and the upper limit standard of the enterprise.