View full-text article in PMC Sensors (Basel). 2025 Jul 28;25(15):4663. doi: 10.3390/s25154663 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm 1 LSTM-based Encoder–Attention–Decoder. Input: Input sequence X∈RB×T×De Encoder: 1:E←LinearEncoder(Flatten(X)) ▹(B×T,Dr) 2:E←Reshape(E,(B,T,Dr))⊺ ▹(T,B,Dr) 3:Initialize h0∈RL×B×H 4:(Oe,h1)←LSTM(E,h0) ▹(T,B,H) Attention: 5:A←Oe⊺ ▹(B,T,H) 6:Q,K,V←A·Wq,A·Wk,A·Wv ▹W·∈RH×d 7:Attn←softmax(QK⊤d)V ▹(B,T,H) 8:S←Attn⊺ ▹(T,B,H) Decoder: 9:Od←LSTMDecoder(S) ▹(T,B,H) 10:Yr←LinearDecoder(Od) ▹(T,B,Dd) 11:Ym←MLP(Flatten(S)) Fusion: 12:Y←12(Yr+Ym) 13:if use_residual then 14: Y←Y+X⊺ 15:end if 16:Y←Y⊺ ▹(B,T,Dd) Output: Prediction Y∈RB×T×Dd