# A Multi-Site Anti-Interference Neural Network for ASD Classification
## 2 Materials and Methods
### Objective Function and Model Training  
In the existing methods, the model is trained in a zero-sum game way when adopting adversarial design, that is, the adversarial task that removes confounding effects is trained separately and its loss value is minimized [19; 20]. This method is feasible when there is only a single task, such as the generation of adversarial network. However, when the target task and the adversarial task are inconsistent, the lowest loss value of the adversarial task may not make the target task achieve the optimal result, and may even have the opposite effect. [PERSON] et al. [19] have found in the experiment that the adversarial task that removes scanner information can also cause adverse effects on the target task and reduce the final prediction performance. Therefore, MS-AINN does not train the adversarial task alone, but combines the adversarial task and the target task into an objective function, and completes the training of the two tasks simultaneously through the loss optimization of the objective function, so that the two can reach a balance in the training and ensure the performance improvement of the target task. The objective function of anti-interference classification task is composed of loss functions of ASD classification and site feature regression. The purpose is to make the loss of ASD classification decrease while the loss of site feature regression increases, so as to complete the disease classification and site feature regression adversarials at the same time. Firstly, the symbols used in the function are introduced. \(X=\{X_{1},\ldots,X_{N}\}\) represents the functional connection of \(N\) subjects. \(Y=\{Y_{1},\ldots,Y_{N}\}\) represents the labels of \(N\) subjects; \(C=\{C_{1},\ldots,C_{N}\}\) represents the site feature vector of \(N\) subjects; \(\theta_{E}\) is the parameter representing the learning module; \(\theta_{p}\) is the classifier parameter; \(\theta_{R}\) is the regression component parameter. The loss function of site feature regression task is the mean square error, as shown in Formula (6). The classification task loss function is cross entropy loss, as shown in Formula (7). \[L_{R}(X_{i},C_{i};\theta_{R})=\sum\limits_{i=1}^{N}\frac{1}{m}\sum\limits_{j= 1}^{m}\left(C_{j,i}-\widehat{C}_{j,i}\right)^{2} \tag{6}\]  
\[L_{p}(X_{i},Y_{i};\theta_{E},\theta_{P})=-\sum\limits_{i=1}^{N}[Y_{i}\ln(P_{i })+(1-Y_{i})\ln(1-P_{i})] \tag{7}\]  
The model adopts the training mode of alternating iteration. In each epoch, the regression task loss \(L_{R}\) is optimized first, and the regression component parameter \(\theta_{R}\) is trained. After optimization, the objective function loses \(L_{t}\), and the representation learning module parameter \(\theta_{E}\) and classifier parameter \(\theta_{p}\) are trained. In order to realize the confrontation between two trainings, the objective function should minimize the classification loss \(L_{p}\) and also maximize the regression task loss \(L_{R}\). Therefore, the regression task loss function is selected as the denominator of a fraction and the whole fraction is added to the classification task loss function. In this way, when the optimizer reduces the objective function \(L_{t}\), the classification task loss \(L_{p}\) will also decrease and the regression task loss \(L_{R}\) will increase, as shown in Formula (8). \(\alpha\) is a hyperparameter, which is used to balance the loss optimization of the two tasks, so as to prevent the excessive increase of \(L_{R}\) in the training of the objective function from resulting in too-strong restriction on the representation learning module and the degradation of the classification performance of ASD. \[L_{t}(X_{i},Y_{i},C_{i};\theta_{E},\theta_{p})=L_{p}(X_{i},Y_{i})+\frac{\alpha }{L_{R}(X_{i},C_{i})} \tag{8}\]  
In the two trainings of the model, the first regression task trained a regression component to identify the site difference information contained in the features extracted by the representation learning module.