\documentclass[11pt,a4paper]{article}

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

\begin{document}

\begin{center}
    \Large\textbf{Supplementary Appendix: Mathematical Formulations} \\[0.5cm]
    \large\textit{Hybrid Deep Learning Framework for Predictive Maintenance in Industrial IoT Systems: A Multi-Sensor Fusion Approach with Explainability} \\[0.5cm]
    \textbf{Syed Eirfan Atthar} \\
    Department of Mechanical Engineering, Dibrugarh University, Assam, India \\
    Email: 20wj1a03b1@gniindia.org
\end{center}

\vspace{1cm}

\noindent Within this supplementary document, the mathematical formulations governing the fundamental components of the Hybrid Explainable Deep Learning Framework (HEDLF) architecture are explicitly detailed.

\section*{A. Multi-Sensor Fusion Module (MSFM)}
For $N$ independent sensor channels, each sampled across $T$ temporal intervals, the input is formalized as $\mathbf{S}_i \in \mathbb{R}^T$. To prevent initial channel dominance, each vector is linearly projected into a dense $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}

A cross-channel attention mechanism is computed across the aggregated 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 dynamic fusion weight vector $\boldsymbol{\alpha} \in \mathbb{R}^N$ is subsequently 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 contextually fused representation is computed as:
\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}

\section*{B. Spatial Feature Extraction (1D-CNN)}
The fused matrix $\mathbf{F}$ is passed through successive 1D convolutional filter banks to isolate localized degradation signatures:
\begin{equation}
\mathbf{C}^{(l)} = \text{ReLU}(\text{BN}(\mathbf{W}^{(l)} * \mathbf{C}^{(l-1)} + \mathbf{b}^{(l)})) \tag{5}
\end{equation}
To mitigate gradient degradation across deeper layers, a residual connection is implemented:
\begin{equation}
\mathbf{C}^{(l+2)} = \text{ReLU}(\mathbf{C}^{(l+2)} + \mathbf{W}_{res}\mathbf{C}^{(l)}) \tag{6}
\end{equation}

\section*{C. Temporal Dependency Mapping (BiLSTM)}
Temporal coherence is established via forward and backward Long Short-Term Memory (LSTM) operations:
\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}

The internal gating mechanisms are mathematically defined as:
\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}

\section*{D. Global Context Aggregation (Self-Attention)}
A multi-head self-attention mechanism is applied across 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}
The outputs are subjected to layer normalization and a position-wise feed-forward network:
\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}

\section*{E. Multi-Task Optimization and Loss Formulation}
The task-specific output predictions are derived from a shared global representation, defined as $\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}

The multi-task optimization objective is formulated incorporating homoscedastic uncertainty weighting:
\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}
An asymmetric penalty is incorporated into the regression loss to strictly penalize hazardous overestimations of Remaining Useful Life:
\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}

\section*{F. SHAP Attribution and Domain Alignment}
Post-hoc feature attribution is computed utilizing SHAP values:
\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}

For cross-domain generalization scenarios, the domain adversarial feature alignment constraint is enforced via a gradient reversal layer:
\begin{equation}
\mathcal{L}_{DA} = \mathcal{L}_{task} - \lambda \mathcal{L}_{domain} \tag{25}
\end{equation}

\end{document}
