## 2 Materials and Methods
### Random Forest Model  
Random forest is a frequently used ensemble learning technique based on the use of decision trees in machine learning, which involves training and identifying samples using multiple trees. The random forest method generates independent, identically distributed training sample sets for each decision tree using the bagging approach, and the final classification result relies on the aggregated votes from all decision trees. The primary theory is to repeatedly and randomly extract, with replacement, a vast number of original samples, enabling access to \(M\) training sample sets. Subsequently, \(n\) classification features (\(n\leq N\)) are randomly selected from the total \(N\) features within each sample set to facilitate full node splitting of decision trees, thus generating \(M\) decision trees. Consequently, the category of new samples is determined through a majority voting process among the outcomes obtained from all \(M\) decision trees [28]. First, assuming a sample set \(X\) with n categories, the expected sample entropy can be denoted as Equation (11):  
\[I(x_{1},x_{2},\ldots,x_{n})=-{\sum_{i=1}^{n}}\frac{x_{i}}{x}log_{2}\frac{x_{i}}{x} \tag{11}\]  
where \(A_{i}\) (\(i=1,2,\ldots,n\)) represents the number of samples for each category and \(x\) is the total number of samples involved. Consider a single feature (\(C\)) from a sample set, the expected entropy for the feature can be represented by Equation (12):  
\[\left\{ \begin{array}{l}E(C)={\sum_{j=1}^{m}}\frac{x_{1j}+x_{2j}+ \ldots+x_{nj}}{x}I\left(x_{1j},x_{2j},\ldots,x_{nj}\right)\\ I\left(x_{1j},x_{2j},\ldots,x_{nj}\right)=-{\sum_{i=1}^{m}}\frac{x_{ij}}{x_{j} }log_{2}\frac{x_{ij}}{x_{j}}\end{array} \right. \tag{12}\]  
where \(m\) denotes the total number of sample features and \(x_{ij}\) is the \(j\)-th dimension feature of a sample within category \(i\). The \(x_{j}\) represents the feature value of the \(j\)-th sample. The entropy gain for feature \(C\) could be calculated using the following Formula (13) [29]:  
\[Gain(C)=I(x_{1},x_{2},\ldots,x_{n})-E(C) \tag{13}\]  
The marginal functions for any two features \(D\) and \(E\) of a sample could be represented using the following Formula (14):  
\[na(D,E)=av_{m}(I(t_{m}(D)=E))-\underset{j\
eq E}{max}v_{m}(I(t_{m}(D)=j)) \tag{14}\]  
where the conversion function is denoted as \(I(X)\), while \(E\) and \(j\), respectively, refer to the positive and negative categories determined by the random forest. The _awn_ (\(X\)) and _na_ (\(D\), \(E\)) are the mean values and which are proportional to the effectiveness of feature extraction, respectively. Beyond deploying the random forest identification model, the parameters of random forest, which can significantly modulate the model's performance, need to be priorly calibrated. In this study, the optimal parameters of the leaf and decision tree counts were determined by the mean square error method proposed in [30; 31]. The optimization results showed that the mean square error values were low when the minimum number of leaves was lower than 5, and the associated errors were steady when the number of decision trees exceeded 200 (Figure 2). Consequently, a total of 300 trees and 5 leaves were determined for model identification. Figure 2: Comparison of mean square error under different number of leaves and trees in random forest. The workflow of this study is as follows: Firstly, we collected a dataset concerning glass artifacts, which included properties such as color, type, emblazonry, weathering conditions, and chemical composition of the glass. Secondly, we employed the chi-square test method to explore the correlation between the surface weathering degree of glass and their types, emblazonries, and colors. Subsequently, the BP neural network algorithm was utilized to predict the chemical composition of weathered glass before weathering. Then, a binary logistic regression model was used to determine the chemical composition, which is important for identifying glass type.