# WaveConv-sLSTM-KET: A Novel Framework for the Multi-Task Analysis of Oil Spill Fluorescence Spectra
## 2 Materials and Methods
### Model Evaluation Methods  
#### 2.4.1 Evaluation Metrics  
This study employs various metrics to comprehensively evaluate the classification and regression performance of the model. For the classification task, a confusion matrix, accuracy, macro-precision, macro-recall, and the macro-F1 score were used as evaluation metrics. The confusion matrix visually presents prediction results, while accuracy measures the overall correctness of the model's predictions. Meanwhile, precision evaluates the proportion of correctly predicted positive samples among all predicted positives, and recall measures the proportion of actual positives correctly identified. The F1 score, the harmonic mean of precision and recall, balances these two metrics.  
In our multi-class setting, we adopt macro averaging for precision, recall, and the F1 score: we first compute these metrics for each class independently, then take the unweighted mean across all classes, giving each class equal importance. The formulas for these metrics  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Hyperparameter** & **Range/Values** & **Optimal Solution** \\ \hline Learning rate & [\(1\times 10^{-5}\), \(1\times 10^{-3}\)] & 6.922 \(\times\) 10\({}^{-5}\) \\ Batch size & [32; 64; 128; 256; 512] & 32 \\ Kernel sizes & [3; 19] & [19; 5; 17] \\ Strides & [1; 5] & [3; 5; 5] \\ Number of layers (LSTMs) & [2; 5] & 3 \\ Transformer dropout rate & [0.1, 0.5] & 0.5 \\ Transformer blocks & [2; 5] & 4 \\ Attention heads & [2; 4; 8; 16] & 4 \\ Embedding dimension & [64; 128; 256; 512] & 64 \\ Dense dimension & [64; 128; 256; 512] & 256 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Hyperparameter optimization results.  
(in their classic binary form) are provided in Equations (10)-(13), where \(TP\), \(TN\), \(FP\), and \(FN\) represent true positives, true negatives, false positives, and false negatives, respectively:  
\[\text{Accuracy}=\frac{TP+TN}{TP+TN+FP+FN} \tag{10}\]  
\[\text{Precision}=\frac{TP}{TP+FP} \tag{11}\]  
\[\text{Recall}=\frac{TP}{TP+FN} \tag{12}\]  
\[\text{F1}-\text{Score}=\frac{2\cdot\text{Precision}\cdot\text{Recall}}{ \text{Precision}+\text{Recall}} \tag{13}\]  
For the regression task, the key evaluation metrics include the coefficient of determination (\(R^{2}\)), mean absolute error (MAE), root-mean-square error (RMSE), and Residual Predictive Deviation (RPD). These metrics are calculated using Equations (14)-(17):  
\[R^{2}=1-\frac{\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}}{(y_{i}-\overline{y})^{2}} \tag{14}\]  
\[\text{MAE}=\frac{1}{n}\sum_{i=1}^{n}|y_{i}-\hat{y}_{i}| \tag{15}\]  
\[\text{RMSE}=\sqrt{\frac{1}{n}\sum\limits_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}} \tag{16}\]  
\[\text{RPD}=\frac{\sigma_{y}}{RMSE} \tag{17}\]  
Here, \(y_{i}\) is the actual value, \(\hat{y}_{i}\) is the predicted value, \(\overline{y}\) is the mean of the actual values, and \(\sigma_{y}\) is the standard deviation of the actual values. \(R^{2}\) measures the proportion of variance in the target variable explained by the model inputs; values closer to 1 indicate better predictive performance. MAE quantifies the average magnitude of prediction errors, offering an intuitive measure of accuracy. RMSE calculates the square root of the average squared differences between predicted and actual values, highlighting the model's ability to minimize large prediction errors. RPD evaluates the ratio of the standard deviation of actual values to the model's RMSE, reflecting the model's predictive reliability. A higher RPD indicates better generalization capabilities and performance on diverse data distributions.