\documentclass[11pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{
    a4paper,
    left=25mm,
    right=25mm,
    top=25mm,
    bottom=25mm
}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{caption}

% Packages for drawing native figures, graphs, and plots
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows.meta, positioning, fit, backgrounds}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}

\begin{center}
    \Large\textbf{Tables, Figures, and Mathematical Appendix} \\
    \vspace{0.5cm}
    \large\textit{Hybrid Deep Learning Framework for Predictive Maintenance in Industrial IoT Systems: A Multi-Sensor Fusion Approach with Explainability}
\end{center}

\vspace{1cm}

% ==========================================
% TABLES SECTION
% ==========================================
\section*{Tables}

\begin{table}[htbp]
\centering
\caption{Comparison of Related Work Capabilities}
\begin{tabular}{lccccc}
\toprule
Reference & Multi-Sensor & Explainability & RUL+FD+FC & Cross-Domain & Real Data \\
\midrule
Li et al. [20] & $\times$ & $\times$ & Partial & $\times$ & $\times$ \\
Zhang et al. [21] & $\times$ & $\times$ & $\times$ & $\times$ & $\times$ \\
Chen et al. [23] & Partial & Partial & $\times$ & $\times$ & $\times$ \\
Wang et al. [28] & Partial & $\times$ & $\times$ & $\times$ & $\times$ \\
Zhao et al. [29] & $\checkmark$ & $\times$ & Partial & $\times$ & $\times$ \\
\textbf{HEDLF (Proposed)} & \textbf{$\checkmark$} & \textbf{$\checkmark$} & \textbf{$\checkmark$} & \textbf{$\checkmark$} & \textbf{$\checkmark$} \\
\bottomrule
\multicolumn{6}{l}{\footnotesize FD: Fault Detection; FC: Fault Classification; RUL: Remaining Useful Life}
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Dataset Summary Statistics}
\begin{tabular}{lccccc}
\toprule
Dataset & Machines & Sensors & Duration & Failure Events & Failure Modes \\
\midrule
C-MAPSS FD001 & 100 units & 21 & Variable & 100 & 1 \\
C-MAPSS FD004 & 249 units & 21 & Variable & 249 & 2 \\
PRONOSTIA & 17 bearings & 2 & 1-7 hours & 17 & 1 \\
IMD-2024 & 47 motors & 12 & 18 months & 23 & 6 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{HEDLF Hyperparameter Configuration}
\begin{tabular}{llc}
\toprule
Parameter & Value & Selection Method \\
\midrule
Window size $T$ & 30 & Grid search \\
CNN filters & [64, 128] & Bayesian opt. \\
Kernel size & 3 & Grid search \\
BiLSTM units & [256, 128] & Bayesian opt. \\
Attention heads $M$ & 8 & Bayesian opt. \\
Key dimension $d_k$ & 64 & Bayesian opt. \\
Dropout rate & 0.3 & Bayesian opt. \\
Learning rate & $1\times 10^{-3}$ & Bayesian opt. \\
Batch size & 64 & Grid search \\
Max epochs & 200 & Fixed \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Fault Detection Performance on IMD-2024}
\begin{tabular}{lccccc}
\toprule
Method & Accuracy (\%) & Precision (\%) & Recall (\%) & F1-Score (\%) & AUC-ROC \\
\midrule
Random Forest & $91.24 \pm 0.83$ & $89.67 \pm 1.12$ & $88.43 \pm 1.34$ & $89.05 \pm 1.18$ & 0.941 \\
SVM-RBF & $89.73 \pm 0.97$ & $87.92 \pm 1.28$ & $86.71 \pm 1.45$ & $87.31 \pm 1.36$ & 0.928 \\
CNN-only & $93.45 \pm 0.71$ & $92.18 \pm 0.89$ & $91.67 \pm 0.94$ & $91.92 \pm 0.91$ & 0.958 \\
LSTM-only & $92.87 \pm 0.76$ & $91.43 \pm 0.98$ & $90.89 \pm 1.02$ & $91.16 \pm 0.99$ & 0.953 \\
CNN-LSTM & $95.12 \pm 0.58$ & $94.23 \pm 0.74$ & $93.87 \pm 0.79$ & $94.05 \pm 0.76$ & 0.971 \\
Transformer & $95.67 \pm 0.52$ & $94.89 \pm 0.67$ & $94.12 \pm 0.73$ & $94.50 \pm 0.70$ & 0.974 \\
LSTM-Attention & $96.34 \pm 0.47$ & $95.67 \pm 0.61$ & $95.12 \pm 0.66$ & $95.39 \pm 0.63$ & 0.979 \\
\textbf{HEDLF (Proposed)} & \textbf{$98.73 \pm 0.31$} & \textbf{$98.12 \pm 0.42$} & \textbf{$98.45 \pm 0.39$} & \textbf{$98.28 \pm 0.40$} & \textbf{0.994} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Fault Classification Performance (Macro F1-Score)}
\resizebox{\textwidth}{!}{
\begin{tabular}{lcccccccc}
\toprule
Method & Macro F1 (\%) & Kappa & Bearing IR & Bearing OR & Bearing RE & Winding & Eccentricity & Cooling \\
\midrule
Random Forest & $87.34 \pm 1.21$ & 0.841 & 91.2 & 89.4 & 85.7 & 84.3 & 83.1 & 90.1 \\
SVM-RBF & $85.67 \pm 1.38$ & 0.821 & 89.7 & 87.2 & 83.4 & 82.1 & 80.9 & 88.4 \\
CNN-LSTM & $92.45 \pm 0.87$ & 0.898 & 95.1 & 93.7 & 90.2 & 89.8 & 88.9 & 97.1 \\
Transformer & $93.12 \pm 0.81$ & 0.907 & 95.8 & 94.2 & 91.1 & 90.4 & 89.7 & 97.4 \\
\textbf{HEDLF} & \textbf{$97.89 \pm 0.43$} & \textbf{0.971} & \textbf{98.7} & \textbf{98.2} & \textbf{96.9} & \textbf{97.4} & \textbf{96.8} & \textbf{99.1} \\
\bottomrule
\end{tabular}
}
\end{table}

