INTRODUCTION
Mental health encompasses an individual’s emotional, psychological, and social well-being. It is susceptible to damage from a range of mental health disorders, which have a detrimental impact on an individual’s cognitive abilities, emotional well-being, and interpersonal connections. To address these problems effectively, it is crucial to conduct a thorough and timely evaluation to differentiate and diagnose each one ( Hamilton, 1967).
The World Health Organization (WHO) estimated that over 970 million people, or 1 in 8 persons, were afflicted by a mental health illness in 2019, indicating the broad prevalence of such disorders in modern society ( Institute of Health Metrics and Evaluation, 2019). The COVID-19 pandemic led to a substantial increase in the prevalence of anxiety and severe depression, with a documented jump of 25% in 2020 ( World Health Organization, 2022d). As of 2022, 42.9% of individuals in Australia aged 16 to 85 have encountered a mental problem at some point in their life ( Australian Bureau of Statistics, 2022). Around 22.8% of individuals in the United States were found grappling with mental illness in 2021 ( National Institute of Mental Health, 2021). The contemporary lifestyle of the present day has a psychological influence on individuals’ mental well-being, leading to emotional anguish and sadness ( Vitriol et al., 2014). Depression is a common psychiatric condition that affects a person’s cognitive functions and mental development. The WHO reports that there are more than 1 billion individuals with mental diseases, and depression impacts over 300 million people globally. Depression is often associated with suicide ideation in a person. Approximately 800,000 individuals engage in the act of suicide on a yearly basis. Consequently, addressing the weight of mental health problems requires a thorough and all-encompassing approach ( Strunk et al., 2021; World Health Organization, 2023).
Although mental health illnesses are widespread, there are several deficiencies in the existing methods of diagnosing and treating them. These factors include the presence of comorbidities, which complicates the diagnosis process ( Goldman et al., 1999). Clinicians may struggle to accurately diagnose due to the overlapping symptoms and uncertainties ( Goldman et al., 1999). The dependency on patients’ subjective recall of activities and mental health-care professionals’ limited availability compounds the problems ( Kakuma et al., 2011; Grünerbl et al., 2015). The restrictions hinder the accurate identification of medical conditions, hence impeding those in need from accessing appropriate medical care. To enhance the identification of mental health illnesses, researchers initiated investigations into the use of artificial intelligence (AI) models. The motivation for such endeavors stems from the capacity of machine learning (ML) to effectively evaluate vast quantities of data ( Le Glaz et al., 2021), discern distinctive characteristics within the data ( Rahman et al., 2020), comprehend significant connections between data points ( Graham et al., 2019), and use these recognized associations to produce accurate predictions regarding fresh data ( Thieme et al., 2020).
A considerable proportion of the public is very concerned about mental health concerns. According to the WHO, a quarter of the global population may encounter a mental health condition at some stage in their lifetime. Consequently, the utilization of AI models to enhance the evaluation and therapy of mental health has the capacity to influence a substantial population. In addition, by incorporating these technologies into mental health research, we can augment our comprehension of the fundamental mechanisms of these disorders and ultimately create more efficient and individualized therapies, potentially enhancing the well-being of countless individuals grappling with mental health challenges ( Mitchell, 1997). ML has been used in several domains of psychological interventions and has great promise in predicting and managing mental health disorders and similar health-related results. Generally, these algorithms need a substantial amount of data to acquire patterns and execute classification tasks. The key contributions of this study are:
To develop a system for mental health disorders that may assist mental health practitioners in making treatment choices based on evidence in implementing digital mental health solutions.
To classify adverse mental well-being by using ML and deep learning (DL) prediction models, which rely on markers of healthy behaviors.
To outline advance AI techniques for identifying first indications of attention-deficit/hyperactivity disorder (ADHD), autism spectrum disorder (ASD), loneliness, major depressive disorder (MDD), obsessive compulsive disorder (OCD), pervasive developmental disorders (PDD), posttraumatic stress disorder (PTSD), anxiety, bipolar, eating disorder, psychotic depression, and sleeping disorders.
To assist health offices and psychiatrists in the early identification of these challenging illnesses that may impact society.
BACKGROUND OF THE STUDY
The WHO predicted that 970 million people globally will have mental health issues in 2019, with anxiety and depression being the most common. This number increased dramatically after the 2020 COVID-19 pandemic. The significance of obtaining medical treatment and addressing mental diseases has increased with the emergence of this epidemic. Despite the existence of these choices, the majority of individuals are unable to avail themselves of them, and a significant number experience discrimination, stigma, and infringement upon their human rights ( World Health Organization, 2022b, c). The process of diagnosing mental health conditions entails conducting a comprehensive psychiatric interview, which often includes an assessment of the reported symptoms, psychiatric background, and physical evaluations. Psychometric examinations and evaluation instruments are also beneficial in the identification of mental symptoms ( Jencks, 1985). According to research by the WHO, the prevalence of schizophrenia is estimated to be at least 1 in 300 individuals globally. This increases or triples the mortality risk from cardiovascular, metabolic, and viral disorders ( World Health Organization, 2022a). Delusions, hallucinations, disorganized speech, erratic behavior, and unpleasant symptoms may result. This may hinder social and vocational functioning ( Patel et al., 2014).
Garcia-Ceja et al. (2018) explored mental health identification and management using ML and sensor data. This study explored numerous learning strategies, including transfer learning. These approaches targeted depression, anxiety, migraines, and stress in mental health. The study just gives a summary of mental health issues and their uses. Gao et al. (2018) compared brain imaging studies that employ ML to predict illness. Magnetic resonance imaging data were used to study major depressive disorder (MDD) and bipolar disorder (BD). The system evaluates support vector machine (SVM), logistic regression, and decision algorithms. According to Cho et al. (2019), five ML approaches, namely, SVM, gradient boosting machine, random forest (RF), Naïve Bayes, and K-nearest neighbors (KNN), were tested for detecting mental health issues. The research examined PTSD, schizophrenia, depression, ASD, and bipolar illness. Anxiety is clinically comparable to MDD, making it difficult to predict ( Aleem et al., 2022).
Sau and Bhakta (2017) predicted senior depression and anxiety using ML. Niu et al. (2021) used a graph attention network and a hierarchical depression detection framework to construct a DL model that autonomously identified depression. Gratch et al. (2014) used clinical interviews for psychological distress disorders including anxiety, depression, and PTSD in the Distress Analysis Interview Corpus. Yoon et al. (2022). Created a complex multimodal DL model to detect depression. Xezonaki et al. (2020) classified depression patient interviews using a hierarchical attention network.
Cho et al. (2020) suggested using an RF algorithm to diagnose depression by employing the National Health Insurance Sharing Service in the Korean dataset. The research found that 0.02% of the participants had symptoms of depression, while 99.8% did not. This imbalance between the two groups necessitated the use of down-sampling or up-sampling techniques to provide a more balanced representation. Sharma et al. (2020) used a Lifelines Database of biomarker and self-reported depression data for ML models. To tackle the problem of unbalanced data, several resampling techniques were used in this research, given that the dataset itself exhibited such an imbalance. The XGBoost algorithm was used on each individual sample.
Reece et al. (2017) collected 204 Twitter users to identify sadness. They used these data to develop a system using several classifiers. Among the several classifiers constructed, an RF classifier consisting of 1200 trees showed superior performance compared to the others. This classifier was used for both daily and weekly observations. Mikolas et al. (2022) presented a technique to identify individuals with ADHD among a diverse range of other psychiatric disorders by analyzing de-identified clinical information. The authors used an SVM classifier on a set of 30 features. Additionally, they conducted a secondary classification analysis, excluding demographic information such as sex and age, as well as missing data. Their accuracies were 66.1%, 65.1%, and 68.8%, respectively. Tutun et al. (2023) created a decision-support system (DSS) that promptly identifies mental disorders using advanced analytics and AI. Network pattern recognition is utilized to create the assessment tool and identify participant inquiries during DSS development. Participant responses and historical data are used to build ML models that predict mental illness. The recommended DSS is used to diagnose mental disorders with 89% accuracy using 28 questions without human input. Timmons et al. (2023) explored the health-equity implications of applying AI to mental health concerns, state-of-the-art algorithmic bias evaluation and mitigation solutions, and a call to action to drive fair-aware AI in psychological research. Doctors should be involved in AI research, development, and care delivery. Higgins et al. (2023) developed decision-support to favor clinician trust. Clinicians should actively create and implement new health technologies and digital tools that help all health-care practitioners find lacking care for public safety and ethical implementation. Doctors who trust AI-based mental health decision-assistance systems see the biggest potential. Rocheteau (2023) employed AI to diagnose, monitor, and prescribe therapies. A broad, multi-site cross-sectional study of 17 Southeast Asian institutions was used by Abdul Rahman et al. (2023). They used ML for predicting mental health. The RF and adaptive boosting algorithms recognized negative mental health aspects effectively. AI-based mental health studies are listed in Table 1.
Prior studies on mental health.
Authors/year | Models | Dataset | Accuracy % | Purpose |
---|---|---|---|---|
Tutun et al., 2023 | Artificial intelligence | Questions dataset | 89 | Predicting mental disorder |
Çiftçi et al., 2018 | PLS tool | Video dataset from a hospital, Turkish | 71 | Predicting BD |
Úbeda et al., 2019 | SVM | Twitter dataset | 89 | Predicting anorexia |
Videbech and Deleuran, 2016 | Developing dataset | Depression in Denmark dataset | Developing data on depression | |
Hamm et al., 2014 | ANOVA | Collecting the dataset from the University of Pennsylvania | Predicting schizophrenia | |
Kim et al., 2021 | RF | ADHD dataset | 93 | Predicting ADHD |
Koh et al., 2022 | Bagged tree | ADHD dataset | 87 | Predicting ADHD |
Al-Nefaie et al., 2024 | Machine leaning | Voice dataset | 95 | Predicting Parkinson’s
Disease |
Aldhyani et al., 2024 | DL models | Hand drawing dataset | 94 | Diagnosis of Parkinson’s disease |
Abbreviations: ADHD, attention-deficit/hyperactivity disorder; ANOVA, statistical analysis tool; BD, bipolar disorder; DL, deep learning; RF, random forest; SVM, support vector machine.
METHODOLOGY
Figure 1 illustrates the structure of the proposed system designed to identify many mental health conditions.
Dataset
The mental disorders dataset, as collected from the Kaggle repository, contains 12 mental disorders, namely, ADHD, ASD, loneliness, MDD, OCD, PDD, PTSD, anxiety, bipolar, eating disorder, psychotic depression, and sleeping disorders. Figure 2 shows the class of the dataset, whereas Figure 3 shows the features of the mental disorders dataset.
Normalization
The normalization method was used in data mining to standardize the values of a dataset on a uniform scale. Normalization of input characteristics is crucial as it may significantly enhance the performance of ML and DL algorithms, which are often influenced by the size of the input data. This approach rescales the values of a feature to a range bounded by 0 and 1. This is achieved by subtracting the lowest value of the feature from each individual value and then dividing the result by the range of the feature.
Classification algorithms
Random forest tree algorithm
The RF approach is a supervised learning method that may be used to classify real-life applications. Nevertheless, its main use is in the domain of challenges related to classification. A forest is composed of trees, and an increased quantity of trees leads to a forest that is more resistant to damage or change. The RF algorithm produces decision trees from data samples, generates predictions from each tree, and eventually selects the ideal answer via a voting procedure. The RF algorithm works by performing the following steps:
Step 1: The program randomly selects samples from the specified dataset.
Step 2: The algorithm will generate a decision tree for every chosen sample. Subsequently, it will get a predicted outcome from every decision tree that has been generated.
Step 3: Subsequently, voting will be conducted for each anticipated outcome. In a classification issue, the mode is used, but in a regression problem, the mean is used.
Step 4: The algorithm will choose the prediction result that has received the most number of votes as the final prediction.
K-nearest neighbors
KNN is nonparametric and is used for classification and regression. Nonparametric means no data distribution assumptions are needed. KNN categorization assigns instances to classes. The type of nearby data points classifies the provided data point. Data points are allocated to classes with the highest frequency among their K-closest neighbors. We measured the distance between mental health diseases using the Euclidean distance approach.
where b 1, b 2, c 1, and c 2 are the input of metal health disorder features.
Long short-term memory
The LSTM approach is a kind of artificial neural network; it is unlike conventional feed-forward neural networks, which are often referred to as recurrent neural networks (RNNs); these networks include feedback connections. The LSTM model has the capability to handle and examine sequential data, including time series, text, and voice. By using a memory cell and gates, these systems effectively regulate the transmission of data, enabling them to choose whether to keep or discard information as required. Consequently, they overcome the issue of the vanishing gradient that often affects conventional RNNs.
The LSTM network is designed to effectively handle and interpret sequential input. The LSTM network consists of several LSTM cells, each including input, output, and forget gates. These gates control the movement of information into and out of the cell. The gates in the LSTM model are used to selectively choose whether to forget or remember information from prior time steps. This mechanism enables the LSTM to effectively preserve long-term dependencies in the input data. The LSTM cell is equipped with a memory cell that retains information from preceding time steps and leverages it to impact the output of the cell at the present time step. The output of each LSTM cell is sent to the subsequent cell in the network, enabling the LSTM to effectively handle and examine consecutive data over several time intervals. Figure 4 illustrates the structure of LSTM.
Equation (2) represents the forget gate, the initial step. A sigmoid layer decides. After that, the input gate, Equation (3), uses the hidden state and input data to determine the cell state enhancement value. In this step, the input gate layer determines the updated values, as does the tanh layer, Equation (4). Merging the two layers, Equation (5), creates the new cell state from Ct-1. Equation (6)’s output gate determines the sequence’s final hidden state. The sigmoid layer, Equation (7), must be executed to identify which cellular state components to create. Mathematical formulas determine the model structure.
EXPERIMENT
The proposed system underwent examination by dividing the dataset into a training set comprising 70% of the data and a testing set comprising 30% of the data. 30% of the dataset was allocated for assessing the suggested system’s ability to identify metal abnormalities. In order to develop such a system, we need a special environment for testing the proposed system. Table 2 shows the environmental setup of the proposed system.
Environmental setup of metal health disorder system.
#Hardware | #Software | #Version |
---|---|---|
RAM size 8 GB
Intel(R) Core(TM) i7 CPU 2.30GHz | Python
Panda library TensorFlow library Keras library Matplotlib library NumPy library | 3.6
2.1 2.13 3.0.2 3.8.2 1.26 |
Results
This section presents the thorough testing outcomes obtained from a rigorous assessment of three advanced machine leaning approaches namely RF, KNN, and LSTM. These models were methodically utilized to forecast a variety of mental problems, such as ADHD, ASD, loneliness, MDD, OCD, PDD, PTSD, anxiety, BD, eating disorder, psychotic depression, and sleeping disorder. Table 3 shows the results of RF and KNN and LSTM algorithms.
Testing results of the proposed models.
Model name | Class name | Precision | Recall | F1-score | Support | Accuracy |
---|---|---|---|---|---|---|
Random forest | ADHD | 1.00 | 1.00 | 1.00 | 21 | 1.00 |
ASD | 1.00 | 1.00 | 1.00 | 16 | ||
Loneliness | 1.00 | 1.00 | 1.00 | 11 | ||
MDD | 1.00 | 1.00 | 1.00 | 16 | ||
OCD | 1.00 | 1.00 | 1.00 | 6 | ||
PDD | 1.00 | 1.00 | 1.00 | 11 | ||
PTSD | 1.00 | 1.00 | 1.00 | 6 | ||
Anxiety | 1.00 | 1.00 | 1.00 | 10 | ||
Bipolar | 1.00 | 1.00 | 1.00 | 5 | ||
Eating disorder | 1.00 | 1.00 | 1.00 | 15 | ||
Psychotic depression | 1.00 | 1.00 | 1.00 | 7 | ||
Sleeping disorder | 1.00 | 1.00 | 1.00 | 4 | ||
KNN | ADHD | 1.00 | 1.00 | 1.00 | 21 | 0.95 |
ASD | 0.94 | 1.00 | 0.97 | 16 | ||
Loneliness | 1.00 | 0.82 | 0.90 | 11 | ||
MDD | 1.00 | 0.81 | 0.90 | 16 | ||
OCD | 1.00 | 1.00 | 1.00 | 6 | ||
PDD | 0.79 | 1.00 | 0.88 | 11 | ||
PTSD | 0.86 | 1.00 | 0.92 | 6 | ||
Anxiety | 1.00 | 1.00 | 1.00 | 10 | ||
Bipolar | 0.83 | 1.00 | 0.91 | 5 | ||
Eating disorder | 1.00 | 1.00 | 1.00 | 15 | ||
Psychotic depression | 1.00 | 0.86 | 0.92 | 7 | ||
Sleeping disorder | 0.75 | 0.75 | 0.75 | 4 | ||
LSTM | ADHD | 1.00 | 1.00 | 1.00 | 21 | |
ASD | 1.00 | 1.00 | 1.00 | 16 | ||
Loneliness | 1.00 | 1.00 | 1.00 | 11 | ||
MDD | 0.94 | 1.00 | 1.00 | 16 | ||
OCD | 1.00 | 1.00 | 1.00 | 6 | 0.99 | |
PDD | 1.00 | 0.91 | 1.00 | 11 | ||
PTSD | 1.00 | 1.00 | 1.00 | 6 | ||
Anxiety | 1.00 | 1.00 | 1.00 | 10 | ||
Bipolar | 1.00 | 1.00 | 1.00 | 5 | ||
Eating disorder | 1.00 | 1.00 | 1.00 | 15 | ||
Psychotic depression | 1.00 | 1.00 | 1.00 | 7 | ||
Sleeping disorder | 1.00 | 1.00 | 1.00 | 4 |
Abbreviations: ADHD, attention-deficit/hyperactivity disorder; ASD, autism spectrum disorder; KNN, K-Nearest Neighbors; LSTM, long short-term memory; MDD, major depressive disorder; OCD, obsessive compulsive disorder; PDD, pervasive developmental disorder; PTSD, posttraumatic stress disorder.
The results demonstrated an exceptional degree of accuracy and effectiveness in all three models. Starting with the RF model, a flawless accuracy of 100% was attained, highlighting its capacity to accurately categorize various mental health disorders. The KNN model, known for its capacity to handle different data structures, achieved an impressive accuracy of 95%, showcasing its ability to identify intricate patterns within the dataset. Meanwhile, the LSTM model, which is specifically built to capture temporal dependencies, demonstrated an impressive accuracy rate of 99%. This highlights its exceptional ability to comprehend complex temporal interactions that are present in mental health data.
The classification reports include a detailed study of precision, recall, and F1-score for each mental ailment, providing insights into the nuanced performance of each model under a wide range of scenarios. All models exhibited outstanding precision and recall scores, highlighting their strong performance in reducing false positives and identifying true positives. The macro and weighted average F1-scores provide additional confirmation of the overall efficacy of these models, continuously approaching perfection. These findings jointly emphasize the capacity of sophisticated AI models to contribute to the field of mental health prediction. The accurate and dependable quality of the predictions over a wide spectrum of mental diseases establishes these models as promising instruments for future utilization in mental health evaluation and diagnosis. This part demonstrates the efficacy of AI in improving our comprehension and predicting abilities in the intricate field of mental health.
RESULTS AND DISCUSSION
Disability in the context of mental health problems pertains to the constraints or challenges faced by people with such diseases in specific aspects of their everyday activities. These limitations encompass challenges in communication, social interaction, personal autonomy, learning, teaching, employment, and access to health-care services.
Disability management for mental health disorders seeks to offer support and assistance to people in order to enhance their quality of life and help them reach their maximum potential. This involves offering essential therapy, psychological and social assistance, guidance, awareness, suitable education, and job prospects.
AI can aid in enhancing the early detection of mental health issues. Intelligent systems may detect early indicators of mental health illnesses by analyzing intricate data and trends and offering suggestions for individuals to seek suitable therapy and care. In research, different AI models have been applied to predict disability for mental health disorders by using a standard dataset that was collected from Kaggle, and the dataset contains 12 mental health disorders.
An analysis of the testing outcomes for the RF, KNN, and LSTM models provides valuable insights into their individual abilities to predict different mental diseases. The primary objective was to thoroughly examine the models’ capacity to provide accurate and dependable predictions for a wide range of mental health disorders.
The RF model demonstrated exceptional accuracy, obtaining a perfect 100% accuracy rate for all mental diseases. Nevertheless, it is crucial to recognize the possibility of overfitting issues arising from the model’s outstanding performance, which calls for additional investigation in real-life applications. Figure 5 shows the confusion matrix of the RF model.

