# Dynamic Multi-Task Graph Isomorphism Network for Classification of Alzheimer's Disease
## 3 Methods
### Multi-Task Integration  
Multi-task Learning (MTL) is a technique that simultaneously optimizes the objective functions of multiple related tasks within a single model [38]. Compared with single-task learning, MTL can improve the model's generalization ability and learning efficiency by leveraging the commonalities and differences between different tasks, reducing the risk of overfitting [39]. We employed a multi-task auxiliary network model, with Alzheimer's Disease (AD) classification as the primary task and age and gender prediction as auxiliary tasks. As the onset of AD is associated with age and gender [40], we believe that the auxiliary tasks can help the primary task extract more effective features and adjust network parameters. Our model consists of three Fully Connected (FC) layers, each designed to output different results. Specifically, one FC layer is assigned to provide the AD classification result. The labels used for this task are binary: 0 for the Cognitively Normal (CN) group and 1 for the AD patient group. This layer essentially separates the input data into two distinct categories based on the risk of Alzheimer's disease. The second FC layer focuses on age regression, outputting a continuous value that represents the predicted age of the individual. This task is essential to understanding how age-related changes can affect the disease's progression. The third FC layer is tasked with gender classification, which results in binary labels, with 0 representing female and 1 representing male. This task helps in understanding the gender-based differences that might exist in the progression and risk of Alzheimer's disease. For the calculation of the loss function, we use different approaches for different tasks. For the AD classification and gender classification tasks, we employ the Cross Entropy loss function (CE). This function is commonly used in binary classification tasks due to its effectiveness in measuring the performance of a classification model whose output is a probability value between 0 and 1. For the age regression task, we use the Mean Squared Error loss function (MSE), a popular choice for regression tasks as it penalizes the model based on the difference between the actual and predicted age values. The losses from these three tasks are then combined using a weighted summation method. This allows us to balance the contribution of each task to the overall loss, ensuring that one task's loss does not overwhelm the others and skew the model's learning process. Once the combined loss is computed, we update the model's parameters using backpropagation. This method iteratively adjusts the model's parameters to minimize the total loss, thus optimizing the model's performance across all three tasks. Figure 3: GIN framework diagram. To adaptively weight the losses of different tasks, we employ the GradNorm algorithm. This algorithm optimizes a loss function called Grad Loss by balancing the gradient norms of each task, dynamically adjusting the weights of each task. The core idea of the GradNorm algorithm is to make the gradient norms of each task as close as possible to a reference value, preventing certain tasks from dominating training resources. Specifically, given \(T\) tasks and their corresponding loss functions \(L_{i}(t)\) (\(i=1,\cdots,T\)), a shared network parameter \(W\), and individual task parameters \(w_{i}(t)\) (\(i=1,\cdots,T\)), we define the gradient norms for each task as follows:  
\[G_{w}^{i}(t)=\left\|\
abla_{W}w_{i}(t)L_{i}(t)\right\|_{2}\quad(i=1,\cdots,T) \tag{6}\]  
A reference gradient norm is also defined as:  
\[\overline{G}_{w}(t)\times[r_{i}(t)]^{\alpha} \tag{7}\]  
In the equation, \(r_{i}(t)\) is the relative inverse training rate of task \(i\) at epoch \(t\), \(\alpha\) is a hyperparameter, and a larger \(\alpha\) enforces stronger constraints on balancing training speeds.