\begin{table}[htbp]
\centering
\caption{RUL Prediction Performance on C-MAPSS}
\begin{tabular}{lcccc}
\toprule
Method & FD001 RMSE & FD001 Score & FD004 RMSE & FD004 Score \\
\midrule
Random Forest & 28.76 & 1,862 & 37.42 & 5,942 \\
SVM-RBF & 32.14 & 2,341 & 41.87 & 7,218 \\
CNN-only [20] & 16.14 & 338 & 28.92 & 3,742 \\
LSTM-only & 15.87 & 312 & 26.74 & 3,421 \\
CNN-LSTM & 14.23 & 287 & 23.45 & 2,876 \\
Transformer & 13.67 & 261 & 22.18 & 2,643 \\
LSTM-Attention & 13.12 & 248 & 21.34 & 2,512 \\
\textbf{HEDLF (Proposed)} & \textbf{$11.24 \pm 0.43$} & \textbf{$189 \pm 12$} & \textbf{$18.67 \pm 0.61$} & \textbf{$2,134 \pm 87$} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Cross-Domain Transfer Learning Performance}
\begin{tabular}{lccc}
\toprule
Method & Target FD Acc. (\%) & Target FC F1 (\%) & Perf. Drop (\%) \\
\midrule
No Transfer (train from scratch) & 98.73 & 97.89 & - \\
Direct Transfer (no adaptation) & 71.34 & 62.17 & 27.6 \\
Fine-tune All Layers & 94.21 & 91.34 & 4.6 \\
Fine-tune BiLSTM+Att. & 93.87 & 90.78 & 5.1 \\
\textbf{HEDLF + Stage Transfer} & \textbf{83.42} & \textbf{81.67} & \textbf{15.5} \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Ablation Study Results}
\begin{tabular}{lcccc}
\toprule
Configuration & FD Acc. (\%) & FC F1 (\%) & $\Delta$ FD & $\Delta$ FC \\
\midrule
Full HEDLF & 98.73 & 97.89 & — & — \\
w/o MSFM (simple concat) & 96.87 & 95.12 & -1.86 & -2.77 \\
w/o BiLSTM (CNN+Att only) & 96.12 & 94.67 & -2.61 & -3.22 \\
w/o Attention (CNN+BiLSTM) & 97.34 & 96.23 & -1.39 & -1.66 \\
w/o Residual connections & 97.89 & 96.87 & -0.84 & -1.02 \\
w/o Multi-task learning & 97.21 & 95.78 & -1.52 & -2.11 \\
w/o Asymmetric RUL loss & 98.73 & 97.89 & 0.00 & 0.00 \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Computational Cost Comparison}
\begin{tabular}{lcccc}
\toprule
Method & Parameters & Training Time (h) & Inference (ms/sample) & GPU Memory (GB) \\
\midrule
CNN-LSTM & 2.3M & 2.4 & 1.2 & 4.2 \\
Transformer & 8.7M & 8.1 & 3.4 & 11.7 \\
\textbf{HEDLF} & \textbf{4.2M} & \textbf{5.3} & \textbf{2.1} & \textbf{6.8} \\
\bottomrule
\end{tabular}
\end{table}

