Biochar physicochemical property prediction method based on BP neural network
By predicting the physical and chemical properties of biochar through BP neural network-based method, the problems of traditional methods taking time, high cost and single analysis variables are solved, and efficient and accurate prediction of the physical and chemical properties of biochar is achieved, supporting the optimization of the biomass pyrolysis process and the strategies for biochar application.
Patent Information
- Application Number
- CN202510229499.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-27
AI Technical Summary
Traditional experimental and analysis methods are time-consuming and cost-effective, and only support the analysis of a single variable, which limits the large-scale development and application of biochar.
The BP neural network-based method is used to predict the physical and chemical properties of biochar. This method preprocesses the data of the five influencing factors and their physical and chemical properties, establishes a BP neural network model, trains and adjusts the model parameters until accurate prediction data of the physical and chemical properties of biochar is generated.
It realizes efficient and accurate prediction of the physical and chemical properties of biochar, reduces resource waste, and supports the optimization of biomass pyrolysis process and reasonable strategies for biochar application.
Smart Images

Figure CN120220867A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of predicting the properties of biochar, and particularly to a method for predicting the physical and chemical properties of biochar based on a BP neural network. Background Art
[0002] With the increasingly serious environmental problems and the growing demand for clean energy, biomass pyrolysis has become an important method for green energy production. Biochar is a carbon-rich solid product obtained by high-temperature pyrolysis of biomass under anaerobic or hypoxic conditions. Due to its high stability, good adsorption performance, and rich pore structure, it is widely used in the fields of environmental protection and agricultural sustainable development.
[0003] The physical and chemical properties of biochar are affected by various factors such as the type of raw material, pyrolysis temperature, and duration. Traditional experimental and analytical methods are time-consuming and costly, and only support the analysis of a single variable, which limits the large-scale development and application of biochar. Therefore, it is particularly important to develop an efficient and accurate prediction method. Therefore, data-driven machine learning methods, especially BP neural networks, provide a new solution for predicting the physical and chemical properties of biochar. The present invention proposes a method for predicting the physical and chemical properties of biochar based on a BP neural network, aiming to accurately predict the physical and chemical properties of biochar through a BP neural network model, so as to provide decision support for the optimization of the biomass pyrolysis process and provide reasonable strategies for the application of biochar. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method for predicting the physical and chemical properties of biochar based on a BP neural network in view of the deficiencies of the above-mentioned prior art, so as to solve the problems of resource waste and single analysis variable brought by traditional experimental and analytical methods.
[0005] The present invention provides a method for predicting the physical and chemical properties of biochar based on a BP neural network, including the following steps:
[0006] S1. Obtain relevant data according to five influencing factors, namely the fixed carbon content of biomass, final pyrolysis temperature, pyrolysis time, heating rate, and inert gas blowing flow rate, and three physical and chemical properties of biochar, namely the specific surface area of biochar, biochar yield, and carbon-hydrogen ratio of biochar, establish a data set and perform data preprocessing;
[0007] S2. Divide the data set into a training set and a test set, and perform data normalization processing;
[0008] S3. Solve the optimal number of hidden layers according to the data set, and calculate the errors under different hidden layers for constructing a BP neural network model;
[0009] S4, construct a BP neural network model and set relevant parameters such as the number of training times, learning rate, target error, loss function and activation function;
[0010] S5. Input the data set into the constructed BP neural network model for training, use the positive feedback of the BP neural network to get the prediction result, and judge whether the result is reasonable according to the error; if it is reasonable, test and apply it; if it is unreasonable, use the reverse feedback method, adjust the weight according to the gradient descent method, and iterate the training repeatedly until the result is reasonable, and finally test and apply it;
[0011] S6. Obtain the predicted values of the physical and chemical properties of biochar based on various influencing factors, various error indicators, regression graphs, comparison graphs of true values and predicted values, and other results.
[0012] According to a method for predicting the physical and chemical properties of biochar based on a BP neural network provided by the present invention, the data preprocessing in S1 includes missing value processing and outlier processing. The missing value processing uses an interpolation method to process data, that is, missing values are predicted based on the distribution characteristics of the data, and the Lagrange interpolation method is used to predict the missing values and insert them into the corresponding missing values. The outlier processing uses a box plot to screen outliers, and data points outside the screening range are removed to avoid affecting the accuracy of the model.
[0013] According to a method for predicting the physical and chemical properties of biochar based on a BP neural network provided by the present invention, the data normalization processing in S2 includes dividing the data set and data normalization, and the data set division is to divide the data set into a training set and a test set, the training set is denoted as trainNum, and is used to train the data to establish a BP neural network model, and the test set is denoted as testNum, and is used to evaluate the generalization ability and effectiveness of the model, wherein trainNum:testNum=8:2, and a cross-validation method is adopted to redistribute the proportions of the training set and the test set, and repeatedly train the models under different proportions.
[0014] According to the method for predicting the physical and chemical properties of biochar based on BP neural network provided by the present invention, the method for calculating the optimal number of hidden layers in S3 is: setting the initialization error to 10 -5 The error is used to continuously update the number of hidden nodes, calculate the error in the iterative process, and compare it with the initialization error to find the number of hidden layers with the minimum error, which is the optimal number of hidden layers.
[0015] According to a method for predicting the physical and chemical properties of biochar based on a BP neural network provided by the present invention, the method for constructing a BP neural network model in S4 is:
[0016] Set the input layer weight to W i , the input data is X i, the input layer expression is: ∑WiXi. Assuming the hidden layer bias is b, the calculation under the optimal hidden layer can be expressed as: ∑WiXi + b. The output layer activation functions use tan-sig and purelin. Additionally, the number of training iterations is set to 1000, the learning rate is set to 0.01, and the target error is set to 10 -6 , the input layer, hidden layer, and output layer are connected in sequence to construct a BP neural network model.
[0017] According to a method for predicting the physicochemical properties of biochar based on a BP neural network provided by the present invention, the method of repeated iterative training in S5 is to adjust the model accuracy using the feedback effect of the BP neural network model: five input features are set, namely the fixed carbon content of biomass, final pyrolysis temperature, pyrolysis time, heating rate, and inert gas blowing flow rate, and three output features are set, namely the specific surface area of biochar, biochar yield, and carbon-hydrogen ratio of biochar. The input feature data is input into the trained BP neural network model for training. From the input layer to the hidden layer and then to the output layer, the prediction result is output, and it is evaluated using the target error. If the error is qualified, it proves that the model is accurate, and the process ends. If the error is unqualified, the feedback effect of the BP neural network is used to adjust the input layer weight W i , in essence, this process sets a loss function to adjust the weight. After adjusting the weight, retraining is carried out, and this process is repeated until the error is qualified.
[0018] According to a method for predicting the physicochemical properties of biochar based on a BP neural network provided by the present invention, the result in S6 is, in order to correspond to the input layer, the predicted output value is also normalized, including outputting the model prediction result: outputting the prediction result of the physicochemical properties of biochar based on the BP neural network, including the comparison between the true value and the predicted value, prediction error, error histogram, and prediction regression graph.
[0019] The present invention has the following advantages compared with the prior art:
[0020] The present invention provides a method for predicting the physicochemical properties of biochar based on a BP neural network, aiming to solve problems such as resource waste and single analysis variables existing in traditional experimental and analysis methods. This method preprocesses the data of factors affecting the physicochemical properties of biochar and its physicochemical property data, including preprocessing steps such as missing value processing and outlier processing, to ensure the quality of the input data. Subsequently, a BP neural network is established to predict the physicochemical properties of biochar for the processed data. In particular, the optimal number of hidden layer nodes is determined to construct the model, and then the BP neural network is used for model training, finally generating accurate prediction data and visualization images of the physicochemical properties of biochar. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0022] Figure 1 is the principle flow chart of the prediction method for the physicochemical properties of biochar based on the BP neural network;
[0023] Figure 2 is the BP neural network structure diagram;
[0024] Figure 3 is the image of the activation function tan-sig;
[0025] Figure 4 is the comparison chart of the true value and the predicted value of the model prediction;
[0026] Figure 5 is the regression chart of the model prediction;
[0027] Figure 6 is the variance histogram of the model prediction;
[0028] Figure 7 is the mean square error chart of the training set and the validation set during the iteration process;
[0029] Figure 8 is the test regression chart;
[0030] Figure 9 is the test error chart. Detailed implementation manners
[0031] Example 1
[0032] This example provides a prediction method for the physicochemical properties of biochar based on the BP neural network, and the specific steps are as follows:
[0033] S1. Obtain relevant data according to five influencing factors and three physicochemical properties of biochar, establish a data set and perform data preprocessing, and the data preprocessing includes missing value processing and outlier processing;
[0034] The above five influencing factors refer to the fixed carbon content of biomass, the final pyrolysis temperature, the pyrolysis time, the heating rate, and the blowing flow rate of inert gas;
[0035] The three physicochemical properties of biochar refer to the specific surface area of biochar, the biochar yield, and the carbon-hydrogen ratio of biochar;
[0036] Among the five influencing factors, namely the final pyrolysis temperature of biomass, heating rate, pyrolysis time, blowing flow rate of inert gas, and fixed carbon content, the final pyrolysis temperature, heating rate, pyrolysis time, and blowing flow rate of inert gas represent the pyrolysis conditions of biomass, while the fixed carbon content and particle size of biomass represent the types of biomass. These data are closely related to the physicochemical properties of biochar, providing guarantee for the accuracy of the subsequent model construction;
[0037] In addition, among the three physicochemical properties of biochar, the biochar yield represents the product output efficiency, the biochar carbon-hydrogen ratio is used to measure its stability, and the specific surface area of biochar is closely related to its application properties;
[0038] For the treatment of missing values in data preprocessing, in order to prevent affecting the model effect, the interpolation method is used to process the data, that is, the missing values are predicted according to the distribution characteristics of the data. In this embodiment, the Lagrange interpolation method in polynomial interpolation is used;
[0039] Let x j be the independent variable and y j be the dependent variable, with a total of k + 1 value points, that is, the initial point is (x0, y0) and the end point is (x j , y j ). Then the Lagrange interpolation polynomial is:
[0040]
[0041] In the above formula, l j (x) is the interpolation basis function, expressed as:
[0042]
[0043] To sum up, this process can be implemented using the Lagrange_interp function in Python or Matlab;
[0044] For the treatment of outliers in data preprocessing, screening is carried out by drawing box plots, and limit conditions such as the upper quartile Q1, lower quartile Q2, median Q3, upper edge Q4, and lower edge Q5 are set in sequence.
[0045] Among them, the upper edge Q4 is set as:
[0046] Q4 = Q1 + 1.5(Q1 - Q2);
[0047] The lower edge Q5 is set as:
[0048] Q5 = Q2 - 1.5(Q1 - Q2);
[0049] "Q1 - Q2" is the interquartile range;
[0050] This process can be implemented using Python's boxplot function, removing data outside the edge;
[0051] S2, divide the data set collected in S1 into a training set and a test set, and normalize the data in the training set and the test set;
[0052] In order to evaluate the generalization ability and effectiveness of the model and to facilitate the construction of the BP neural network, the processed data set is divided into a training set and a test set. The training set is used to train the model, and the test set is used to evaluate the quality of the model.
[0053] The ratio of training set to test set is set to 8:2. However, in order to reduce the chance and improve the generalization ability of the model, the cross-validation method is used to redistribute the ratio of training set to test set to 9:1, 7:3 or 6:4.
[0054] In this embodiment, it is generally required that the number of data in the training set is larger than that in the test set, and the model is repeatedly trained using different proportions to enhance the robustness of the model;
[0055] Data normalization is to normalize the training set and the test set to between (-1, 1). Normalization can convert dimensional quantities into dimensionless quantities and normalize the data to the same order of magnitude, which is convenient for model input and avoids the problem of reduced model accuracy due to dimensional differences.
[0056] The normalization process can be expressed as follows: Let X be the original data, X' be the normalized data, X max is the maximum value of the data set, X min is the minimum value of the data set, then the calculation formula for the normalized data is:
[0057]
[0058] S3, solving the optimal number of hidden layers according to the data set, and calculating the errors under different hidden layers for BP neural network construction;
[0059] Set the initialization error to 10 -5 , the error is used to continuously update the number of hidden nodes. During the training process, the error of the network training process is continuously calculated and compared with the initialization error to obtain the number of hidden layers with the minimum error, which is the optimal number of hidden layers. This process is similar to the grid search in machine learning;
[0060] S4, construct BP neural network, set relevant parameters such as training times, learning rate, target error, loss function and activation function;
[0061] Construct BP neural network, set relevant parameters such as training times, learning rate, target error, loss function and activation function, including: calculating the optimal number of hidden layers and constructing BP neural network;
[0062] Establish a BP neural network model based on the optimal number of hidden layers obtained from S3: Set the input layer weights as W i , and the input data as X i , then the expression of the input layer is: ∑WiXi; Set the bias of the hidden layer as b, then the calculation under the optimal hidden layer can be expressed as: ∑WiXi + b;
[0063] Set activation functions for the output layer to facilitate the output of the prediction results. In this embodiment, the tan-sig function and the purelin function are used;
[0064] The tan-sig function is an S-shaped function, whose non-saturated interval is [-1.7, 1.7], and the value range is (-1, 1), as Figure 3 shown, and its expression is:
[0065]
[0066] The purelin function is an identity mapping function, that is, the value before activation is equal to the value after activation, and its expression is: y = x. When the activation function is set to purelin, it is equivalent to directly passing the neuron value as the activation value to the next layer, that is, directly outputting the result;
[0067] In addition, set the number of model training times to 1000 times, the learning rate to 0.01, and the target error to 10 -6 , as Figure 2 shown, connect the input layer, hidden layer, and output layer in sequence to build a BP neural network model. In the figure, f(x) is the activation function;
[0068] S5. Input the data set into the established BP neural network model for training, use the forward feedback effect of the BP neural network to obtain the prediction result, judge whether the result is reasonable according to the error. If it is reasonable, conduct testing and application; if it is not reasonable, use the reverse feedback effect, adjust the weights according to the gradient descent method, and repeatedly iterate and train until the result is reasonable, and finally conduct testing and application;
[0069] Input the data set into the established BP neural network model for training, use the forward feedback effect of the BP neural network to obtain the prediction result, judge whether the result is reasonable according to the error. If it is reasonable, conduct testing and application; if it is not reasonable, use the reverse feedback effect, adjust the weights according to the gradient descent method, and repeatedly iterate and train until the result is reasonable, and finally conduct testing and application, and use the feedback effect of the BP neural network model to adjust the model accuracy;
[0070] Five input features are set, namely the final temperature of biomass pyrolysis, heating rate, pyrolysis time, blowing flow rate of inert gas, and fixed carbon content, and three output features are set, namely biochar yield, carbon-hydrogen ratio of biochar, and specific surface area of biochar;
[0071] The data is input into the trained BP neural network model for training. From the input layer to the hidden layer and then to the output layer, the prediction results are output. The target error is used for evaluation. If the error is qualified, it proves that the model is accurate, and the process ends. If the error is unqualified, the feedback effect of the BP neural network is used to adjust the weights of the input layer according to the gradient descent method. i Substantially, a loss function is set in this process to adjust the weights. After adjusting the weights, retraining is carried out, and this process is repeated until the error is qualified;
[0072] In this embodiment, the gradient descent method is similar to the process of taking derivatives. It is a process of finding the global optimal solution by calculating the gradient, repeatedly adjusting the weights and training the model, calculating the gradient under this weight, and selecting the optimal weight;
[0073] S6. Obtain the predicted values of the physical and chemical properties of biochar predicted based on various influencing factors, various error indicators, regression graphs, comparison graphs of true values and predicted values, etc.
[0074] To correspond to the input layer, the predicted output values are also normalized to obtain the predicted values of the physical and chemical properties of biochar predicted based on various influencing factors, various error indicators, regression graphs, comparison graphs of true values and predicted values, etc.;
[0075] As Figure 4 shown, this figure is the comparison of the true values and predicted values drawn by the present invention for the test data Y1, Y2, Y3. The abscissa represents 40 groups of test set input data, and the ordinate represents the predicted values and true values corresponding to each group of test set input data. At the same time, a corresponding table is generated here, as shown in Table 1 below, for storing the final results;
[0076] In addition, the regression graph and error histogram of the test data predicted by the present invention are as Figure 5 and Figure 6 shown, and the regression coefficients R 2 are respectively: 0.94625, 0.9222, and 0.92502, and the errors are all concentrated near the 0 error baseline, and during the iteration process, the MSE has been concentrated around 10 -2 although the target error of 10 -6 is not reached, the result is in the optimal position;
[0077] It can be obtained therefrom that a method for predicting the physical and chemical properties of biochar based on a BP neural network provided by this embodiment has extremely high prediction accuracy and extremely small errors, is suitable for the analysis of the physical and chemical properties of biochar, can better fit the data, provides decision-making support for the optimization of the biomass pyrolysis process, and also provides a suitable reference for the application of biochar;
[0078] To verify the accuracy and universality of this prediction method, 150 groups of experimental data from published literature were extracted, a data set was established for testing, X1 was set as the final pyrolysis temperature, X2 was the heating rate, X3 was the biomass particle size, X4 was the blowing flow rate of inert gas, X5 was the fixed carbon content, Y1 was the biochar yield, Y2 was the carbon-hydrogen ratio of biochar, and Y3 was the specific surface area of biochar;
[0079] As Figure 8 and Figure 9 shown, this figure is the regression graph and error graph of the example test process. It can be seen that the R 2 values of the training set, test set, and validation set are all above 0.9, and the error graph shows that the error is stable around 10 -2 ;
[0080] It should be noted that during the example test process, when the number of data groups was 50, the evaluation index R 2 for predicting Y1 - Y3 based on X1 - X5 in the example was stable around 0.80. When the number of data groups was 137, the evaluation index R 2 for predicting Y1 - Y3 based on X1 - X5 in the example was stable around 0.88, and neither reached the above R 2 = 0.90 or above. This is due to insufficient data volume. In practical applications, the data volume can be appropriately increased to solve this problem, or the amount of experiments can be increased to supplement the data. This characteristic further illustrates that the robustness and universality of the present invention are extremely strong, and it is suitable for both the large amount of data generated during the process of biomass pyrolysis to produce biochar and the prediction work of small data sets.
[0081] Table 1
[0082]
[0083]
[0084]
[0085]
[0086] The above are only the preferred embodiments of the present invention, and do not impose any limitations on the present invention. Any simple modifications, changes, and equivalent variations made to the above embodiments according to the technical essence of the invention still fall within the protection scope of the technical solution of the present invention.
Claims
1. A method for predicting the physical and chemical properties of biochar based on BP neural network, characterized in that: The following steps are involved: S1. According to the five influencing factors of biomass fixed carbon content, pyrolysis final temperature, pyrolysis time, heating rate and inert gas blowing flow rate and three biochar physical and chemical properties, biochar specific surface area, biochar yield and biochar carbon-hydrogen ratio, relevant data were obtained, a data set was established and data preprocessing was performed; S2, divide the data set into training set and test set, and perform data normalization; S3, solving the optimal number of hidden layers according to the data set, and calculating the errors under different hidden layers for building a BP neural network model; S4, construct a BP neural network model and set relevant parameters such as the number of training times, learning rate, target error, loss function and activation function; S5. Input the data set into the constructed BP neural network model for training, use the positive feedback of the BP neural network to get the prediction result, and judge whether the result is reasonable according to the error; if it is reasonable, test and apply it; if it is unreasonable, use the reverse feedback method, adjust the weight according to the gradient descent method, and iterate the training repeatedly until the result is reasonable, and finally test and apply it; S6. Obtain the predicted values of the physical and chemical properties of biochar based on various influencing factors, various error indicators, regression graphs, comparison graphs of true values and predicted values, and other results.
2. According to claim 1, a method for predicting the physical and chemical properties of biochar based on BP neural network is characterized in that: The data preprocessing described in S1 includes missing value processing and outlier processing; the missing value processing uses interpolation method to process data, that is, to predict missing values according to the distribution characteristics of the data, and use Lagrange interpolation method to predict missing values and insert them into the corresponding missing values; the outlier processing uses box plot to screen outliers, and data points outside the screening range are eliminated to avoid affecting the accuracy of the model.
3. The method for predicting the physical and chemical properties of biochar based on BP neural network according to claim 1, characterized in that: The data normalization processing described in S2 includes data set division and data normalization. The data set division is to divide the data set into a training set and a test set. The training set is denoted as trainNum, which is used to train data to establish a BP neural network model. The test set is denoted as testNum, which is used to evaluate the generalization ability and effectiveness of the model, wherein trainNum:testNum=8:
2. At the same time, a cross-validation method is used to redistribute the proportions of the training set and the test set, and repeatedly train the models under different proportions.
4. The method for predicting the physical and chemical properties of biochar based on BP neural network according to claim 1, characterized in that: The calculation method of the optimal number of hidden layers described in S3 is: set the initialization error to 10 -5 , the error is used to continuously update the number of hidden nodes, calculate the error in the iterative process, and compare it with the initialization error to find the number of hidden layers with the minimum error, which is the optimal number of hidden layers.
5. The method for predicting the physical and chemical properties of biochar based on BP neural network according to claim 1, characterized in that: The method for constructing the BP neural network model described in S4 is: Set the input layer weight to W i , the input data is X i , the input layer is expressed as: ∑WiXi, the hidden layer bias is set to b, then the calculation under the optimal hidden layer can be expressed as: ∑WiXi+b, the output layer activation function uses tan-sig and purelin, in addition, the number of training times is set to 1000, the learning rate is 0.01, and the target error is set to 10 -6 , the input layer, hidden layer and output layer are connected in sequence to construct the BP neural network model.
6. The method for predicting the physical and chemical properties of biochar based on BP neural network according to claim 1, characterized in that: The iterative training method described in S5 is to use the feedback effect of the BP neural network model to adjust the model accuracy: set five input features, namely, biomass fixed carbon content, pyrolysis final temperature, pyrolysis time, heating rate and inert gas purge flow rate, set three output features, namely, three output biochar specific surface area, biochar yield and biochar carbon-hydrogen ratio, input the input feature data into the trained BP neural network model for training, from the input layer to the hidden layer and then to the output layer, output the prediction result, and use the target error for evaluation. If the error is qualified, it proves that the model is accurate, and the process ends. If the error is unqualified, the feedback effect of the BP neural network is used to adjust the input layer weight W according to the gradient descent method. i In essence, the process sets the loss function to adjust the weights, retrains after adjusting the weights, and repeats the process until the error is acceptable.
7. The method for predicting the physical and chemical properties of biochar based on BP neural network according to claim 1, characterized in that: The results described in S6 correspond to the input layer, and the predicted output values are also normalized, including the output model prediction results, the output of the prediction results of the physical and chemical properties of biochar based on the BP neural network: comparison between the true value and the predicted value, prediction error, error histogram, and prediction regression graph.