CLR of Chinese ancient glass compositional data
After the sample data (Supplementary Tables S1, S2) were processed using the CLR, the data in Table 2 were obtained. All the calculated data can be found in Supplementary Table S4.
Analysis of the relationships between the surface weathering of glass relics and the glass type, emblazonry, and color
Studying the relationships between the surface weathering of ancient glass artifacts and their glass type, decorative style, and color is highly important. On the one hand, it facilitates an understanding of the aging and degradation patterns of glass with different characteristics from a materials science perspective; on the other hand, it helps to exclude the potential interference of certain features in subsequent analytical procedures. The weathering, emblazonry, color, and type of sample cultural relics in Supplementary Table S1 are fixed class variables, and the chi-square test21,22 can be used to analyze the relationship between them. To investigate whether the expected frequency meets the requirements, the weathering condition is used as the grouping variable, with emblazonry, type, and color as the variables. The contingency table (Supplementary Table 3) was calculated by SPSS.
Given the data in Table 3, it can be concluded that only the expected frequency between surface weathering and glass type meets the requirements of the chi-square test, and the chi-square test can be used; the expected frequency between surface weathering and emblazonry, surface weathering and color is equal to 0, and the chi-square test cannot be used.
The chi-square test (Table 4) is used to test the independence of surface weathering and glass type. The null hypothesis is that the glass surface weathering and glass type are independent, and the alternative hypothesis is that the glass surface weathering and glass type are not independent.
If the significance level is 0.05 and the P value is 0.02, which is lower than the significance level, at the 95% confidence level, the original hypothesis is rejected, and glass surface weathering is not independent of the glass type; that is, the glass type affects surface weathering.
Fisher’s exact test can be used for the independent analysis of surface weathering and emblazonry, surface weathering and color23,24. Compared with the chi-square test, Fisher’s exact test is more accurate when dealing with low-frequency observations (such as fewer than 5 observations). The basic principle of Fisher’s exact test is to use the hypergeometric distribution to calculate the probability of the observation data. By comparing the difference between the observed data and the randomly distributed data, it is possible to determine whether there is a significant correlation between the two categorical variables. Because the emblazonry in Supplementary Table S1 has three levels, A, B, and C, it cannot be directly used for Fisher’s exact test. First, emblazonry A and B in Supplementary Table S1 are selected as a group, A and C, as a group, and B and C, as a group, which are called the emblazonry AB group, emblazonry AC group, and emblazonry BC group, respectively; then, Fisher’s exact test is used.
If the significance level is 0.05, the significant P value in Table 5 is 0.06, which is greater than the significance level, and the original hypothesis cannot be rejected. Therefore, no significant difference was observed between the surface weathering and emblazonry AB group. Using the same method, Fisher’s exact test P values of the surface weathering and the emblazonry AC and BC groups were 0.57 and 0.15, respectively, which are greater than 0.05. There was no significant difference between the surface weathering and emblazonry AC and BC groups. Using the same test method, it can also be concluded that there is no significant difference between surface weathering and color. Through the above discussion, it can be concluded that only the type of glass has a significant effect on surface weathering and that the color and emblazonry of glass have no significant effect on surface weathering.
Analysis of the contents of the corresponding chemical components in ancient glass before or after weathering
Statistical analysis of the chemical composition of different glass types
The 67 valid data points in Table 2 are divided into three categories, before-weathering, after-weathering, and severe-weathering, according to the weathering of the sampling points, and then divided into lead-barium glass and high-potassium glass according to the type of glass. Because there are no sampling data for severe-weathering high-potassium glass, the data in Table 2 can be divided into five categories: before-weathering high-potassium, after-weathering high-potassium, before-weathering lead-barium, after-weathering lead-barium, and severe-weathering lead-barium. These five categories are represented by the letters T1, T2, T3, T4, and T5, respectively. Note that the surfaces of the glass cultural relic samples numbered 49, 50 and 53 are after-weathering, but there is a before-weathering sampling point, and the glass weathering type should be classified as before-weathering at this sampling point. The classification of all the valid data is shown in Table 6.
To analyze the variation in chemical compositions of these five glass types (T1, T2, T3, T4, and T5), SiO2 was taken as an example to construct a box diagram of SiO2.
As shown in Fig. 1, the content of SiO2 in high-potassium glass is greater than that in lead-barium glass. After weathering, the content of SiO2 in high-potassium glass is the highest, with an average value of 9.09, and the content of SiO2 in severe-weathering lead-barium glass is the lowest, with an average value of 4.44. Under the conditions of known high-potassium glass or lead-bismuth glass, in order to determine whether there is a significant difference in the content of SiO2 before and after weathering. Taking lead-barium glass as an example, whether the content of SiO2 obeys a normal distribution at T3 and T4 is tested first, and a QQ diagram is constructed.

