## 3 Methodology
### Explainable AI for Malware Classification
#### 3.4.2 Interpretability Metrics Calculation  
To quantitatively assess the effectiveness of the explainability techniques applied to YOLO11-based malware classification, several interpretability metrics are computed. These metrics evaluate how well the explainability methods highlight critical malware patterns in the RGB image representations. * Faithfulness: Measures how well the heatmap reflects the model's decision-making process. It is computed by correlating the intensity of heatmap activations with the predicted confidence score: \[F=\frac{1}{N}\sum_{i=1}^{N}H(i)P(i)\] (1) where \(H(i)\) is the heatmap activation at pixel \(i\), and \(P(i)\) is the prediction confidence at the corresponding location. A higher \(F\) value indicates a stronger correlation between the heatmap and the model's prediction. * Flipping: Assesses the stability of the explanation by removing highly activated regions from the image and analyzing how much the model's prediction changes. It is defined as \[\Delta P=\left|P_{original}-P_{perturbed}\right|\] (2) where \(P_{original}\) is the original classification confidence and \(P_{perturbed}\) is the confidence after masking out the most activated regions. A lower \(\Delta P\) means the explanation is more stable. * Localization Accuracy: Evaluates whether the heatmap correctly highlights the region containing malware-relevant features. This is measured using the Intersection over Union _IoU_: \[IoU=\frac{|H\cap G|}{|H\cup G|}\] (3) where \(H\) is the binarized heatmap, and \(G\) is the ground-truth region. Since pixel-level malware annotations are unavailable in static RGB-encoded APK representations, we synthesized \(G\) heuristically. Specifically, we assumed that the most informative patterns originate from the DEX component (mapped to the red channel), and defined \(G\) as the top 20% most activated pixels in that region. This provides a reproducible, albeit approximate, proxy for evaluating spatial alignment between heatmap activations and malware-relevant regions. A higher _IoU_ score indicates that the explanation method successfully localizes critical areas in the input image. * Robustness: Quantifies how stable the heatmap remains under small perturbations in the input image. It is computed using the Structural Similarity Index Measure _SSIM_: \[SSIM(H,H^{\prime})=\frac{(2\mu_{H}\mu_{H^{\prime}}+\mathbb{C}_{1})(2\sigma_{ HH^{\prime}}+\mathbb{C}_{2})}{(\mu_{H}^{2}+\mu_{H^{\prime}}^{2}+\mathbb{C}_{1})( \sigma_{H}^{2}+\sigma_{H^{\prime}}^{2}+\mathbb{C}_{2})}\] (4) where \(H\) is the original heatmap, \(H^{\prime}\) is the perturbed heatmap, \(\mu\) and \(\sigma\) are their means and standard deviations, and \(\mathbb{C}_{1},\mathbb{C}_{2}\) are small constants to prevent division by zero. A higher _SSIM_ indicates better robustness. * Sparsity: Measures how compact the heatmap explanation is, favoring methods that highlight only the most relevant regions. It is calculated as \[S=\frac{|H>0|}{|H|}\] (5) where \(|H>0|\) is the number of activated pixels, and \(|H|\) is the total number of pixels. A lower sparsity value indicates a more concentrated and meaningful explanation. Runtime Efficiency: Measures the computational cost of generating heatmaps using different explainability techniques. It is computed as \[R=t_{end}-t_{start}\] (6) where \(t_{start}\) and \(t_{end}\) are the timestamps recorded before and after generating the heatmap. A lower \(R\) value indicates faster execution. While insertion and deletion metrics are commonly used in interpretability studies, we opted for a broader set of metrics--faithfulness, flipping, IoU, SSIM, sparsity, and runtime--to better capture multiple aspects of explanation quality in a security-oriented context. Insertion/deletion methods simulate gradual occlusion or information gain but are computationally expensive and less interpretable in RGB malware images, where pixel-level semantics are abstract.