## 2 Materials and Methods
### Data Harmonization with NeuroHarmonize and DNN Classification  
The first classification analysis was implemented with a deep neural network analyzing the harmonized dataset. For the harmonization, we employed the state-of-art tool, developed by [PERSON] et al. [20] in 2019 and available as a free Python package called NeuroHarmonize ([[https://github.com/rpoponio/neuroHarmonize](https://github.com/rpoponio/neuroHarmonize)]([https://github.com/rpoponio/neuroHarmonize](https://github.com/rpoponio/neuroHarmonize)), accessed on 5 April 2023). It differs from the previous formulation by [PERSON] [8] in the modeling of the biological covariates, which are usually treated with a linear regression. [PERSON] substituted this linear model with a generalized additive model (GAM). In this model, covariates such as sex, age and full intelligence quotient (FIQ) are represented by terms that can be either linear or non-linear functions. This allows for better parametric modeling to deal with non-linear trends such as the typical evolution of several brain measures with age. The harmonized feature \(y_{ijf}^{*}\) is given by  
\[y_{ijf}^{*}=\frac{y_{ijf}-\hat{\alpha}_{f}-x_{ij}\cdot\hat{\beta}_{f}-\hat{ \gamma}_{if}}{\hat{\delta}_{if}}+\hat{\alpha}_{f}+x_{ij}\cdot\hat{\beta}_{f} \tag{3}\]  
where:  
* \(y_{ijf}\) is the numeric value of the feature \(f\) for the patient \(i\) acquired with the scan (or equivalently, from the site) \(j\);
* \(x_{ij}\) is the vector of the matrix X created with the covariates of interest, such as age and sex;
* \(\hat{\alpha}_{f}\) is the estimator of the mean value for the feature \(f\);
* \(\hat{\beta}_{f}\) is the estimator of the vector of regression coefficients corresponding to \(X\) for the feature \(f\);* \(\hat{\gamma}_{if}\) and \(\hat{\delta}_{if}\) represent the estimators of the additive and multiplicative terms for site-\(i\) effects related to feature \(f\), respectively;
* \(e_{if}\) is a residual term that is assumed to follow a normal distribution with zero mean and variance \(\sigma_{f}^{2}\);  
In our work, we chose the age and FIQ as covariates to be preserved in order to keep important possible biological trends in the data and avoid overcorrections.  
In order to test the effectiveness of the harmonization procedure, we performed a classification task whose aim was to distinguish between different pair of sites by using the site name as label. We used a random forest classifier and the area under the receiver operating characteristic (ROC) curve (AUC) as a metric. AUC measures the overall performance of the model across all possible classification thresholds by calculating the area under the ROC curve. The AUC value ranges between 0 and 1, with a higher value indicating better classification performance. An AUC of 0.5 indicates that the model performs no better than random guessing, whereas an AUC of 1 indicates perfect classification performance [21]. We compared the performance of the classification for non-harmonized data and harmonized ones.  
Harmonized data were then analyzed with a deep neural network (DNN), trained to perform the ASD vs. TD classification. The DNN was built using the Keras API and consisted of an input layer, a dense layer of 256 neurons, batch normalization, a dropout (with 30 % dropout probability), and 8-neuron dense layer. It ended with a single-neuron output layer, activated with an ReLU function. The results of ASD vs. TD discrimination were evaluated in terms of the mean AUC scores across all the folds in a 5-fold CV scheme.