Boxplot of SiO2 content in T1, T2, T3, T4, and T5.
The data points in Figs. 2 and 3 are approximately distributed near a straight line, which can be considered to obey a normal distribution. In general, the Jarque–Bera test25,26 is also needed to test normality. The Jarque–Bera test evaluates whether the null hypothesis that the sample obeys a normal distribution with unknown mean and variance is true, but the Jarque–Bera test cannot be used for small sample tests. When the sample data volume is small, the Lilliefors test27,28 can be used. With respect to this problem, the classification sample size of the sample of cultural relics is small, and the Lilliefors test can be used. After MATLAB calculation, p = 0.13 and p = 0.26 are obtained, which are greater than the significance level of 0.05, and the null hypothesis cannot be rejected. That is, the content of SiO2 under T3 and T4 obeys a normal distribution, which also verifies the theory that the component data in the introduction often obey a normal distribution after the central log-ratio transformation (CLR).

qq plot of the SiO2 content in T3.

Content qq plot of SiO2 in T4.
The two-sample t test29,30 is used to test whether the mean values of the two are equal. The null hypothesis is that there is no significant difference in the mean value. Using MATLAB calculations, p = 0.001, which is less than the significance level of 0.05. Thus, the null hypothesis is rejected; that is, there is a significant difference in the mean value of SiO2 in lead-barium glass before weathering (T3) and after weathering (T4). The sample mean μ, variance σ, median, 95% confidence interval \({\mu }_{c},{\sigma }_{c}\), and coefficient of variation (CV) of SiO2 in five glass types (T1, T2, T3, T4, and T5) were calculated (Table 7).
The coefficient of variation \({CV}\) of T2 and T3 was less than 0.15, indicating that there was a small probability of outlier values in the current data and that the average value could be used for statistical analysis. The coefficient of variation (CV) of T1, T4, and T5 was greater than 0.15, indicating that there might be outliers in the data. The medians of 6.59, 5.25 and 4.10 were used for statistical analysis. Using the same analysis method, the mean (or median) of other chemical components under different types of glass can be calculated.
From Table 8, it can be concluded that the mean values (medians) of SiO2, K2O, PbO, and CuO in the high-potassium glass before and after weathering are quite different; in the lead-barium glass, the mean values (median) of Na2O, K2O, Fe2O3, and P2O5 before and after weathering are quite different. The mean values (medians) of SiO2, Fe2O3, PbO, BaO, and SO2 in the severe-weathering and after-weathering glass types are quite different.
According to the after-weathering point data, the chemical composition content before weathering is predicted
As shown in Table 2, the cultural relics of samples 49 and 50 are lead-barium glass, which has sampling data for both before-weathering points and after-weathering points. Chemical composition histograms of samples 49 (Fig. 4) and 50 (Fig. 5) before and after weathering, respectively, are drawn below.

Histogram of before-weathering and after-weathering chemical components for sample number 49.

Histogram of before-weathering and after-weathering chemical components for sample number 50.
The proportion of each chemical component in the two samples is generally essentially the same, as shown in Fig. 5, and the specific values are slightly different. Unfortunately, only these two sets of matching data before-weathering and after-weathering have a small amount of data and lack high-potassium glass matching data. Therefore, according to the after-weathering point data, predicting the chemical composition content before weathering through regression, neural networks, and other models is inappropriate.
From the discussion in Section “Analysis of the relationships between the surface weathering of glass relics and the glass type, emblazonry, and color”, it is evident that only the type of glass has a significant effect on surface weathering and that the color and emblazonry of the glass have no significant effect on surface weathering. Therefore, when predicting the chemical composition content before weathering, only the type of glass needs to be considered, and the color and emblazonry do not need to be considered. Through the comparison of Fig. 4 and Fig. 5, the numerical changes in each chemical component in different samples before and after weathering are different, but the overall ‘appearance’ is consistent; that is, the proportion of each chemical component is nearly consistent; therefore, it is speculated that under different glass types, the ratio of the mean value (median) of chemical composition before weathering to the mean value (median) after weathering can be used to describe the change rule between them. From the compositional statistics summarized in Table 8, the median (or mean) concentration of each oxide for the different glass types was obtained. Based on these values, the proportional change in each chemical component before and after weathering was computed according to Eq. (1), yielding the ratio parameter \({k}_{{ij}}\)(\(i=\mathrm{1,2},\ldots ,14{;\; j}=\mathrm{1,2})\), where \(i\) represents the fourteen analyzed oxides and \(j\) corresponds to the high-potassium (\(j=1\)) and lead-barium (\(j=2\)) glass groups.
$${k}_{i1}=\frac{T1\left(i\right)}{T2\left(i\right)},{k}_{i2}=\frac{T3\left(i\right)}{T4\left(i\right)}$$
(1)
The chemical composition content before weathering can be predicted by multiplying \({k}_{{ij}}\) by the detection data of the after-weathering points. To verify the feasibility of this prediction method, the data of cultural relics No. 49 and No. 50 are used for verification. First, the value of \({k}_{i2}\) is multiplied by the chemical composition data of the after-weathering points to obtain the prediction data before weathering, after which the absolute error between the prediction data and the measured data is calculated. The complete table content can be found in Supplementary Table S5.
From Table 9, it can be concluded that the absolute error of the prediction of 9 chemical components, such as SiO2, CaO, MgO, Al2O3, and CuO, is small, and the absolute error of the prediction of 4 chemical components, such as Na2O, K2O and Fe2O3, is large. The reason for this finding may be that although the sample cultural relics are divided into three categories—before-weathering, after-weathering, and severe-weathering—the situation of the same type of individuals is different.
Analysis of the classification law of high-potassium glass and lead-barium glass
For a cultural relic worker, fast and accurate classification of glass relics is necessary, which is a supervised classification problem. In Section “Analysis of the contents of the corresponding chemical components in ancient glass before or after weathering”, the mean (median) of each chemical composition in different glass types is calculated, and Table 8 is obtained. From Table 8, it can be concluded that the values of SiO2, K2O, PbO, and BaO in high-potassium glass and lead-barium glass are quite different. The key to classifying ancient Chinese glass relics is the selection of one or more chemical components to categorize and distinguish different types of glass. In the following, several types of classification models commonly used in machine learning are employed for analysis.
Decision trees
In accordance with the data in Table 2, MATLAB is used to construct Fig. 6.

