## 2 Materials and Methods
### Machine Learning Model for Third Molar Classification  
Once the third molars are measured on the image (retromolar space, third molar diameter and angle), a supervised machine learning model is used to predict their category as defined by their eruption potential: erupted or non-erupted (or retained). The model used by PDApp to predict the third molar category is support vector machine (SVM) with a radial basis function (RBF) kernel, one of the best-performing machine learning models for classification [23] which is accessed through the C++ binding of the LibSVM library [24]. In order to perform this prediction, the SVM is trained in such a way that values for its trainable parameters (coefficients of the support vectors and offset) are calculated in  
Figure 2: Flowchart of main functionality of PDApp. order to adjust the SVM category prediction according to a collection of examples. This collection, named the training set, is characterized by two features, extracted from the panoramic radiological image using PDApp, alongside the correspondent category label (erupted or retained) for each molar, up to a total of 188 molars distributed into 115 erupted (representing 61.2% of the data) and 73 retained (38.8%) molars. The two features are:  
1. Third molar angulation;
2. RRC (Radiological Retention Coefficient). Before SVM training and prediction, both values are standardized to have a mean value of 0 and a standard deviation of 1 over the training set. The objective of SVM training is to predict, using only these features, the right category label for the molars in the training set with high accuracy while being able to generalize and provide an acceptable prediction for new molars not included in the training set. This set includes molar data from persons of the Caucasian race, although PDApp allows the SVM to be retrained at any time in order to include such data as molars of people from other races. Prior to training all available data, it is necessary to select appropriate values for two SVM hyper-parameters, regularization (\(\lambda\)) and RBF kernel spread (\(\sigma\)), in a process known as hyper-parameter tuning. In the case of PDApp, this tuning is performed automatically using the well-known grid search method. First, a collection of values, \(\lambda=\{2^{2i-5}\}_{i=0}^{9}\) and \(\sigma=\{2^{-(i+1)/2}\}_{i=-1}^{0}\), is defined to perform value selection. Then 4-fold cross validation is performed to evaluate SVM training with each combination of values and select the best combination. The available data are divided into 4 parts (folds) of the same size, including molars erupted and retained in their natural populations (61-39%). Four trials are executed: in the first trial, the SVM is trained using a combination of values of \(\lambda\) and \(\sigma\) (e.g., \(\lambda=2^{-5}\), \(\sigma=2^{5}\)) in folds 1-3, and the trained SVM is then used to predict the categories of molars in fold 4 with calculation of the Cohen kappa score [25], denoted as \(K\), which is a measure of the classification performance using this combination. This score (in %) is calculated as:  
\[K=100\frac{p_{a}-p_{e}}{s-p_{e}}p_{a}=\sum_{i=1}^{C}C_{ii}p_{e}=\frac{1}{N^{2} }\sum_{i=1}^{C}\left(\sum_{j=1}^{C}C_{ij}\right)\left(\sum_{j=1}^{C}C_{ji} \right)s=\sum_{i=1}^{C}\sum_{j=1}^{C}C_{ij} \tag{1}\]  
where \(C\) is the number of classes and \(C_{ij}\) is the \(j\)th value in the confusion matrix, i.e., \(C_{ii}\), the number of third molars of the \(i\)th class (\(i=1\) means retained, \(i=2\) means erupted) for which the classifier predicts the \(j\)th class. In trial 2, folds 2, 3, and 4 are used for training and fold 1 is used for testing, similarly with trials 3 and 4. Once all trials are executed, the average kappa over the 4 folds is calculated for the current combination of values {\(\lambda\), \(\sigma\)}. The process is repeated for all combinations of {\(\lambda\), \(\sigma\)}, and the combination with the highest average \(K\) is selected.