\clearpage

% ==========================================
% FIGURES SECTION
% ==========================================
\section*{Figures}

\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}[
        node distance=1.2cm and 1.5cm,
        box/.style={rectangle, draw=blue!70, fill=blue!5, thick, text width=6cm, align=center, rounded corners, minimum height=1.2cm, font=\small},
        head/.style={rectangle, draw=red!70, fill=red!5, thick, text width=3.8cm, align=center, rounded corners, minimum height=1.2cm, font=\small},
        arrow/.style={thick, -{Latex[scale=1.2]}, draw=black!70}
    ]
    
    % Nodes
    \node[rectangle, draw=green!70, fill=green!5, thick, text width=13cm, align=center, rounded corners, minimum height=1cm, font=\small\bfseries] (input) {Multi-Sensor Time-Series Inputs ($S_1, S_2, \dots, S_n$)};
    
    \node[box, below=0.8cm of input] (msfm) {\textbf{Multi-Sensor Fusion Module (MSFM)}\\Cross-Sensor Attention \& Weighting};
    
    \node[box, below=of msfm] (cnn) {\textbf{1D CNN Feature Extraction}\\Local Temporal \& Frequency Patterns};
    
    \node[box, below=of cnn] (bilstm) {\textbf{Bidirectional LSTM}\\Long-Range Temporal Dependencies};
    
    \node[box, below=of bilstm] (attn) {\textbf{Multi-Head Attention}\\Global Contextual Representation};
    
    \node[head, below left=1cm and -1.8cm of attn] (fd) {\textbf{Fault Detection Head}\\Binary Classification};
    \node[head, right=0.4cm of fd] (fc) {\textbf{Fault Classification Head}\\Multi-Class Outputs};
    \node[head, right=0.4cm of fc] (rul) {\textbf{RUL Prediction Head}\\Regression Output};
    
    \node[rectangle, draw=purple!70, fill=purple!5, thick, text width=13cm, align=center, rounded corners, minimum height=1cm, font=\small, below=1.5cm of attn] (shap) {\textbf{SHAP Explainability Layer} (Post-hoc Analysis \& Attribution)};

    % Connections
    \draw[arrow] (input) -- (msfm);
    \draw[arrow] (msfm) -- (cnn);
    \draw[arrow] (cnn) -- (bilstm);
    \draw[arrow] (bilstm) -- (attn);
    
    \draw[arrow] (attn.south) -- ++(0,-0.4) -| (fd.north);
    \draw[arrow] (attn.south) -- ++(0,-0.4) -| (fc.north);
    \draw[arrow] (attn.south) -- ++(0,-0.4) -| (rul.north);
    
    \draw[arrow, dashed] (fd.south) -- ++(0,-0.3) -| (shap.north);
    \draw[arrow, dashed] (fc.south) -- ++(0,-0.3) -| (shap.north);
    \draw[arrow, dashed] (rul.south) -- ++(0,-0.3) -| (shap.north);

    % Background Box
    \begin{scope}[on background layer]
        \node[rectangle, draw=black!20, fill=gray!5, inner sep=0.5cm, rounded corners, fit=(input) (msfm) (cnn) (bilstm) (attn) (fd) (fc) (rul) (shap)] (bg) {};
    \end{scope}

    \end{tikzpicture}
    \caption{Complete architecture of the Hybrid Explainable Deep Learning Framework (HEDLF) integrating dynamic sensor fusion and temporal feature extraction.}
    \label{fig:architecture}
\end{figure}

\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}
    \begin{axis}[
        width=0.9\textwidth,
        height=7.5cm,
        xlabel={Time (Operating Cycles)},
        ylabel={Remaining Useful Life (RUL)},
        xmin=0, xmax=200,
        ymin=0, ymax=140,
        legend pos=south west,
        legend cell align={left},
        grid=major,
        grid style={dashed, gray!30},
        title={RUL Prediction Trajectory Comparison}
    ]
    % Actual RUL (Piecewise Linear)
    \addplot[thick, black, dashed] coordinates {(0,130) (70,130) (100,100) (150,50) (200,0)};
    \addlegendentry{Actual RUL}
    
    % HEDLF Prediction
    \addplot[thick, blue, mark=*, mark size=1.5pt] coordinates {(0,128) (30,131) (70,125) (100,102) (125,78) (150,52) (175,23) (200,2)};
    \addlegendentry{HEDLF (Proposed)}
    
    % CNN-LSTM Prediction
    \addplot[thick, red, dotted, mark=x, mark size=2.5pt] coordinates {(0,115) (30,120) (70,110) (100,85) (125,60) (150,35) (175,10) (200,-5)};
    \addlegendentry{CNN-LSTM Baseline}
    \end{axis}
    \end{tikzpicture}
    \caption{RUL prediction trajectories for a representative engine unit from C-MAPSS FD001, comparing HEDLF against CNN-LSTM across degradation phases.}
    \label{fig:rul_trajectories}
