Forecasting N2O emission and nitrogen loss from swine manure composting based on BP neural network

Nitrogen loss and greenhouse gas emission during compost will cause secondary pollution and waste nutrients. To address this issue, a predictive model was set up to obtain a clear knowledge of the N2O emission and nitrogen loss from swine manure composting. This paper collected 68 group data from 11 published papers about pig manure composting N2O emission and total nitrogen loss. Select 4 indexes were taken as predicted indexes include aeration rate, moisture content, C/N, and the amount of superphosphate to establish a BP neural network for forecasting the N2O emission and total nitrogen loss from composting. The analyses show that the mean error of N2O emission forecasting model is 1.17; the value of MAPE is 138.85%. As for nitrogen loss, the mean error is 24.72 and the mean absolute percentage error is 11.06%. Compare to the traditional linear regression, the BP neural network model has good accuracy on forecasting N2O emission and TN loss from manure composting. BP neural network has considerable application prospect in forecast nitrogen loss and greenhouse gas emission from composting.


Introduction
Composting is an effective way to reuse nutrients in livestock manure. However, N2O emission from composting will cause secondary environmental pollution and also waste nitrogen in the manure. It was reported that 0.2-9.9% of initial total N is lost as N2O from nitrification or denitrification [1][2][3]. Several studies have concluded that add superphosphate will fix nitrogen and reduce N2O emission from manure composting [4][5][6]. Besides, other parameters during composting like C/N ratio, aeration rate and moisture content also have effect on N2O emission and nitrogen loss [7,8]. It is rather difficult to build a valid model for forecasting TN loss and N2O emission of the composting system based on traditional model. Neural network is a mathematical model that is inspired by the structure and functional aspects of biological neural networks, it provides a new approach for the nonlinear problems. Artificial neural networks (ANNs) have received great interest in various research fields include agriculture [9] and environment science [10]. BP neural network, which have a neural propensity for storing experimental knowledge, is a neural network model that is most widely used in nonlinear forecast [11]. This paper presents a new method applying the technology of neural network to forecast the N2O emission and nitrogen loss during the swine manure composting. With this model, scientists and policy makers can use this model to set a reasonable parameter for composting program.
2 The establishment of BP neural network model

Data extraction
Data were extracted from peer-reviewed journal papers published until July 2018. Totally 68 valid data of N2O emission and nitrogen loss from 11 paper were included in this study. To minimize bias, all studies use swine manure and straw in composting. Detailed data are listed in table 1, giving the following information: proportion of N2O-N emission on total nitrogen (%), TN loss rate (%), C/N ratio, Moisture content (%), aeration rate (L/kg min -1 , dry matter), and superphosphate content (%, dry matter).

Set the parameter of neural network model
In this study, we use three-layered neural network to establish forecasting model. Existing theory confirmed that arbitrary continuous functions could be approximated by threelayered neural network with feed forward structure [23]. The input variables of neural network model of nitrogen loss and N2O emissions are C/N, moisture content, aeration rate and superphosphate content, so the number of input neurons is 3; the output parameters are the proportion of N2O-N emission in total nitrogen (N2O-N) and the proportion total nitrogen loss (TN loss), so the number of output neurons in the output layer is 2.The principle of forecast of neural network is described by a 4-N-2 ANN. That topology is shown in figure 1. The neural network training program is processed under Matlab2016a. This paper used a fast training function Levenberg-Marquardt algorithm. This algorithm typically requires more memory but less time. Select 68 valid data, 70% of them (48 group) is used to training Neural Network, 15% is the share of testing data (10 group), the rest of them (10 group) is used to valid Neural Network. Other model parameters used in the BP neural network prediction model is shown in table 2.

The number of neurons in the hidden layer
The number of neurons in the hidden layer will affect the prediction precision of the model. Until now, it's still lack of theoretical basis to figure out the number of neurons in the hidden layer, researchers usually determined it empirically. In this paper, the numbojer of hidden layer nodes is initially set according to the below empirical formula: P = � t h t (1) P is the number of the hidden layer nodes; m represents the number of input layer nodes; n means the number of output nodes; α is a natural number between 1-10.
Under the MATLAB software platform and according to the training process above, the BP model was simulated and trained several times to find the number of hidden layers. Table 3 shows the prediction performance of BP neural network with changing of the hidden layer unit number. According to this Table, we found that when the hidden layer N=8, the function is more feasible, so in this paper the number of ANN hidden layer is selected to be 8.

Error evaluation
In order to evaluate the obtained results, the mean absolute percentage error (MAPE) and mean squared error (MSE) are used, which is given in the below formula (2), (3). The error index provides information on the short-term performance and represents a measure of the variation of predicted values around the measured data.
where y i is the measured value of power out of the system; y i is the forecasting value of the power output; n represents the number of model forecasting samples. Different simulations have been performed in order to compare errors. And the error analysis is used to select the optimal number of hidden nodes.

Regression value
The BP model synchronously predicts the training sample, validation sample, testing sample, and all samples while training by the regression equation. Figure 2 shows the regression results. The abscissa represents the target value; the ordinate represents the output value of the BP model. Regression R value is the regression coefficient, it measure the correlation between outputs and targets. The closer Regression value to 1, the better is the BP model and the higher is the prediction accuracy. In this paper training sample R=0.98588; validation sample R=0.97489; testing sample R=0.94657, the total R=0.97728. The regression results show prediction is feasible and reliable.

The mean squared error
Mean Squared Error is the average squared difference between outputs and targets. Figure 3 shows the change of MSE during the process of net training, abscissa represents the number of iterations and the ordinate represents the mean squared error (MSE) between the model output value and the actual value. Mean square error (MSE) of the training sample becomes small gradually as iterative steps increase. Due to BP network's own restrictions, at the initial stage, the curve comes to faster convergence, at the latter it becomes more gently. When the forecasting model output value is close to actual value, the value of MSE is close to 0. The MSE performance of train, validation and test is respectively shown in blue, green and red line. The dotted line shows that the validation results are the most ideal after the 15th iteration. This dotted line represents one of the set targets for the BP model to stop training.

BP Fitting result
The predicted value and actual value of N2O-N emissions and TN loss are shown in figure  4 and 5, respectively. Besides, we use traditional linear regression to forecast N2O-N emissions and TN loss, the performance comparison is show in Table 4. It can be observed that in BP model, the predicted values are quite close to the actual. As for TN loss rate, the mean squared error (MSE) of Neural Network is 24.72, the mean absolute percentage error (MAPE) between the predicted and actual values arrived at 11.06%. Better than linear regression, which the mean squared error (MSE) is 19.28 and the mean absolute percentage error (MAPE) 50.49%. For N2O-N emission predicts, the mean squared error (MSE) of Neural Network is 1.17, the mean absolute percentage error (MAPE) between the predicted and actual values arrived at 138.85%. Better than linear regression, which the mean squared error (MSE) is 1.43 and the mean absolute percentage error (MAPE) 250.82%.

Conclusion
Compare to traditional linear regression, the BP neural network prediction values have a good agreement with the experimental test values. The mean squared error (MSE) of nitrogen in BP model is 24.72; the mean absolute percentage error (MAPE) is 11.06%, which is presented to explain the prediction is feasible and reliable. However, the mean absolute percentage errors of N2O emission arrive at 138.85%, which is impermissible in the engineering application. In this study, the experimental data only involves 4 indexes, there is a further need more indexes such as initial pH and the volume of vessel, which also influence swine manure composting program. This will supplement and improve the accuracy of the neural network predicting N2O emission and nitrogen loss. Besides, more research is needed for other place or situation to enlarge the neural network.