## 3 Results  
### Offline Classification Results  
The electrode array is inserted from three different angles and takes three different trajectories during the insertion process. In this analysis, generalization of four classification algorithms (SNN, KNN, SVM, RF) are looked into, using the partial insertion data of four electrical features (\(1\,Z1\), \(\theta\), \(R\), and \(X\)) of the most apical electrode pair. Additionally, this analysis is carried out on standardized raw data. After the data are organized for each segmentation scenario, machine learning models are trained and tested using a fivefold cross-validation procedure. For SNN, we used a multilevel perceptron (MLP) with two hidden layers of size 100 and 10, respectively, and finally a classification layer with three neurons. The hidden layers had an associated nonlinearity of rectified linear units (ReLU). A softmax layer was used to convert the output of the MLP into probabilities of the respective classes. The network was trained for 1000 epochs using an Adam optimizer at a learning rate of 0.001. For SVM, radial basis function (RBF) kernel function was used to train the data, dynamic time warping (DTW) was used as a distance metric, and five number of neighbours were used for the \(k\)NN classifier model. We did not use any weight class metric  
Figure 8: Flow graph for online prediction and correction. as our dataset is balanced. For the online prediction of trajectory, data from the most apical electrode pair (EP1) are used to train and test the algorithms first, and then we use the trained model for online prediction with the new collected data during the insertion process. Different length subsequences of EP1 data are used, that is, subsequence data collected during 4 mm, 3 mm, 2 mm, and 1 mm insertion. For these subsequences, a different set of data is assembled for analysis and only the straight path is considered for prediction and further correction. For example, for 4 mm insertion depth, two subsequences of four time samples each are extracted from each insertion example. These two subsequences will make two separate examples in the new dataset. That means now there would be 137 \(\times\) 2 (274) examples in this dataset with respective targets (medial, middle, lateral). In the same way, for 3 mm subsequence, there will be three subsequences of three time samples each and each subsequence will make an example in the new dataset (137 \(\times\) 3 = 411 examples) with respective target label. Moreover, new datasets for 2 mm and 1 mm subsequences have 137 \(\times\) 4 = 548 and 137 \(\times\) 8 = 1096 examples, according to the split of the straight path data. It is important to mention that we are using all four features (1 Z1, \(\theta\), \(R\), and \(X\)) in this analysis. Table 1 shows the machine learning algorithms' performances in terms of their cross-validated accuracies. As can be seen in the table, highest accuracy is achieved when 4 mm subsequences are used, and 2 mm subsequences came in second in terms of accuracy. The 1 mm subsequences achieved the lowest accuracy. This behaviour is attributed to SNN and kNN algorithms, whereas the accuracy decreases as the subsequence length is decreased from 4 mm-1 mm. In terms of the best-performing algorithms, SNN gave the best accuracy among the four algorithms cross-validated, while the SVM algorithm performed the worst. For trajectory prediction, two methods of subsequencing were used and tested. Further analysis is carried out to predict whether the electrode array is in the straight path or the curved path during the insertion. For this, we use the full insertion data and split them into straight path and curved path data, labelling them accordingly. Since now we only have two classes (straight or curved), we term such problem as a binary classification. Different datasets are formed according to the subsequence length, labelled accordingly, and cross-validated on four machine learning models.