# Intelligent Control of Robotic Arm Using Brain Computer Interface and Artificial Intelligence
## 3 Results and Discussion
### Confusion Matrix and Classification Reports of Best-Fit Classifiers  
Confusion matrices are to illustrate the comparison between truth values and predicted values acquired by predictions from classification algorithms. The classification report is a useful method that is used to take out all of the necessary information from the output of classification algorithms. A confusion matrix is shown in Figures 7-9 with their report in Tables 5-7 for a Random Forest, Decision Tree, and a Gradient Boosting classifier, respectively. Figure 8: Confusion matrix of Random Forest classifier. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Class** & **Precision** & **Recall** \\ \hline
0 & 0.72 & 0.79 \\
1 & 0.69 & 0.75 \\
2 & 0.80 & 0.68 \\
**Accuracy** & 0.74 & \\
**Macro avg** & 0.74 & 0.74 \\ Weighted Avg** & 0.74 & 0.74 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Classification Gradient Boost Classifier. Figure 7: Best fit algorithms to deploy with recommendations levels. Figure 7 represents that the Random Forest classifier has predicted the classes 0, 1, and 2 accurately at 1.5 \(\times\) 10\({}^{2}\), 1.4 \(\times\) 10\({}^{2}\) and 1.5 \(\times\) 10\({}^{2}\) times, respectively. Moreover, Table 5 illustrates the precision and recall of the classifier, i.e., (0.74, 0.80), (0.72, 0.76), and (0.83, 0.76) for classes 0, 1, and 2, respectively, with an overall accuracy of Random Forest is 76%. Figure 8 represents that the Decision Tree classifier has predicted the classes 0, 1, and 2 accurately at 1.2 \(\times\) 10\({}^{2}\), 1.3 \(\times\) 10\({}^{2}\), and 1.2 \(\times\) 10\({}^{2}\) times, respectively. Table 6 illustrates the precision and recall of the classifier, i.e., (0.64, 0.64), (0.63, 0.69), and (0.66, 0.61) for class 0, 1, and 2, respectively. Whereas the overall accuracy of the Decision Tree is 64%. Figure 9 represents that the Gradient Boosting classifier has predicted the classes 0, 1, and 1, and 2 accurately at 1.4 \(\times\) 10\({}^{2}\) for all times, respectively. Table 7 illustrates the precision and recall of the classifier, i.e., (0.72, 0.79), (0.69, 0.75), and (0.80, 0.68) for class 0, 1, and 2, respectively. The overall accuracy of Gradient Boosting is 74%. This result covers the major aspects of the BCI and its analysis. Figure 10 represents the correlation of electrode \"F4\" placed on the right side of the brain with six other electrodes placed on different sides of the brain. The decreasing order of maximum density of the left movement represented as 0 class is achieved by the \"F4\" electrode correlated to FC5, F7, FC6, F3, and F8, respectively. Electrode \"F4\" correlated to \"F4\" forms a linear scatter plot, because of the overlapping data point. Hence it is proved that the precise data points for the left movement are gained by the placement of the F4 electrode with the highest correlated electrodes, as discussed above. Figure 10 displays that the \"F4\" electrode is mapped with other electrodes to represent the classifications of the features in the specified bandwidth; therefore, this study shows that the movement of the left arm is generated in this region of bandwidth, which can be further observed in Figure 10. This result shows that different human brains use different neuronic algorithms. Different people have different activation bandwidths; therefore, the dominant frequencies for each individual may differ. However, the position of the electrodes from which the data is acquired is always the same. To demonstrate the movement of the right hand using an electrode known as \"F7\" placed on the left side of the brain that is presented in Figure 5. The \"F7\" electrode, which is correlated to FC5, F4, FC6, F3, and F8, achieves the decreasing order of maximal density of the right movement depicted as class 1, respectively. On the other hand, because of the overlapping data points, electrode \"F7\" correlates to electrode \"F7\", forming a linear scatter plot. Figure 9: Confusion matrix of Gradient Boosting classifier.