## 4 Results
### Comparison of Machine Learning Algorithms' Performance
#### 4.2.1 Performance Comparison of All Algorithms on Sensor Data  
The performance metrics of sensor data training algorithms are compared across different dimensions (F1 score, precision, recall, training time, test time, and memory usage). In this visualization, the achievements of each algorithm in these metrics are presented in detail. Metrics such as the F1 score, precision, and recall provide crucial insights into the classification performance, revealing the accuracy and errors of each algorithm. The training and test times reflect the processor and time efficiency of each algorithm, while memory usage indicates the resource consumption. This visual representation highlights the performance differences across these metrics, allowing us to assess which algorithm delivers more efficient and accurate results under specific conditions. This comprehensive comparison aids in a deeper understanding of the algorithms' overall performance in terms of both accuracy and computational resources. In Table 4, the performance metrics of sound training algorithms, including the F1 score, precision, recall, training time, testing time, and memory usage, are compared. K-Nearest Neighbors (KNNs) leads in classification performance with an F1 score of 0.961, a precision of 0.962, and a recall of 0.961, offering a significant advantage with a training time of 109.187 s compared to other high-F1-scoring models, such as Random Forest (4125.98 s). During the testing phase, KNNs demonstrates resource efficiency with a speed of 0.149 s and memory consumption of 2.621 MB, making it suitable for practical applications. Although Random Forest shows a similar F1 score (0.956), its 4125.98 s of training time and 45.102 MB memory usage make it less scalable. Decision Trees stand out in speed-focused scenarios with an F1 score of 0.957 and a testing time of 0.005 s. Models like Support Vector Machine (SVM) (F1 = 0.662), XGBoost (F1 = 0.682), Naive Bayes (F1 = 0.618), and Logistic Regression (F1 = 0.658) lag behind in terms of performance metrics. Table 5 compares light training algorithms (KNNs, Random Forest, Decision Trees, XGBoost, SVM, Naive Bayes, Logistic Regression). KNNs, Random Forest, and Decision Trees have similar F1 scores (\(\sim\)0.74). KNNs has a high training time/memory. Random Forest is more balanced. Decision Trees are fast and efficient. XGBoost has the fastest training time but a lower F1 score. SVM and Naive Bayes perform poorly. Logistic Regression uses minimal memory but has a low F1 score. Table 6 compares temperature training algorithms (KNNs, Random Forest, Decision Trees, XGBoost, SVM, Logistic Regression, Naive Bayes). KNNs and Random Forest have the highest F1 score, precision, and recall (0.981) but a high training time/memory. Decision \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Temperature** & **F1 Score \(\uparrow\)** & **Precision \(\uparrow\)** & **Recall \(\uparrow\)** & \begin{tabular}{c} **Training** \\ **Time (s) \(\downarrow\)** \\ \end{tabular} & \
\begin{tabular}{c} **Test Time** \\ **(s) \(\downarrow\)** \\ \end{tabular} &
\begin{tabular}{c} **Memory** \\ **Usage (MB) \(\downarrow\)** \\ \end{tabular} \\ \hline KNNs & 0.981 & 0.982 & 0.981 & 3696.6 & 0.067 & 31.711 \\ \hline SVM & 0.594 & 0.595 & 0.605 & 249.240 & 4.545 & 1.820 \\ \hline Random Forest & 0.981 & 0.981 & 0.980 & 13,725.8 & 0.113 & 46.973 \\ \hline Decision Trees & 0.979 & 0.979 & 0.979 & 507.194 & 0.016 & 12.316 \\ \hline XGBoost & 0.607 & 0.608 & 0.612 & 30.615 & 0.049 & 67.668 \\ \hline Naive Bayes & 0.415 & 0.459 & 0.442 & 19.217 & 0.008 & 2.609 \\ \hline Logistic Regression & 0.552 & 0.564 & 0.563 & 125.52 & 0.150 & 3.871 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Comparison of performance metrics of temperature training algorithms.