Decision tree for high-potassium and lead-barium glass.
The results revealed that the classification results were related only to the chemical composition of No. 9, that is, the value of PbO. The threshold value of the decision tree output was 3.04; when the content of PbO was less than 3.04, the sample was classified as high-potassium; otherwise, it was classified as lead-barium. The evaluation index of a classification method can be described by the importance of the chemical composition of the classification, the accuracy of the training set and the test set, and the F1 score. The above indices of the decision tree were calculated. The results indicate that the characteristic importance of PbO is 100%, and the accuracy and F1 score are both 1; that is, the use of PbO can completely divide the sample cultural relics into two categories, and the accuracy of each sample classification is 100%.
To further explore the use of decision trees to classify cultural relics, according to the weathering of cultural relics, they are divided into two categories. Decision tree models are established for before-weathering cultural relics and after-weathering cultural relics, and the branches of the decision trees are compared.
It can be concluded from Fig. 7 that the classification of before-weathering cultural relics is consistent with the decision tree of the overall classification; that is, the classification result is related only to the size of the PbO. When the content of PbO is less than 3.04, it is classified as a high-potassium class; otherwise, it is classified as a lead-barium class. In after-weathering cultural relics, the classification index is SiO2. When the content of SiO2 is less than 8.006, the after-weathering cultural relics are classified as lead-barium; otherwise, they are classified as high-potassium.

