Background and objectiveRecurrent major depressive disorder (rMDD) has a high recurrence rate, and symptoms often worsen with each episode. Classifying rMDD using functional magnetic resonance imaging (fMRI) can enhance understanding of brain activity and aid diagnosis and treatment of this disorder. MethodsWe developed a Residual Denoising Autoencoder (Res-DAE) framework for the classification of rMDD. The functional connectivity (FC) was extracted from fMRI data as features. The framework addresses site heterogeneity by employing the Combat method to harmonize feature distribution differences. A feature selection method based on Fisher scores was used to reduce redundant information in the features. A data augmentation strategy using a Synthetic Minority Over-sampling Technique algorithm based on Extended Frobenius Norm measure was incorporated to increase the sample size. Furthermore, a residual module was integrated into the autoencoder network to preserve important features and improve the classification accuracy. ResultsWe tested our framework on a large-scale, multisite fMRI dataset, which includes 189 rMDD patients and 427 healthy controls. The Res-DAE achieved an average accuracy of 75.1 % (sensitivity = 69 %, specificity = 77.8 %) in cross-validation, thereby outperforming comparison methods. In a larger dataset that also includes first-episode depression (comprising 832 MDD patients and 779 healthy controls), the accuracy reached 70 %. ConclusionsWe proposed a deep learning framework that can effectively classify rMDD and 33 identify the altered FC associated with rMDD. Our study may reveal changes in brain function 34 associated with rMDD and provide assistance for the diagnosis and treatment of rMDD.