\end{figure}

\begin{figure}[htbp]
    \centering
    \begin{tikzpicture}
    \begin{axis}[
        xbar,
        width=0.85\textwidth,
        height=6.5cm,
        enlarge y limits=0.15,
        xlabel={Mean $|$SHAP Value$|$ (Impact on Model Output)},
        symbolic y coords={Ambient Temp, Stator Current, Bearing Temp, Axial Vibration, Radial Vibration},
        ytick=data,
        nodes near coords,
        nodes near coords align={horizontal},
        bar width=15pt,
        xmin=0, xmax=0.6,
        axis x line=bottom,
        axis y line=left,
        title={Global Feature Importance for Bearing Fault Detection}
    ]
    \addplot[fill=teal!60, draw=teal!80, thick] coordinates {
        (0.53,Radial Vibration) 
        (0.21,Axial Vibration) 
        (0.16,Bearing Temp) 
        (0.068,Stator Current) 
        (0.029,Ambient Temp)
    };
    \end{axis}
    \end{tikzpicture}
    \caption{SHAP analysis results for bearing fault detection in IMD-2024, demonstrating sensor importance hierarchy.}
    \label{fig:shap_analysis}
\end{figure}

\clearpage

% ==========================================
% APPENDIX SECTION
% ==========================================
\section*{Appendix: Mathematical Formulations and Calculations}

This section contains the comprehensive mathematical formulations governing the components of the HEDLF architecture.

\subsection*{A. Multi-Sensor Fusion Module (MSFM)}
Given $N$ sensor streams $\{S_1, S_2, \dots, S_n\}$ each with $T$ time steps, each sensor stream $\mathbf{S}_i \in \mathbb{R}^T$ is first projected into a $d$-dimensional embedding space:
\begin{equation}
\mathbf{e}_i = \text{LayerNorm}(\mathbf{W}_e \mathbf{S}_i + \mathbf{b}_e) \in \mathbb{R}^d \tag{1}
\end{equation}

Cross-sensor attention is computed across the sensor embedding matrix $\mathbf{E} = [\mathbf{e}_1, \mathbf{e}_2, \dots, \mathbf{e}_n]^\top \in \mathbb{R}^{N \times d}$:
\begin{equation}
\text{CrossAttn}(\mathbf{E}) = \text{softmax}\left(\frac{\mathbf{E}\mathbf{W}_Q(\mathbf{E}\mathbf{W}_K)^\top}{\sqrt{d_k}}\right)\mathbf{E}\mathbf{W}_V \tag{2}
\end{equation}

The fusion weight vector $\boldsymbol{\alpha} \in \mathbb{R}^N$ is derived from the attended representations:
\begin{equation}
\alpha_i = \frac{\exp(\mathbf{w}_f^\top \mathbf{h}_i)}{\sum_{j=1}^{N} \exp(\mathbf{w}_f^\top \mathbf{h}_j)} \tag{3}
\end{equation}

The fused multi-sensor representation is calculated as follows:
\begin{equation}
\mathbf{F} = \sum_{i=1}^{N} \alpha_i \cdot \text{Reshape}(\mathbf{S}_i) \in \mathbb{R}^{T \times N} \tag{4}
\end{equation}

\subsection*{B. CNN Feature Extraction}
The fused representation $\mathbf{F}$ is processed through a multi-layer 1D CNN:
\begin{equation}
\mathbf{C}^{(l)} = \text{ReLU}(\text{BN}(\mathbf{W}^{(l)} * \mathbf{C}^{(l-1)} + \mathbf{b}^{(l)})) \tag{5}
\end{equation}
\begin{equation}
\mathbf{C}^{(l+2)} = \text{ReLU}(\mathbf{C}^{(l+2)} + \mathbf{W}_{res}\mathbf{C}^{(l)}) \tag{6}
\end{equation}

