# Biogas Production Prediction Based on Feature Selection and Ensemble Learning
## 2 Materials and Methods
### Biogas Power Generation Systems
#### 2.1.3. Feature Selection  
The kitchen waste power generation system consists of a water and gas treatment part, a generator system and a boiler system, which contains many kinds of data, but the information expressed by each data source is limited, and not all data sources provide value for the model. If all influencing factors are taken as the input of the model, it will lead to a complex model structure and reduce the model performance. Therefore, feature selection is used to find the data that can really affect the objective function, and then the input and output of the model are reasonably selected to determine the structure of the model to include as much valuable information as possible [16].  
In order to explore the relationship between the features and biogas production, the filter feature selection method [17; 18] is used to calculate the correlation by the two-dimensional vector Pearson correlation coefficient, and the features with stronger correlations are retained. The Pearson correlation coefficient indicates the linear relationship between the data, representing the linear correlation between two variables \(x\) and \(y\), expressed by \(r\). The value of \(r\) is between \(-1\) and \(1\), and the larger its absolute value, the stronger the correlation. Its calculation formula is shown in Equation (1):  
Figure 1: Kitchen waste power generation system.  
\[r=\frac{\sum\limits_{i=1}^{m}{(x_{i}-\overline{x})(y_{i}-\overline{y})}}{\sqrt{ \sum\limits_{i=1}^{m}{(x_{i}-\overline{x})^{2}\sqrt{\sum\limits_{i=1}^{m}{(y_{ i}-\overline{y})^{2}}}}}} \tag{1}\]  
where \(r\) is the Pearson correlation coefficient, \(x_{i}\) and \(y_{i}\) is a pair of continuous correlation variables, and \(\overline{x}\) and \(\overline{y}\) are, respectively, the mean values of the variables \(x\) and \(y\).  
Sorting by the size of correlation coefficient, the features with a large absolute value of the correlation coefficient are selected as strong correlation features. Then, a different number of features are selected for prediction, and an error curve based on the number of features is obtained. From this, the number of features to be input into the final model is determined, and the extraction of important features is completed [19].  
A total of 79 characteristics are chosen from the three components of the kitchen waste power generation system. Combined with the analysis in Figure 1, it can be seen that of the three components, biogas production is more correlated with the water and gas treatment part. Twenty-one features of the water and gas treatment part are selected for analysis, among which, the operating frequency and frequency setting features of the two blowers do not change during system operation, while the change in the pressure regulating value feature is directly reflected in the inlet pressure features. Therefore, the correlation between the remaining 15 characteristics and the biogas production are discussed. Specific correlation coefficient calculations are shown in Table 1. The retained features are selected based on the data in Table 1, and the specific selection process is described in Section 3.2.