Machine Learning Approach to Mental Health

Ankit K C
8 min readJul 22, 2023

--

Abstract

The rise in mental health issues and the demand for high-quality medical care have prompted research into the use of machine learning in mental health issues. Using data from the osmi mental health survey, different machine learning algorithm was applied to predict patients who may have depression based on information that could typically be found in a medical file. These predictions could be used to connect patients with qualified mental health specialists more quickly and easily. This study identified five machine learning techniques and assessed their accuracy in identifying mental health issues using several accuracy criteria. The five machine learning techniques are Logistic Regression, K-NN Classifier, Decision Tree Classifier, Random Forest, and Stacking. We have compared these techniques and implemented them and also obtained the most accurate one in Stacking technique based with an accuracy of prediction 82.01%.

1. Introduction

Mental health disorders are a significant public health concern that affects millions of people worldwide. One in four people in the world will be affected by mental disorders at some point in their lives.[1] These problems have demonstrated that mental illness has serious societal consequences and requires novel prevention and therapeutic measures. Early mental health detection is a critical method to carry out these tactics. The goal of machine learning is to create systems that can learn from experience by utilizing sophisticated statistical and probabilistic methods. It is thought to be a very helpful tool for predicting mental health. It is enabling a number of researchers to gather crucial data and create tailored experiences, automated intelligent systems, and systems that can learn from data.

In many different forms of research, investigations, and experiments, supervised learning in machine learning is the approach that is most frequently used, particularly in the medical industry when attempting to predict the illness.[2] In supervised learning, classification algorithm like Logistic Regression, K-NN Classifier, Decision Tree Classifier, Random Forest, and Stacking are used in this case study. More specifically, supervised learning is a classification method that makes use of structured training data. It is very limited and rare for the researchers to apply unsupervised learning methods in the medical field. The aim of this project is to identify the best machine learning algorithm for predicting mental health disorders based on osmi mental health survey data. The dataset used in this project was obtained from a mental health clinic and contained information about patients’ age, gender, family history of mental illness, lifestyle habits, and clinical diagnosis. The project is divided into several stages, including data cleaning and preprocessing, exploratory data analysis, feature selection, model selection, and evaluation.

The findings of this project have important implications for mental health professionals and policymakers in developing early intervention and prevention strategies for mental health disorders. By identifying individuals at risk of developing mental health disorders, healthcare providers can offer timely and effective interventions to prevent the development of mental health disorders or reduce their severity.[3] For this, Machine learning algorithms with most accuracy is needed which can also provide insights into the factors that contribute to mental health disorders, leading to a better understanding of the complex nature of these disorders.

The performance on the machine learning algorithms or techniques that are used is being evaluated by identifying the accuracy, and area under the ROC curve. Hence, the sections of this study are organized as follows. After Introduction, the methodology section will discuss about dataset and process of dataset for algorithm. The Result section will examine algorithms for predicting mental health. Lastly, the conclusion section will conclude this paper with effective algorithm for prediction.

2. Methodology

Technological advancements such as smartphones, social media, neuroimaging, and wearables have enabled researchers of mental health and doctors to gather a tremendous amount of information at a rapid rate. Machine learning has developed as a reliable tool for analyzing these data. Machine Learning is the application of advanced probabilistic and statistical techniques to create computers that can learn from data on their own. [4] This allows data patterns to be more easily and correctly discovered, as well as more accurate predictions from data sources. Mental health data is also being investigated using similar analytic tools, with the potential to improve patient outcomes as well as improve understanding of psychological diseases and their management. The data for this project is from the osmi mental health survey. This data includes a vast array of health data done on a sample 58% people from us, 12 % from UK, 6 % from Canada, 4 % from Germany and remaining from many other counties. and comprised of 1570 people around various places.

Figure -1

From the data set we go through different phases like Data Collection, Data Cleaning, encoding data, Finding Co-variance matrix, Scaling and Fitting, Tuning, Evaluation models, Finding Accuracy, Predicting Data and Results. we split the dataset into training and testing data set. The next step is featuring importance. Feature selection is critical in machine learning since it is a fundamental strategy for directing variable usage to what is most efficient and effective for a certain machine learning system. The next step is tuning. Tuning is the process of enhancing a model’s performance while avoiding overfitting or excessive variance. This is performed in machine learning by picking appropriate hyperparameters. The models are then evaluated using a variety of machine learning methods, such as stacking, logistic regression, K-nearest neighbor classifier, decision tree classifier, and random forest classifier.

3. Result