\subsection*{C. Bidirectional LSTM Temporal Modeling}
Forward and backward LSTM computations:
\begin{align}
\overrightarrow{\mathbf{h}}_t &= \text{LSTM}(\mathbf{c}_t, \overrightarrow{\mathbf{h}}_{t-1}) \tag{7} \\
\overleftarrow{\mathbf{h}}_t &= \text{LSTM}(\mathbf{c}_t, \overleftarrow{\mathbf{h}}_{t+1}) \tag{8} \\
\mathbf{h}_t &= [\overrightarrow{\mathbf{h}}_t; \overleftarrow{\mathbf{h}}_t] \in \mathbb{R}^{2d_{lstm}} \tag{9}
\end{align}

Standard LSTM gate computations:
\begin{align}
\mathbf{i}_t &= \sigma(\mathbf{W}_i[\mathbf{h}_{t-1}, \mathbf{c}_t] + \mathbf{b}_i) \tag{10} \\
\mathbf{f}_t &= \sigma(\mathbf{W}_f[\mathbf{h}_{t-1}, \mathbf{c}_t] + \mathbf{b}_f) \tag{11} \\
\mathbf{o}_t &= \sigma(\mathbf{W}_o[\mathbf{h}_{t-1}, \mathbf{c}_t] + \mathbf{b}_o) \tag{12} \\
\tilde{\mathbf{c}}_t &= \tanh(\mathbf{W}_c[\mathbf{h}_{t-1}, \mathbf{c}_t] + \mathbf{b}_c) \tag{13} \\
\mathbf{c}_t &= \mathbf{f}_t \odot \mathbf{c}_{t-1} + \mathbf{i}_t \odot \tilde{\mathbf{c}}_t \tag{14}
\end{align}

\subsection*{D. Multi-Head Temporal Attention}
Applied over the BiLSTM hidden state sequence $\mathbf{H} = \{\mathbf{h}_1, \mathbf{h}_2, \dots, \mathbf{h}_T\}$:
\begin{equation}
\text{MHA}(\mathbf{H}) = \text{Concat}(\text{head}_1, \dots, \text{head}_M)\mathbf{W}_O \tag{15}
\end{equation}
\begin{equation}
\text{head}_m = \text{softmax}\left(\frac{\mathbf{H}\mathbf{W}_m^Q(\mathbf{H}\mathbf{W}_m^K)^\top}{\sqrt{d_k}}\right)\mathbf{H}\mathbf{W}_m^V \tag{16}
\end{equation}
\begin{align}
\mathbf{Z} &= \text{LayerNorm}(\mathbf{H} + \text{MHA}(\mathbf{H})) \tag{17} \\
\mathbf{G} &= \text{LayerNorm}(\mathbf{Z} + \text{FFN}(\mathbf{Z})) \tag{18}
\end{align}

\subsection*{E. Multi-Task Output Heads and Loss Function}
Output heads utilizing shared representation $\mathbf{g} = \text{GlobalAvgPool}(\mathbf{G})$:
\begin{align}
\hat{y}_{FD} &= \sigma(\mathbf{W}_{FD}\mathbf{g} + \mathbf{b}_{FD}) \tag{19} \\
\hat{\mathbf{y}}_{FC} &= \text{softmax}(\mathbf{W}_{FC}\mathbf{g} + \mathbf{b}_{FC}) \in \mathbb{R}^K \tag{20} \\
\hat{y}_{RUL} &= \text{ReLU}(\mathbf{W}_{RUL}\mathbf{g} + \mathbf{b}_{RUL}) \tag{21}
\end{align}

Composite loss function with uncertainty weighting and asymmetric penalty:
\begin{equation}
\mathcal{L}_{total} = \frac{1}{2\sigma_1^2}\mathcal{L}_{FD} + \frac{1}{2\sigma_2^2}\mathcal{L}_{FC} + \frac{1}{2\sigma_3^2}\mathcal{L}_{RUL} + \log(\sigma_1\sigma_2\sigma_3) \tag{22}
\end{equation}
\begin{equation}
\mathcal{L}_{RUL} = \frac{1}{n}\sum_{i=1}^{n} s_i \cdot (\hat{y}_{RUL,i} - y_{RUL,i})^2 \tag{23}
\end{equation}

\subsection*{F. SHAP-Based Explainability and Transfer Learning}
SHAP post-hoc attribution:
\begin{equation}
\phi_i(f, x) = \sum_{S \subseteq F \setminus \{i\}} \frac{|S|!(|F|-|S|-1)!}{|F|!}[f(S \cup \{i\}) - f(S)] \tag{24}
\end{equation}

Domain adversarial feature alignment constraint:
\begin{equation}
\mathcal{L}_{DA} = \mathcal{L}_{task} - \lambda \mathcal{L}_{domain} \tag{25}
\end{equation}

\end{document}

