## 4 Experiment and Results
### Evaluation Metrics and Visualization  
#### 4.3.1 Evaluation Metrics  
In this study, we used a number of metrics to evaluate the performance of our model for classifying fire, smoke, and normal images. The first metric is accuracy. Accuracy is the percentage of samples correctly predicted by the model. It is calculated as the ratio of samples correctly predicted by the model to the total number of samples. The accuracy is determined using four elements of the confusion matrix: true positive (TP), true negative (TN), false positive (FP), and false negative (FN). TP means that the actual value is true and is correctly predicted to be true by the model. TN means that the true value is false and is correctly predicted by the model as false. FP means that the actual value is false, but the model incorrectly predicts it to be true. FN means that the true value is false, but the model incorrectly predicts it as true. The formula for accuracy using the four factors is as follows:  
\[\text{Accuracy}=\frac{TP+TN}{TP+FN+FP+TN} \tag{1}\]  
The NMI is a metric that evaluates the performance of clustering. It is calculated by normalizing the entropy of each clustering result and takes a value between 0 and 1; the closer it is to 1, the more similar are the two clustering results. Mutual information (MI) measures the degree of information sharing between two clustering results, while entropy represents the uncertainty of each clustering. The formula for NMI is as follows:  
\[\text{NMI}(U,V)=\frac{2\times I(U,V)}{H(U)+H(V)} \tag{2}\]  
The silhouette score is a metric that evaluates the clustering performance and measures how well the data points are clustered. A score close to 1 means that the data points are well clustered within their respective clusters and are clearly separated from other clusters. Scores close to zero are obtained when the distances between the inner and outer clusters are similar. Values close to 1 indicate that the data points belong to the wrong cluster. Thus, this metric has the advantage of considering simultaneously the internal consistency and external separation of clusters. The silhouette score for the entire dataset is calculated as the average of the silhouette scores for each data point:  
\[S=\frac{1}{N}\sum_{i=1}^{N}s(i) \tag{6}\]  
The silhouette score \(s(i)\) for each data point \(i\) is given by the following formula:  
\[s(i)=\frac{b(i)-a(i)}{\max(a(i),b(i))} \tag{7}\]  
Here, \(a(i)\) denotes the average distance between data point \(i\) and all other data points in the same cluster and is referred to as the intracluster distance or internal distance. The cluster that data point \(i\) belongs to is called \(C_{i}\), \(|C_{i}|\) is the number of data points in cluster \(C_{i}\), and \(distance(i,j)\) is the distance between data points \(i\) and \(j\). The metric \(a(i)\) indicates how closely a data point \(i\) is connected within the cluster it belongs to, with smaller values indicating a higher density within the cluster. Its formula is as follows:  
\[a(i)=\frac{1}{|C_{i}|-1}\sum_{j\in C_{i}\
eq i}\text{distance}(i,j) \tag{8}\]  
The metric \(b(i)\) denotes the average distance to the nearest cluster among the other clusters to which data point \(i\) does not belong; this metric is called the nearest cluster distance or outer distance. Let \(C_{k}\) denote one of the other clusters except \(C_{i}\). Let \(|C_{k}|\) be the number of data points that belong to cluster \(C_{k}\), and let \(\min\limits_{C_{k}\
eq C(i)}\) be the operation to find the minimum value among the remaining clusters except cluster \(C(i)\).This metric indicates how far a data point \(i\) is from the other clusters, with larger values indicating better separation from the other clusters. If \(b(i)\) is greater than \(a(i)\), the data points are properly clustered, and if the converse holds, the clustering may be improper. The formula is as follows:  
\[b(i)=\min\limits_{C_{k}\
eq C_{i}}\frac{1}{|C_{k}|}\sum_{j\in C_{k}}\text{ distance}(i,j) \tag{9}\]