# Machine Learning Ship Classifiers for Signals from Passive Sonars
## 5 Results
### K-Nearest Neighbors  
The hyperparameters that best fit the model and corresponding classification results are presented in Table 4.  
The KNN classifier performed well without decimation, where it achieved an almost perfect accuracy (99.6%) across all dataset variations (Lofar, PCA, and NLPCA). However, decimation significantly impacted the model's performance, where the accuracy dropped to 0.58 for all the datasets when decimation was applied. The hyperparameters of the model, such as the number of neighbors and the use of the Manhattan distance with distance-based weights, were consistent across all the datasets, ensuring a fair comparison.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Hyperparameter**} & \multicolumn{2}{c}{**Lofar**} & \multicolumn{2}{c}{**PCA**} & \multicolumn{2}{c}{**NLPCA**} \\  & **w/ Dec** & **w/o Dec.** & **w/ Dec** & **w/o Dec.** & **w/ Dec** & **w/o Dec.** \\ \hline Neighbors & 1 & 1 & 2 & 2 & 2 & 2 \\ \hline Weights & Distance & Distance & Distance & Distance & Distance & Distance \\ \hline Mean Accuracy \(\tilde{Acc}\) & 0.996 & 0.578 & 0.578 & 0.996 & 0.578 & 0.996 \\ \hline Standard Error (SE) & \(2.67\cdot 10^{-3}\) & \(7.91\cdot 10^{-2}\) & \(7.91\cdot 10^{-2}\) & \(2.67\cdot 10^{-3}\) & \(7.91\cdot 10^{-2}\) & \(2.76\cdot 10^{-3}\) \\ \hline \hline \end{tabular}
\end{table}
Table 4: KNN hyperparameters and the model’s performance for the Lofar, PCA, and NLPCA variations of the database.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline \multirow{2}{*}{**Hyperparameter**} & \multicolumn{2}{c}{**Lofar**} & \multicolumn{2}{c}{**PCA**} & \multicolumn{2}{c}{**NLPCA**} \\  & **w/ Dec** & **w/o Dec.** & **w/ Dec** & **w/o Dec.** & **w/ Dec** & **w/o Dec.** \\ \hline a (Regularization Parameter) & 0.001 & 0.001 & 0.002711 & 0.002711 & 0.0656 & 0.0656 \\ \hline Number of Neurons in Hidden Layer & 58 units & 58 units & 95 units & 95 units & 100 units & 100 units \\ \hline Initial Learning Rate & 0.00117 & 0.00117 & 0.00431 & 0.00431 & 0.00369 & 0.00369 \\ \hline Maximum Number of epochs & 100 & 100 & 967 & 967 & 100 & 100 \\ \hline Solver & Adam & Adam & Adam & Adam & Adam & Adam \\ \hline Mean Accuracy \(\tilde{Acc}\) & 0.123 & 0.363 & 0.437 & 0.437 & 0.553 & 0.437 \\ \hline Standard Error (SE) & \(5.96\cdot 10^{-2}\) & \(5.64\cdot 10^{-2}\) & \(4.51\cdot 10^{-2}\) & \(4.51\cdot 10^{-2}\) & \(6.08\cdot 10^{-2}\) & \(4.51\cdot 10^{-2}\) \\ \hline \hline \end{tabular}
\end{table}
Table 3: MLP hyperparameters and model’s performance for the Lofar, PCA, and NLPCA variations of the database.  
The confusion matrix in Figure 8 for the KNN classifier with Lofar without decimation demonstrates excellent overall performance, with a total of 1203 correct predictions out of 1211 samples. Most classes were classified with perfect accuracy, as evidenced by the strong diagonal dominance in the matrix. The only notable misclassifications occurred in class 0, where eight samples were incorrectly predicted as belonging to class 5. This suggests a possible similarity or overlap in the feature space between these two classes.