## 2 Materials and Methods
### Model Feature Selection  
To predict the CO2 concentration in the classroom, we gathered data on a range of environmental factors that might influence indoor CO2 levels as the initial set of variables. However, having an excessively large number of influencing factors can lead to redundant data, increasing the complexity and time needed to develop a CO2 concentration prediction model. Conversely, if the number of influencing factors is too limited, poor prediction outcomes may result due to an insufficient number of training samples for the model. Finding the right balance in the dimensionality of the influencing factors is crucial for an effective and accurate CO2 concentration prediction model. The relative importance of each factor in terms of its effect on CO2 levels can vary, and those factors with low relative significance should be excluded beforehand. Therefore, the task of selecting the most important influencing factors from the environmental factor set, identifying which factors to utilize as input variables for model training, and assigning appropriate weights to each factor are fundamental steps in data preprocessing. In this context, we employ the RF algorithm to rank the importance of preselected environmental factors. This method helps determine the strength of the relationships between variables and highlights the most influential factors when predicting CO2 concentrations. The RF algorithm introduces a random attribute selection process during training. Multiple rounds of sampling are performed by bagging techniques, sequentially generating decision trees for the obtained samples. These trees are subsequently combined, and the model's output is determined through a voting technique. The RF model is an integrated prediction model comprising multiple decision tree prediction models, represented as \(F=\{h(x,\theta_{k}),k=1,2,3,\cdots,K\}\), where \(\{\theta_{k}\}\) is an independently and identically distributed random vector and \(K\) is the number of decision trees in the RF. Given an input variable \(x\), the classification of \(x\) is ultimately determined after multiple decision trees in the RF have been evaluated. The primary steps for constructing the RF are depicted in Figure 5.  
One of the features of the RF algorithm is the estimation of feature importance for the classification problem by calculating feature importance scores, which are now widely used in feature selection and evaluation [37]. The algorithm typically employs the mean decrease accuracy (MDA) [38] to assess feature importance. The RF algorithm consists of the following eight steps:  
1. The bag samples from the original training dataset \(O=(X,Y)\) are used to obtain \(M\) sets of training samples. 2. The decision tree \(\sigma_{1}\) is trained based on sample subset \(O_{1}\), during which the out-of-bag (OOB) sample is \(\Gamma_{1}^{oob}\). 3. The decision tree \(\sigma_{1}\) is applied to predict the OOB sample \(\Gamma_{1}^{oob}\), and the number of correctly predicted samples are recorded as \(R_{1}^{oob}\). \(d\) (where \(d=1,\ 2,\ \cdots,\ P\)) features of the OOB sample \(\Gamma_{1}^{\text{oob}}\) are randomly disrupted to create \(P\) new OOB samples as \(\Gamma_{1,d}^{\text{oob}}\). 5. The decision tree \(\sigma_{1}\) is applied to predict the samples from the \(P\) new OOB samples created in the previous step, and the number of correctly predicted samples is recorded as \(\left\{R_{1,1}^{\text{oob}},\cdots R_{1,d}^{\text{oob}},\cdots R_{1,P}^{\text {oob}}\right\}\). 6. Steps 2 to 5 are repeated for sample subsets \(\text{O}_{2},\cdots\text{O}_{m},\cdots\text{O}_{M}\) in sequence, obtaining the number of correctly classified samples as \(\left\{R_{2}^{\text{eob}},R_{2,1}^{\text{oob}},\cdots R_{2,P}^{\text{oob}} \right\},\cdots,\left\{R_{M}^{\text{oob}},R_{M,1}^{\text{oob}},\cdots R_{M,P} ^{\text{oob}}\right\}\). 7.