# Intelligent Classification of Surrounding Rock of Tunnel Based on 10 Machine Learning Algorithms
## 2 Materials and Methods
### Sample Imbalance Treatment  
Referring to machine learning classification, when the difference in the number of samples of all the classes is too large, the training model will pay too much attention to the sample characteristics with a greater proportion, so the classification effect of the samples with a smaller proportion is not ideal. This is called the problem of sample imbalance.  
These data sets cover three classes of surrounding rock (namely, grade-III, -IV, and -V), and each class contains 325, 420, and 167 samples belonging to the imbalance sample set.  
There are three common approaches to deal with unbalanced samples in machine learning:  
1. Over-sampling  
The over-sampling method achieves sample balance by increasing the number of minority samples in the classification. The most direct method is to simply copy the minority samples to form multiple records. The improved over-sampling methods produce new composite samples by adding random noise, interference data to a few classes, or certain rules such as the synthetic minority over-sampling technique (SMOTE) and adaptive synthetic sampling (ADASYN).  
2. Under-sampling  
The under-sampling method achieves sample balance by reducing the number of majority samples in the classification. The most direct method is to randomly remove some majority class samples. The disadvantage of this method is that some important information from the majority class samples may be lost.  
3. Sample weight adjustment  
This method is used to guide models to learn more features of the minority samples in the classification by assigning higher weights to them during the machine learning model training. Generally, the weights of various samples are set to be inversely proportional to the sample size.  
Considering the small size of the sample data set, to sufficiently learn the characteristics of all types of samples during the machine learning model training and to improve the universality of the model, the SMOTE over-samples to replenish samples in grade-III and grade-V of the surrounding rock.  
The scatter diagram of the data set after over-sampling is shown in Figure 7.  
\begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Surrounding** **Rock Grade**} & \multirow{2}{*}{**Index**} & \multicolumn{2}{c}{\(V_{p}\)} & \multicolumn{2}{c}{\(P_{h}\)} & \multicolumn{2}{c}{\(P_{f}\)} & \multicolumn{2}{c}{\(P_{r}\)} \\ \cline{3-10}  & & **Before** & **After** & **Before** & **After** & **Before** & **After** & **Before** & **After** \\ \hline \multirow{4}{*}{III} & mean & 2.35 & 2.04 & 144.32 & 148.85 & 66.95 & 67.69 & 91.91 & 92.18 \\  & std & 0.97 & 0.51 & 12.59 & 5.98 & 8.02 & 5.91 & 10.29 & 9.69 \\  & min & 1.08 & 1.08 & 99.95 & 132.88 & 29.05 & 53.70 & 46.94 & 67.27 \\  & max & 5.56 & 3.39 & 165.41 & 165.41 & 91.45 & 81.44 & 112.97 & 112.97 \\ \hline \multirow{4}{*}{IV} & mean & 3.19 & 3.19 & 135.06 & 135.06 & 63.17 & 62.86 & 79.68 & 79.25 \\  & std & 1.03 & 1.03 & 14.00 & 14.00 & 13.21 & 12.67 & 11.24 & 9.59 \\  & min & 0.66 & 0.66 & 89.79 & 89.79 & 35.97 & 35.97 & 48.84 & 55.38 \\  & max & 5.49 & 5.49 & 161.38 & 161.38 & 107.41 & 97.95 & 113.53 & 102.29 \\ \hline \multirow{4}{*}{V} & mean & 3.47 & 3.54 & 124.96 & 125.87 & 51.75 & 50.72 & 73.18 & 72.62 \\  & std & 0.85 & 0.67 & 11.68 & 9.85 & 11.06 & 9.59 & 7.59 & 5.65 \\ \cline{1-1}  & min & 0.83 & 1.97 & 90.82 & 101.39 & 27.43 & 27.43 & 53.47 & 57.70 \\ \cline{1-1}  & max & 6.35 & 5.05 & 155.88 & 150.65 & 83.75 & 73.60 & 101.17 & 86.72 \\ \hline \hline \end{tabular} Note: The full name of each index and corresponding abbreviated in the table is the mean value (mean), the standard deviations (std), the minimum value (min) and the maximum value (max).  
\end{table}
Table 4: Comparison of the data characteristics before and after cleaning.