# Carbon Quota Allocation Prediction for Power Grids Using PSO-Optimized Neural Networks
## 3 Materials and Methods
### Model Building and Optimization
#### 3.2.3 Combined Prediction Model Accuracy Test  
1. GM(1,1) module accuracy test  
Based on the above model analysis, the GM(1,1) model's training set uses the 2011-2023 real-value indicators as sample data. After testing the model, the predicted values for the 2011-2023 data are obtained. The relative error between the actual and predicted values is within 0.05, indicating good predictive performance. The model's prediction results are depicted in Figure 6.  
Figure 5: The PSO-BPNN algorithm.  
2. Neural Network Module Accuracy Test  
To compare the prediction accuracy of different neural network models, this paper uses four error metrics: MAPE, RMSE, R\({}^{2}\), and MAE. MAPE represents the average percentage error per observation, RMSE quantifies the magnitude of the model's prediction error, R\({}^{2}\) indicates how well the model explains the observed variance, and MAE measures the average absolute value of the prediction error. The respective calculation formulas are given below:  
\[\text{MAPE}=(1/n)\sum_{i=1}^{n}\left|(y_{i}-\hat{y}_{i})/y_{i}\right|\times 100\% \tag{26}\]  
\[\text{RMSE}=\sqrt{(1/n)\sum_{i=1}^{n}\left(y_{i}-\hat{y}_{i}\right)^{2}} \tag{27}\]  
\[\text{R}^{2}=1-\left(\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}/\sum_{i=1}^{n}(y_{i }-\overline{y}_{i})^{2}\right. \tag{28}\]  
\[\text{MAE}=(1/n)\sum_{i=1}^{n}\left|y_{i}-\hat{y}_{i}\right| \tag{29}\]  
where \(n\) denotes the total amount of samples of the prediction model; \(\hat{y}_{i},y_{i}\) and \(\overline{y}_{i}\) are the predicted value of the \(i\) the sample point, the real true value, and the mean of all samples, respectively.  
The neural network model utilizes the output set of the GM(1,1) model as the input layer of the BP network, while the carbon emissions of the power industry influenced by green energy serve as the output layer. The input layer of a neural network is composed of  
Figure 6: GM(1,1) Module Training Results.  
4 neurons, the hidden layer has 8 neurons, and the output layer consists of 1 neuron. The Levenberg-Marquardt algorithm is chosen for its superior convergence during the training procedure of BPNN. The BPNN is configured with a learning rate of 0.1 and an accuracy rate of 0.0001, using 1000 samples. The dataset Is randomly divided into the training and test sets, with 120 samples in the training set and 66 samples in the test set.  
As depicted in Table 2, the comparison of prediction errors among different network models in estimating carbon emissions reveals that the PSO-BPNN attains superior prediction accuracy compared to the BP neural network. The RMSE, MAE, and MAPE of PSO-BPNN are 0.37166, 0.23043, and 0.052377, which are smaller than the corresponding metrics for the BP neural network. Figures 7 and 8 demonstrate that when both the PSO-BPNN and BPNN are utilized for predicting carbon emissions in the power industry, the agreement between the predicted and actual values is strong, with the PSO-BPNN achieving a higher level of agreement than the traditional BP model, reaching 0.99368.  
Figure 8: _Cont._  
Figure 7: Results of BPNN and PSO-BPNN model fitting.  
In an attempt to increase the prediction accuracy of CO2 emissions in the power industry, the GM(1,1) model is integrated with the PSO-BPNN, which delivers the highest level of precision. Figure 9 and Table 3 display the comparison between forecasted and actual values of carbon emissions using individual prediction models and combined prediction models. The findings reveal that the combined model has a significantly smaller prediction error than the individual model, with an identification accuracy of 99.46%, outperforming that of the individual model. Therefore, the GM(1,1)-PSO-BPNN hybridized model offers a dependable approach to predicting CO2 emissions in the power system.