## 3 Methodology
### Multi-Scale Triple Linear Attention  
Inspired by triplet attention (TA) [55], MTLA is proposed to fuse the features of three dimensions in the sensor data at a deeper level, as shown in Figure 3, and multi-scale learning based on depth-wise convolution is used to further improve the local feature extraction capability.  
The linear attention can be represented by the following equation [56]:  
\[y^{*}=(\sigma(W_{1}\text{ReLU}(W_{0}g(x^{*}))+W_{1}\text{ReLU}(W_{0}\delta(x^{ *}))))\odot x^{*} \tag{10}\]  
where \(\sigma\) represents the sigmoid activation function; ReLU represents the rectified linear unit; \(W_{0}\) and \(W_{1}\) are weight matrices, the sizes of which are defined to be \(C\times\frac{C}{r}\) and \(\frac{C}{r}\times C\) (take the input \(x_{1}\in\mathbb{R}^{C\times T\times N}\) as an example), where \(r\) is the reduction ratio; \(\odot\) represents the Hadamard product; \(g(\cdot)\) is the global average pooling (GAP) function written as (take the input \(x_{1}\in\mathbb{R}^{C\times T\times N}\) as an example):  
\[g(x^{*})=\frac{1}{T\times N}\sum_{i=1}^{T}\sum_{j=1}^{N}x^{*}{}_{i,j} \tag{11}\]  
and \(\delta(\cdot)\) is the global max pooling (GMP) function written as (take the input \(x_{1}\in\mathbb{R}^{C\times T\times N}\) as an example):  
Figure 3: The architecture of (**a**) the MTLA module and (**b**) the linear attention mechanism.  
Figure 2: The architecture of (**a**) the proposed bidirectional Mamba module and (**b**) the Mamba block.  
\[\delta(x^{*})=\max_{T,N}(x^{*}) \tag{12}\]  
Let \(x\in\mathbb{R}^{T\times N\times C}\) be the input to the MTLA module, where \(T\), \(N\), and \(C\) represent the input length, number of nodes, and number of features, respectively. The input is passed to each of the three branches and outputs a refined tensor of the same shape. In the first branch, the input is rotated 90\({}^{\circ}\) anti-clockwise along the \(T\)-axis and the \(N\)-axis, respectively. The rotated tensor \(x_{1}\) is of the shape \(C\times T\times N\); then, \(x_{1}\) is passed through a depth-wise convolution to capture local spatial information and is denoted as \(\hat{x}_{1}\). The \(\hat{x}_{1}\) is then passed through a linear attention model to generate a weighted output, \(y_{1}\). Finally, the weighted output is rotated 90\({}^{\circ}\) anti-clockwise along the \(N\)-axis and the \(T\)-axis to retain the original input shape of \(x\).  
Similarly, in the second branch, the input is rotated 90\({}^{\circ}\) anti-clockwise along the \(N\)-axis and the \(T\)-axis. The rotated tensor \(x_{2}\) can be represented with a dimension of \(N\times C\times T\). Then, \(x_{2}\) is also passed through the depth-wise convolution and linear attention sequentially to generate the weighted output \(y_{2}\) and is subsequently rotated 90\({}^{\circ}\) anti-clockwise along the \(T\)-axis and the \(N\)-axis to retain the original input shape of \(x\).  
For the final branch, the input is passed through the depth-wise convolution and linear attention sequentially to generate the weighted output \(y_{3}\). Then, the refined tensor of shape \(T\times N\times C\) generated by the three branches is aggregated by simple averaging. Summarizing, the MTLA module can be represented by the following equation:  
\[y=\frac{1}{3}(\overline{y}_{1}+\overline{y}_{2}+y_{3}) \tag{13}\]  
where \(\overline{y}_{1}\) and \(\overline{y}_{2}\) represent the 90\({}^{\circ}\) clockwise rotation to retain the original input shape \(T\times N\times C\).