## 4 Classification Procedure and Performance Evaluation  
A supervised classification approach was employed via ensemble classification models developed in MATLAB (2021b) (Statistics and Machine Learning toolbox). Each model was trained using the following configuration [35].  
* Support Vector Machine (SVM). As already stated, the SVM classifier has shown a good achievement for the STN location based on MERs or LFP data within various scenarios. In this work, the configuration model was chosen to avoid the risk of overfitting. Accordingly, a Radial Basis Function (RBF) kernel function was used, with the kernel scale set to 1 and constraint penalty set to 1.
* K-Nearest Neighbors (KNNs). In this study, the malhabonic distance metric is used to compute the distance between the test feature and training features belonging to M classes (in this case, M = 2), and each data input will be assigned into a specific class based on the minimum computed distance between the test data and K (in this case, K = 5) nearest training data.
* Random Forest (RF). Random Forest is a set of decision trees constructed to train each subgroup out of the whole data training set at each decision tree and then deliver a single decision that will be aggregated with all decisions to output the predicted class index. In this work, after the optimization process, each classifier has been set to 32 trees with a leaf size equal to 4.
* Decision Tree (DT). In the decision tree classifier, the decision rule is made up of the features outcome learned by three compromised principal nodes: root node, decision node, and leaf node, which handle the extracted features, the branches' decision outcome, and the predicted class (STN IN and STN OUT), respectively.
* Discriminant Analysis (DA). In this algorithm, the input features are separated by a discriminate linear plane engendered from the estimation of the covariance matrix rate [22]. The DA plan aims at minimizing the variance of the features that belong to the same class and maximizing the variance of features between classes (STN-IN and STN-OUT).  
Figure 5: Global procedure for the proposed method for STN localization based on MER signals: from signal acquisition to classification.  
* Neural Network (NN). Among multiple variants, we used three families of neural networks: the Probabilistic Neural Network (PNN), Feed-forward Neural Network (FNN) and Back-propagation Neural Network (BNN). For all of them, they comprise at least three layers: the input layer, the hidden layer, and the output layer. For training, the Stochastic Gradient Descent (SGD) is used. The topology consists of a single hidden layer with 28 units, and the last layer is softmax of two classes (STN-IN and STN-OUT).  
For all models, the 'Leave-One-Out Cross Validaton' (LOOCV) training method was used, i.e., each classifier model was trained on observations from 13 patients, while data from the 14 th patient were used for validation, obtaining a total of 14 different models for each combination of conditions. Different statistical methods were used to estimate the performance: the ROC curve, the confusion matrix, accuracy, recall, precision (Equation (3)), the F-measure (Equation (4)), and the kappa coefficient (Equation (5)), where \(T_{p}\), \(T_{n}\), \(F_{p}\), \(F_{n}\), \(T\), and \(P\) represent the number of true positives found, true negatives found, false positives found, false negatives found, false negatives found, total number of actual true positives, and total number of actual true negatives, respectively.  
\[accuracy=\frac{T_{p}+T_{n}}{T}\ \ \ ;\ \ \ recall=\frac{T_{p}}{P}\ \ \ ;\ \ \ precision=\frac{T_{p}}{T_{n}+F_{p}} \tag{3}\]  
\[F_{measure}=\frac{2*(precision*recall)}{(precision*recall)} \tag{4}\]  
\[Kappa=\frac{2*\left(T_{p}+T_{n}-F_{n}\times F_{p}\right)}{\left(T_{p}+F_{p} \right)\times\left(T_{n}+F_{p}\right)+\left(T_{p}+F_{n}\right)\times\left(T_{ n}+F_{n}\right)} \tag{5}\]