Confusion matrix of the random forest model. Abbreviations: ADHD, attention-deficit/hyperactivity disorder; ASD, autism spectrum disorder; MDD, major depressive disorder; OCD, obsessive compulsive disorder; PDD, pervasive developmental disorders; PTSD, posttraumatic stress disorder.
The KNN model, renowned for its versatility in handling diverse data structures, demonstrated an impressive accuracy rate of 95%. KNN exhibited a sophisticated comprehension of the dataset, particularly in the areas of anxiety and eating disorders. The model’s ability to adapt to imbalanced datasets was particularly evident in its effectiveness in diseases such as pervasive developmental disorders (PDD). The observed equilibrium between precision and recall in KNN results indicates its ability to produce accurate predictions while effectively handling the inherent complexities of mental health data. A multiclass categorization model’s confusion matrix shows the model’s predictions against the actual class labels for several classes. In the matrix for our experimental work at hand, the examples or mental disorder diseases in a predicted class are represented by each row, and the occurrences in an actual class are represented by each column. Figure 6 displays the confusion matrix obtained by the KNN models.

Confusion matrix of the KNN model. Abbreviations: ADHD, attention-deficit/hyperactivity disorder; ASD, autism spectrum disorder; KNN, K-nearest neighbors; MDD, major depressive disorder; OCD, obsessive compulsive disorder; PDD, pervasive developmental disorders; PTSD, posttraumatic stress disorder.
The LSTM model, which was specifically built to capture temporal dependencies within sequences, had an exceptional level of accuracy, reaching 99%. This highlights its effectiveness in understanding complex temporal linkages among mental health data. The LSTM’s temporal modeling has been beneficial in treating disorders such as MDD and psychotic depression, particularly in situations where comprehending the sequence of events is essential. Although LSTM performed exceptionally well, it is important to acknowledge the potential for heightened computational intricacy, which requires careful consideration of resource limitations in practical scenarios.
Figure 7 below shows the performance plots for an LSTM model in the context of classifying mental disorders, which involves visualizing key metrics such as training and testing accuracy as well as training and testing loss over 50 epochs, which are represented in Figure 8 below. The training model’s accuracy grows from 10% to 99%, while the model’s testing accuracy starts growing from 25% up to 99%. Depth analysis investigates that there is little variation in the model performance from the first epoch until the 50th epoch. With respect to model loss, the training loss starts reducing from 35% to 0.0%, while the model testing loss reduces from 25% to 0.4%.
The receiver operating characteristic (ROC) curve is a significant metric for assessing the performance of the proposed classification model used in our experimental work for mental health disorders and disabilities. It illustrates the trade-off between sensitivity and specificity across different classification thresholds. The ROC curve provides a single metric summarizing overall model performance, with a higher area under the curve (AUC)–ROC indicating better discrimination. Figure 9 shows the ROC for RF.