Before-weathering and after-weathering decision trees.
Logit regression
Logit regression31,32, in this classification problem, because the sample data in Table 2 have been transformed by the central logarithm ratio, the collinearity between the chemical components is eliminated. The glass type (high-potassium, lead-barium) is regarded as the two-class classification data, and the chemical components are quantitative data. Using the binary logit model, F1 = 1 in the training set and test set can be obtained by SPSS calculation. The logit regression confusion matrix heatmap shows that logit regression correctly classifies the sample’s cultural relics.
Support Vector Machine (SVM)
A support vector machine (SVM)33,34 can solve the problem of machine learning in the case of small samples and simplify common classification and regression problems. When SPSS is used for calculations, the model results indicate that both the accuracy and the F1 score are 100%. All the lead-bismuth glasses can be classified correctly. It can be concluded that the classification effect of support vector machines is also good.
Random forest
In machine learning, random forest35,36 is a classifier containing multiple decision trees, and the output category is determined by the mode of the category output by individual trees. Leo Breiman37,38 and Adele Cutler39 developed the random forest algorithm. The results of the random forest can be obtained by SPSS calculations, for which F1 = 0.973; the importance of the characteristics involves many chemical components: PbO accounts for 27.3%, BaO accounts for 15%, and SrO accounts for 10.6%. The results show that one sample was misclassified.
Identification and sensitivity analysis of unknown types of glass relics
According to the evaluation results of the above four commonly used classification models, the F1 values for the decision tree, binary logit regression and support vector machine (SVM) are all 1, and the classification effect is the best. The F1 value for random forest is 0.976, and the classification effect is better.
To analyze the sensitivity of the above five methods, the data in Supplementary Table S3 (after normalization and central log-ratio transformation) are supplemented with a certain proportion of noise and then classified by the above five methods. After adding 5% noise to the data in Supplementary Table S3, the A6 category obtained by the after-weathering decision tree changed; after adding 10% noise to the data in Supplementary Table S3, the discrimination of two cultural relics by the after-weathering decision tree changed, the discrimination of one cultural relic by random forest changed, and the discrimination of cultural relics by the decision tree, binary logit and support vector machine (SVM) did not change. Therefore, the decision tree, binary logit, and support vector machine (SVM) methods demonstrated better anti-interference effects.
To evaluate the effectiveness of the proposed mathematical model, we applied it to classify ancient glass artifacts of unknown types (Supplementary Table S3) and further assessed its robustness under data perturbations. The data for each chemical component in Supplementary Table S3 were normalized, and the central log-ratio transformation (CLR) was performed. The above decision tree, binary logit regression, support vector machine (SVM) and random forest methods were used for classification. The results of classifying unknown types of ancient glass using machine learning models are shown in Table 10.
The cultural relic numbers A1, A3, A4, A5, A6, A7, and A8 and the five classification methods are consistent. The cultural relic number A2, decision tree, binary logit, and support vector machine (SVM) are classified as lead-barium, and the other two methods are classified as high-potassium. According to the discussion of the first five classification methods, A2 should be classified as lead-barium. All the unknown types of glass artifacts were successfully classified, and the results are presented in Table 11.
To evaluate the robustness of the five classification methods described above, we introduced controlled noise into the dataset (Suplementary Table S3), which had been preprocessed through central log-ratio (CLR) transformation. Specifically, noise was added at two levels (5% and 10%) to the composition data of the unknown-type glass artifacts, and the classification performance of the five models was reevaluated. When 5% noise was added, the classification result of one artifact (A6) changed under the weathering decision tree model. At the 10% noise level, the weathering decision tree misclassified two artifacts, and the random forest model misclassified one artifact. In contrast, the standard decision tree, binary logistic regression (logit), and support vector machine (SVM) models maintained consistent classification results across both noise levels. These findings indicate that the decision tree, binary logit, and SVM classifiers exhibit strong resistance to data perturbation and demonstrate superior robustness.
Subclass division of high-potassium glass and lead-barium glass
In Part 3.4, the classification rules of high-potassium glass and lead-barium glass are discussed. Sometimes, it is necessary to classify these two types of glass into subcategories. This is an unsupervised classification problem. The high-potassium glass data in Table 2 are subjected to K-means clustering, K = 2.
It can be concluded from Table 12 that the P values of CaO, SO2, SrO, PbO, BaO, and CuO are all less than 0.05, which is significant at this level. The null hypothesis is rejected, indicating that there are significant differences between the above chemical components in the categories classified by cluster analysis.
The contour coefficient is the average of the contour coefficients of all the samples. The value range of the contour coefficient is [–1, 1]. The closer the distance of the samples in the same category is, the farther the distance of the samples in different categories is, the higher the score is, and the better the clustering effect is. The DBI (Davies–Bouldin) index is used to measure the ratio of the intracluster distance to the intercluster distance of any two clusters. The smaller the index is, the better the clustering effect is. The CH (Calinski–Harbasz score) index is obtained as the ratio of separation to tightness. The larger the CH is, the better the clustering effect is. As shown in Table 13, when the contour coefficient = 0.246, DBI = 1.597, and CH = 4.746, these indicators do not look too good. Taking K = 3 and K = 4, the contour coefficients can be calculated to be 0.251 and 0.22, respectively. With increasing K, the increase in the contour coefficient is not obvious.
The analysis of the data in Table 12 shows that the chemical components of CaO, SO2, SrO, PbO, BaO, and CuO significantly differ among the categories classified by cluster analysis, and these six chemical components were selected for clustering again.
The contour coefficient and CH greatly improved, and the clustering effect significantly improved (Table 14).
From Table 15, it can be concluded that high-potassium glass can be divided into two subcategories according to its chemical composition. The contents of SO2, CaO, and CuO in the first subcategory are relatively high, while the contents of SrO, PbO, and BaO in the second subcategory are relatively high. The first subcategory is named high-potassium-CaO-CuO glass, and the second subclass is named high-potassium-BaO-PbO glass. The subclassification of lead-barium glass is carried out according to the same logic.
The calculation results (Tables 16 and 17) of the contour coefficient and CH are good. The lead-barium glass can be clustered into three subclasses by using Na2O, MgO, SO2, P2O5, CuO, BaO and Fe2O3. The contents of MgO and Fe2O3 in the first subclass are high, the content of Na2O in the second subclass is high, and the contents of BaO and CuO in the third subclass are high. These subclasses can be called lead-barium-MgO-Fe2O3, lead-barium-Na2O, and lead-barium-BaO-CuO glass, respectively.