In this section, the performance of the machine learning i.e k nearest neighbor classifier, logistic regression, decision tree, and stacking, and random forest algorithms will be evaluated and analyzed. And we assessed their accuracy in identifying mental health issues.

3.1. Logistic Regression

Logistic regression is a prominent machine learning algorithm that comes under the supervised learning approach the result should be a categorical or discrete value. It can be 0 or 1, Yes or No, true or false, and so on. Logistic regression is used to describe data and the relationship between one dependent variable and one or more independent variables. The independent variables can be nominal, ordinal, or of interval type.

Accuracy for 3.1
ROC for 3.1

3.2. K Nearest Neighbour Classifier

KNN is a simple, supervised machine learning algorithm that can be used for classification or regression tasks and is also frequently used in missing value imputation. It is based on the idea that the observations closest to a given data point are the most “similar” observations in a data set, and we can therefore classify unforeseen points based on the values of the closest existing points. By choosing K, the user can select the number of nearby observations to use in the algorithm.

Accuracy for 3.2
ROC for 3.2

3.3. Decision Tree Classifier

Decision Tree is the widely used supervised machine learning technique that is used in machine learning, statistics and data mining. A decision tree is a diagram that individuals use to illustrate a statistical likelihood or to determine the sequence of events, actions, or outcomes. It is one of the most widely used and practical methods for supervised learning. Decision Trees are a non-parametric supervised learning method used for both classification and regression tasks.

Accuracy for 3.3
ROC for 3.3

3.4. Random Forest Classifier

A random forest is a machine learning technique that’s used to solve regression and classification problems. It utilizes ensemble learning, which is a technique that combines many classifiers to provide solutions to complex problems[5]. A random forest algorithm consists of many decision trees. The ‘forest’ generated by the random forest algorithm is trained through bagging or bootstrap aggregating. This algorithm establishes the outcome based on the predictions of the decision trees. It predicts by taking the average or mean of the output from various trees.

Accuracy for 3.4
ROC for 3.4

3.5. Stacking

Stacking is ensemble machine learning techniques used to predict multiple nodes to build a new model and improve model performance. This ensemble technique works by applying input of combined multiple weak learners’ predictions and Meta learners so that a better output prediction model can be achieved.

Accuracy for 3.5
ROC for 3.5

4. Comparison

The accuracy of a given test set for a classifier is the percentage of test set instances that are classified correctly by using the classifier. The accuracy of any classifier will depend upon how well the classifier will classify the data set which is being tested. We measured that by using the area under the Receiver Operating Curve. In the ROC area, a perfect test will represent an area of 1 and a worthless test will represent an area of 0.5.

Figure -2

5. Conclusion

Many different techniques and algorithms had been introduced and proposed to test and solve the mental health problems. Several solutions can yet be improved. However, there are still a lot of issues in machine learning for the field of mental health that need to be identified and tested in a range of situations. Comparing those strategies is crucial in order to choose the one that best fits the target domain of interest. Nowadays, we have many special programs in the medical field that predict disease very accurately in advance so that treatment can be done effectively and efficiently. In this proposed work we have compared five different techniques of machine learning which are used to classify the dataset on various problems of mental health. It is very clear from the results that all the five machine learning techniques give more accurate results. Figure-2 illustrates the graph of five classifeir based on accuracy percentage where the accuracy of all the classifiers is above 79%. Mental Health can be predicted using stacking algorithm as it gives more accuracy than other algorithm.

Reference

[1] World Health Organization. “Mental Health: New Understanding, New Hope.” World Health Report 2001, World Health Organization, Geneva, Switzerland, 2001, www.who.int/whr/2001/en/whr01_en.pdf.

[2] Karimi, Amirhossein, Mohammadreza Dousti, and Mohsen Mohammadi. “Machine Learning in Medicine: Applications and Opportunities.” Coursera, 2023, www.coursera.org/articles/machine-learning-in-health-care

[3] Smit, J. H., van Straten, A., Cuijpers, P., & Penninx, B. W. J. H. (2013). Mental Health Promotion and Prevention: A Review of the Evidence. Clinical Psychology Review, 33(1), 1–22. doi:10.1016/j.cpr.2012.09.003

[4] Murphy, Kevin P. Machine Learning: A Probabilistic Perspective. The MIT Press, 2012, p. 1.

[5] “Random Forest® — A Powerful Ensemble Learning Algorithm.” KDnuggets. January 20, 2020. https://www.kdnuggets.com/2020/01/random-forest-powerful-ensemble-learning-algorithm.html

--

--

Ankit K C
Ankit K C

No responses yet