The ROC of the random forest model. Abbreviations: ADHD, attention-deficit/hyperactivity disorder; ASD, autism spectrum disorder; MDD, major depressive disorder; OCD, obsessive compulsive disorder; PDD, pervasive developmental disorders; PTSD, posttraumatic stress disorder; ROC, receiver operating characteristic.
CONCLUSION
Mental health encompasses an individual’s emotional, psychological, and social well-being. Mental health disorders may impair an individual’s cognitive abilities, emotional well-being, and social interactions. This research employs sophisticated ML and DL techniques to create a mental health DSS capable of accurately detecting and diagnosing different mental diseases. In order to test the proposed framework, the standard dataset of metal health disorders was collected from Kaggle. ML algorithms namely RF and KNN, along with a deep learning model (LSTM), were utilized to predict different forms of mental health illnesses. The results show that the proposed system can automatically diagnose mental disorders using mental health disorders. The RF approach achieved a high percentage (100%) for diagnosing all mental disorders, namely, ADHD, ASD, loneliness, MDD, OCD, PDD, PTSD, anxiety, BD, eating disorder, psychotic depression, and sleeping disorder. Mental health practitioners can utilize this proposed approach together with its assessment instrument to improve clinical decision-making and attain greater diagnostic accuracy. This initiative aims to develop a mental health system-based AI model to assist mental health clinicians in making accurate diagnosis of mental illnesses. In future studies, we will be building a web-based tool for forecasting mental health in Saudi Arabia.