# Personal Identification Using Embedded Raspberry Pi-Based Face Recognition Systems
## 2 Materials and Methods
### Face Classification  
#### 2.6.1 AdaBoost Machine Learning  
AdaBoost combines weak classifier algorithms to create a strong classifier. A single algorithm may misclassify objects. However, if multiple classifiers select the training set at each iteration and assign appropriate weight in the final decision, we can obtain accurate results from the overall classifier. It will retrain the algorithm iteratively, selecting a training set based on the accuracy of previous training [66]. Each weak classifier is trained using a random subset of the overall training set. After training, each classifier is assigned a weight based on accuracy. More accurate classifiers are assigned higher weights to have a more significant impact on the final result. The classification is based on the following formula:  
\[H(x)=\text{sgn}\Bigg{(}\sum_{t=1}^{T}\alpha_{t}h_{t}(x)\Bigg{)} \tag{1}\]  
where  
\(h_{t}(x)\)--the output of the \(t\)-th weak classifier for or the same example, which also takes values \(+1\) or \(-1\) depending on the predicted class. \(\alpha_{t}\)--the weight applied to the classifier determined by AdaBoost. \(T\)--the total number of iterations or weak classifiers used to construct the final strong classifier. \(H(x)\) represents the aggregated decision of all \(T\) weak classifiers. The sign function ensures that \(H(x)\) outputs \(+1\) or \(-1\), corresponding to the predicted class. This binary classification framework simplifies decision making and aligns with the fundamental principles of AdaBoost. Parameter \(T\) is a hyperparameter of the AdaBoost algorithm and is typically determined based on the specific application or dataset. The value of \(T\) directly influences the balance between underfitting and overfitting. If \(T\) is too small, the algorithm may underfit the data, resulting in lower accuracy. If \(T\) is too large, the algorithm may overfit the training data, potentially reducing generalization to unseen data. During each iteration \(t\) (where \(T=1\), \(2,\ldots,T\)), the AdaBoost algorithm trains a new weak classifier \(h_{t}(x)\), assigns it a weight \(\alpha_{t}\), and updates the training weights. The final classifier \(H(x)\) combines the outputs of all \(T\) weak classifiers, weighted by their respective \(\alpha_{t}\), as shown in Equation (1). Classifiers are trained individually. After training each classifier, the probability of training examples appearing in the training set for the next classifier is updated. The first classifier (\(t=1\)) is trained with equal probability given for all training examples. After training, we calculate the output weight (\(\alpha\)) for this classifier based on the following formula:  
\[\alpha_{t}=\frac{1}{2}\text{ln}\bigg{(}\frac{1-\epsilon_{t}}{\epsilon_{t}} \bigg{)} \tag{2}\]  
where  
\(\epsilon_{t}\)--the weighted error rate of the weak classifier \(h_{t}(x)\). However, this formula exhibits asymptotic behavior for \(\epsilon_{t}=0\) or \(\epsilon_{t}=1\), where \(\alpha_{t}\) approaches \(+\infty\) or \(\pm\infty\), respectively. To address this, a small constant \(\delta\) is introduced to constrain \(\epsilon_{t}\) within a valid range, such as  
\[\epsilon_{t}=max(\delta,min(1-\delta,\epsilon_{t})) \tag{3}\]  
where  
\(\delta\)--small positive value (e.g., \(\delta=10^{-10}\)). This adjustment ensures numerical stability while maintaining the theoretical properties of the AdaBoost algorithm. For \(\epsilon_{t}=0\), \(\epsilon_{t}\) is replaced by \(\delta\), avoiding an infinite value for \(\alpha_{t}\). For \(\epsilon_{t}=1\), \(\epsilon_{t}\) is replaced by \(1-\delta\), ensuring that \(\alpha_{t}\) remains finite and does not diverge to negative infinity. This approach is standard in most practical implementations of AdaBoost and guarantees that the algorithm operates reliably even in edge cases. The output weight is based on the classifier's error rate, which is the number of misclassifications in the training set divided by its size. The classifier weight increases exponentially (Figure 6) as the error approaches 0.