## 2 Background of the Proposed Method
### Random Forests  
Random forests is a classification method proposed by [PERSON] and is a type of ensemble learning method that constructs a multitude of decision trees and combines the predictions from them [20]. The random forests method is relatively accurate and fast for high-dimensional data. Furthermore, it prevents overfitting problems by voting on multiple trees and shows good predictive performance for noisy data. Because the descriptor vector obtained from SURF is composed of high-dimensional data, the algorithm is efficient for feature classification. Therefore, we use random forests to learn the fault pattern and calculate the probability of a fault feature being classified.  
This algorithm begins by drawing many bootstrap samples from the training set. Classification trees are then built for each bootstrap sample using a decision tree learning method. After the forests are formed, the new data are put into each classification tree for classification. Each tree votes on the result of the tree's decision regarding the class of data. The forests then predict the class by taking the majority vote from the classification trees [21]. Because the random forests method generates many classification trees using bootstrapping rather than pruning, we can obtain low variation trees. It can therefore avoid an overfitting and thereby improve the performance. However, the performance can decrease when the data are extremely imbalanced. The class of PCB features is mostly normal, and the number of fault features is low. Thus, the performance inevitably decreases. To complement this disadvantage, we suggest utilizing the probability of being classified as a fault rather than predicting the class using the random forests and by considering the density of the features. By considering the density, the probability of being a defective feature increases, whereas the probability of being a normal feature decreases. Therefore, the proposed method detects faults more effectively than a method using only random forests. We next describe the process for calculating the probability of the  
Figure 3: Features and descriptors obtained in a PCB image using speeded-up robust features (SURF).  
Figure 2: Diagram for generating the descriptors.  
test data being classified as a fault when using random forests. Then, in Section 4, we describe how to use the calculated probability to detect a fault.  
The probability \(p(y=k)\) of being classified as \(k\) is \(p(y=k)=\pi_{k}\), where \(0\leq\pi_{k}\leq 1\). Here, \(n\) is the number of classes. The density function \(f_{k}(x)\) for the features in class \(k\) is \(f_{k}(x)=f(x|y=k)\). Thus, the density function \(f(x)\) for all features is calculated through Equation (5) [22].  
\[f(x)=\sum_{k=1}^{n}\pi_{k}f_{k}(x). \tag{5}\]  
Finally, we can estimate the probability that the class of new data \(x_{new}\) will be predicted as \(k\) using a Bayesian probability. The equation of this probability is denoted through Equation (6).  
\[p(y=k|x=x_{new})=\frac{\pi_{k}f_{k}(x_{new})}{f(x_{new})} \tag{6}\]  
Thus, the probability \(p_{i}\) that a new feature \(x_{i}\) will be classified as a fault or as normal is calculated using Equation (7).  
\[p_{i}=\ \left\{\begin{array}{cc}\frac{\pi_{k}f(x_{i})}{f(x_{i})},&p(y= Fault|x=x_{i})\\ 1-\frac{\pi_{k}f(x_{i})}{f(x_{i})},&p(y=Normal|x=x_{i})\end{array}\right. \tag{7}\]