# LSTGINet: Local Attention Spatio-Temporal Graph Inference Network for Age Prediction
## 3 Proposed Framework of LSTGINet
### Reconstructed Loss Function  
To promote the network to obtain optimal feature representation, we designed a weighted reconstruction loss function of \(\mathcal{L}\), using different loss functions for each branch for independent supervision to avoid the network falling into local optimality. The weighted reconstruction loss function is shown in Equation (13).  
\[\begin{cases}\mathcal{L}=\mathcal{L}_{m}+\lambda\cdot\mathcal{L}_{s}+\beta \cdot\mathcal{L}_{t}+\alpha\mathcal{L}_{\zeta}\\ \alpha=0.25,\lambda=\beta=0.5\end{cases} \tag{13}\]  
where \(\lambda,\beta,\alpha\) denote the regulatory factors; \(\mathcal{L}_{s}\) and \(\mathcal{L}_{t}\) denote the loss for spatial branch and temporal branch features. \(\mathcal{L}_{\zeta}\) represents the loss function for optimizing the graph inference features. \(\mathcal{L}_{m}\) denotes the primary loss function. These loss functions of \(\mathcal{L}_{m}\) and \(\mathcal{L}_{s}\) are calculated as shown in Equation (14).  
\[\begin{cases}\mathcal{L}_{m}=\frac{1}{N}*\sum_{i=1}^{N}|Y_{i}-\widetilde{Y}_{ i}|\\ \mathcal{L}_{s}=\frac{1}{N}*\sum_{i=1}^{N}log(cosh(Y_{i}-\widetilde{Y}_{i})) \end{cases} \tag{14}\]  
where \(N\) represents the total number of samples. The loss functions of \(\mathcal{L}_{t}\) are shown in Equation (15).  
\[\mathcal{L}_{t}=\frac{1}{N}*\sum_{i=1}^{N}\begin{cases}\frac{1}{2}(Y_{i}- \widetilde{Y}_{i})^{2},|Y_{i}-\widetilde{Y}_{i}|<\delta\\ \delta((Y_{i}-\widetilde{Y}_{i})-\frac{1}{2}\delta),\textit{otherwise}\end{cases} \tag{15}\]  
where \(\delta\) represents the control parameter used to control the trade-off between the mean absolute error and the mean square error of the loss function. The loss functions of \(\mathcal{L}_{\zeta}\) are shown in Equation (16).  
\[\mathcal{L}_{\zeta}=\sum_{i=Y_{i}<\widetilde{Y}_{i}}(\gamma-1)|Y_{i}- \widetilde{Y}_{i}|+\sum_{i=Y_{i}\geq\widetilde{Y}_{i}}\gamma|Y_{i}-\widetilde {Y}_{i}| \tag{16}\]  
where \(\widetilde{Y}\) represents the predicted label. \(Y\) represents the ground truth label. \(\gamma\) represents the penalty factor.  
In summary, the reconstruction loss function we designed plays a balancing role between different age groups and features; this individually supervised learning strategy enhances the representation of the spatio-temporal features. At the same time, the separately supervised graph inference module strengthens the interaction between spatio-temporal features and more effectively captures the hidden correlation between brain information and age, thereby improving the overall performance of the LSTGINet age prediction framework. The training process is shown in Algorithm 1.  
```
Input: Given a set of spatio-temporal brain data of \(X_{A}\in\mathbb{R}^{C\times N\times N},X_{B}\in\mathbb{R}^{C\times N\times T}\). The features of different branch are \(\{\mathcal{F}_{a},\mathcal{F}_{b}\}\), and the generated fusion features are \(\mathcal{F}^{\prime}\) and \(\mathcal{F}_{\mathcal{G}}\). The reconstructed loss function \(\mathcal{L}\) and the optimizer \(AdamW\) supervise the framework ; for e=0 to e=Maxdo \([f^{\prime}_{a}f^{\prime}_{b}]\)\(\frac{SPM}{TEM}\)\([f_{a}f_{b}]\)\(\stackrel{{Eq1}}{{\longleftarrow}}\)\((X_{A},X_{b})\) ; \([\mathcal{F}^{\prime}_{a},\mathcal{F}^{\prime}_{b}]\)\(\frac{Eq7}{Eq4}\)\([\mathcal{F}_{a},\mathcal{F}_{b}]\)\(\frac{APPAM,PAM}{Bindrm++}\)\([f^{\prime}_{a},f^{\prime}_{b}]\) ; \([\mathcal{O}]\)\(\stackrel{{Eq14}}{{\longleftarrow}}\)\([\mathcal{F}^{\prime},\mathcal{F}_{\mathcal{G}}]\)\(\frac{GIM}{LAM}\)\([\mathcal{F}^{\prime}_{a},\mathcal{F}^{\prime}_{b}]\) ; \([\widetilde{Y}]\)\(\stackrel{{Linear(.)}}{{\longleftarrow}}\)\([\mathcal{O}]\) ;  This final optimization is via Equations (12) and (16) ;  The output of LSTGINet is used to predict age ; end for outputOptimization of the training by \(AdamW\) and total loss function of \(\mathcal{L}\).
```  
**Algorithm 1**Development of the LSTGINet prediction process for brain information.