# EEG Pattern Classification of Picking and Coordination Using Anonymous Random Walks
## 3 Data Processing and Analysis
### Classification of Coherence Patterns Based on Bag of Node Degrees  
To train a classifier and predict the label of the different graphs (resting state, picking or coordination), we first have to perform a process of graph embedding [26]. In the embedding process, we transformed the adjacency matrix of the graph into a lower-dimensional space in which classification was performed by using machine learning.  
In order to represent the graph by a low-dimensional vector, we use the bag of node degrees algorithm (e.g., [27; 28]). The degree of a node is the number of connections, i.e., the rank, that it has with other nodes in the network. Therefore, for each graph, we obtain a 16-length representation vector (\(\mathbb{R}^{16}\)) following the embedding process. For example, the embedding vector for the graph presented in Figure 3 will be as follows: \(E=[0,5,4,2,0,4,0,1,0,0,0,0,0,0,0,0]\). Out of the embedding vector E, it can be seen that the graph has five nodes with node degree 1, four nodes with node degree 2, etc.  
Based on the characteristics of the dataset, we chose to use random forest as our classifier. For parameter optimization, we applied grid search, which resulted in using 100 trees with a tree depth (max depth) limited to 15 branches. In order to avoid over-fitting, we worked with a four-fold cross-validation method so that the training set included  
Figure 3: Coherence graph representation—coordination epoch (an exemplar players). Graph layout is in accordance with electrode placement on the scalp.  
630 samples (three folds) and the test set included 210 samples (one-fold). We repeated this process four times to obtain a reliable prediction of all the samples in the test group. While we could have used the leave-one-out cross-validation method, which is suitable for relatively small sample sizes, in the case of our dataset (840 samples), this would have resulted in many similar models since each model was different by only one data point. Furthermore, using a train-test split would cause us to lose x% of the data allocated for training. Therefore, using the k-fold cross-validation was more beneficial considering the size of our dataset and the efficient usability of it.  
The classification results are presented in Table 1.  
Table 1 presents the results of the classification. Since the dataset on which the training was performed was unbalanced (600 [testing state], 120 [picking], 120 [coordination]), we had to report the precision (\(\frac{TP}{TP+FP}\)) and recall (\(\frac{TP}{TP+FN}\)) indices of each class separately, rather than the overall accuracy percentage. For the resting-state class, where there is no task-related cognitive activity, it can be seen that the classifier is able to classify the EEG segments with a high level of accuracy, given by the positive predicted value (PPV) and true positive rate (TPR), which were each over 98%. In contrast, for the task-related classes, picking and coordination, the classifier was not able to differentiate between the two different classes. We can see in Table 1 that, in both task-related classes, PPV was around \(\sim\)60% accuracy.  
Based on the previous classification results, we decided to convert the multi-class classification problem into a binary one by combining the two classes (picking and coordination). Thus, the binary classifier was able to differentiate between resting-state and task-related cognitive activity (picking and coordination). The results of the binary classifier are shown in Table 2. The PPV for the task-related class achieved by the binary classifier was \(\sim\)97%, and the TPR was \(\sim\)99%.