## 4 Discussion  
### Comparison among Different Classifiers  
While DT and KNN are two of the simplest traditional ML algorithms, SVM and XGB are more complicated and considered more powerful in many ML applications. Among the selected classifiers, CNN is the most complex one, involving many hyperparameters controlling the size, structure, and learning process of the model. CNN has shown its capability to learn complex data such as images, audio, text, genes, etc. [37].  
As model hyperparameters can dramatically influence the performance of the conventional ML and CNN algorithms, hyperparameter tuning procedures on the common validation set were carried out to produce optimal models. Table 9 lists the set of hyperparameters used in the grid searching for the optimal ML models. These hyperparameters are the most significant influencers of the model-building process. Meanwhile, the process of optimization for CNN models involves adjusting two key components: the hyperparameters and the layers. While tuning the latter proves to be more challenging compared to the former, the former shares similarities with conventional ML algorithms. In the context of CNN models, the hyperparameters subject to tuning encompass the number of neurons, activation function, optimizer, learning rate, batch size, and epochs. The subsequent step involves fine-tuning the number of layers, a characteristic absent in other conventional ML algorithms. The number of layers employed on a CNN can significantly impact its accuracy. Insufficient layering may yield an underfitting outcome, whereas an excessive number of layers can lead to overfitting.  
Table 10 summarizes the best performances of the investigated classifiers in the two experiments: position-independent and position-dependent. It can be observed from Table 10 that the position-dependent models always attained higher classification accuracy (from 1.3% with XGB to 11.6% with CNN) than the position-independent ones (at least nearly equal with KNN), with the best position for NIR measurement being the \"Skin, stomach\" part of the fish regardless of the classifiers (only one exception in the case of DT). This suggests that we should collect NIR spectra outside the skin and on the stomach for fish safety classification. Among the position-dependent models, the proposed CNN model described in Section 2.8 combined with the feature vector consisting of the pre-processed spectrum coupled with its first derivative (i.e., \"prep + der1\") proved to be superior to the others. This ML pipeline achieved the highest classification accuracy of 83.9% and the same level of specificity and recall scores.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Position** & **Recall (\%)** & **Accuracy (\%)** \\ \hline Yes & 83.9 & 83.9 \\ No & 72.9 & 78.0 \\ \hline \hline \end{tabular}
\end{table}
Table 8: Efficiency comparison of the proposed model while using SMOTE and not using SMOTE.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Model** & **Set of Hyperparameters** \\ \hline DT & maximum depth of the tree, minimum number of samples at a leaf node \\ KNN & number of neighbors \\ SVM & regularization parameter, kernel type \\ XGB & number of decision trees, maximum depth of a tree, learning rate \\ \hline \hline \end{tabular}
\end{table}
Table 9: Set of hyperparameters used in the grid searching for the optimal traditional ML models.