Medicine: Psychiatry:


Classifying Bipolar Personality Disorder (BPD) using LSTM

(Long/Short-Term Memory)


by Sreyan Ghosh, Kunj Pahuja, Joshua Mammen Jiji, Antony Puthussery, Samiksha Shukla,[ preceeding of the CHRIST (Deemed to be University), Bangalore, India

{gsreyan, kunjpahuja, jomonjiji,  frantony},], and Aynur Unal of the École de Technologie Supérieure,


Link for Citation Purposes:



Abstract. With the advancement in technology, we are offered new opportunities for long term monitoring of health conditions. There are a tremendous amount of opportunities in psychiatry where the diagnosis rely on the historical data of patient as well as the states of mood that increase the complexity of distinguishing between bipolar disorder or borderline disorder during diagnosis. This paper is inspired by prior work where the symptoms were treated as a time series phenomenon to classify disorders. This paper introduces a signature-based machine learning model to extract unique temporal pattern that can be attributed as a specific disorder. This model uses sequential nature of data as one of the key features to identify the disorder. The cases of borderline disorder that are either passed down genetically from parents or stem from exposure to intense stress and fear during childhood are discussed in this study. The model is tested with the synthetic signature dataset provided by The Alan Turing Institute in signatures-psychiatry repository. The end result has 0.95 AUC which is an improvement over the last result of 0.90 AUC.


Keywords: BPD (Borderline Personality Disorder), LSTM (Long Short Term Memory), RNN (Recurrent Neural Network), GRU (Gated Recurrent Unit), AUC.


1   Introduction

In this modern age of fast-paced work life and intensive workload, our society is slowly crawling towards a mentally ill dystopia. Borderline Personality Disorder (BPD) is one of the most common mental disorders among them and proliferates at a tremendous rate among the youth these days.


Statistics show that about 9.1% of the psychiatric population in the US suffers from personality disorders, out of which 1.4% constitutes of the BPD. The women to men ratio [1] suffering from BPD is 3:1. In Bengaluru, India, the technology capital of the country, a statistical report by the National Crime Records Bureau, shows that 35 out of every 100,000 people commit suicide due to mental Disorders. Most of the diagnosis [2] done for psychiatric disorders has been hindered based on the retrospective approaches which include studying the abnormal behavior of the patient and the difficulty they experience with their mood swings. The shortcomings of the retrospective diagnostic categories and the severity of these disorders have prompted several pieces of research to enhance current diagnostic methods. In the span of the past few years the technology has foreseen a tremendous evolution, and with the advancements in mobile phones everyday has opened our world to a whole new level of advancements. It has also spread its roots to the domain of psychopathology and enabled it to take more precise measures for the subjective concepts. The challenging task is analyzing the data produced. Since most of the data generated are sequential in nature where most of the information is contained in the order at which different events occur.


This paper discusses LSTM (Long Short Term Memory) model developed to re-analyze the synthetic data provided in GitHub repository for signature-based machine learning model for bipolar disorder and borderline disorder[3]. This research sought to classify the borderline personality disorder in patient on the basis of their mood patterns over a period of time. This research used LSTM an artificial RNN (Recurrent Neural Network) architecture, as it provides us with the feedback connections and can process entire sequences of data.


The paper is organized as follows: section 2 address the literature survey on Borderline Personality Disorder (BPD), Section 3 gives an overview of the data, Section 4 gives an overview of the methodology used in the proposed research, Section 5 details the Discussion and results. Section 6 presents the conclusions and limitations of the research work.


2   Literature Survey

In the paper [4], the author has mentioned bipolar disorder as Major Depressive Disorder (MDD) which affects the quality of life of most of the patients suffering from the borderline disorder. Traditionally the treatment of MDD depends on the criteria mentioned in the Diagnostic and Statistical Manual of Mental Disorders (DSM) which offers certain steps and criteria to classify borderline disorders. In this paper it is shown how these criteria can sometimes be vague and ineffective in treating the borderline disorders faced by a set of patients. So to tackle this problem the researches of this paper tried the concept of Neuroimaging which provides various functions of the brain and its structure which can be very useful for getting the state of a patientfs brain when they are suffering from disorders and which can further help to detect future symptoms. In this paper, the researcher has made use of machine learning classification algorithms and using the data collected from 63 MRI machines.


In the paper [5], the main problem of borderline disorders being wrongly diagnosed or not diagnosed at all is pointed using the traditional method of consultation. The problem is that most of the time professional consultants are not able to properly diagnose the borderline disorder being faced by a patient, and consultants cannot take many other constraints to detect the early stages of borderline disorders, hence an artificial intelligence approach is taken to classify unipolar and bipolar depressive disorders. In this paper, the researchers used to methodology, one Particle Swarm Optimization (PSO) algorithm for Feature Selection (FS) process for the elimination of less informative and fewer discriminant features, and Artificial Neural Networks (ANN) for the training process. And the result of this paper shows the vital performance of the ANN–PSO approach expressed that it is conceivable to segregate 31 bipolar and 58 unipolar subjects utilizing chosen highlights from alpha and theta recurrence groups with 89.89 % in general order precision.


In paper [6], the author has explained about the bipolar disorder, a brain disorder that affects the brain of the patients which is also well-known as manic depression. When a patient is suffering from bipolar disorder it noted that therein is the symptoms of mood swings and deep state of depression in the patientfs behavior. This paper also puts forward how many studies and research have shown that genomics is capable of the detection and treatment of bipolar disorder. Researchers of this study used many deep learning algorithms and came up with an end to end deep learning model called DeepBipolar which is used to predict bipolar disorder using genomic data. DeepBipolar embraces the Deep Convolutional Neural Network (DCNN) design that concentrates on highlights from genotype data to anticipate the bipolar phenotype.

In [8], the original work from where our data was taken the authors used Random Forests to distinguish between Healthy, Borderline and Bipolar Personality Disorder, taken in groups of 2. The authors achieved an AUC of 0.919 for the code results of the synthetic data provided in the Alan Turing GitHub website and an accuracy of 93% as mentioned in the paper. IN [9] and [10], MRI data has been used to classify individuals between borderline personality disorder and healthy controls, obtaining an accuracy of and 80%[9] and 93.55%[10], although the small sample size should be kept in mind for the latter. In [11], the author has used a non-linear predictive model based on multilayer perception to predict BPD.


3   Data

The Data was obtained from Alan Turing's github repository [7] named gA signature-based machine learning model for bipolar disorder and borderline personality disorderh. The data used in the proposed work is synthetic data obtained from the work in [10].BY synthetic data we mean data that was generated to exhibit the same statistical properties as the original data, without containing the original entries. The synthetic data in this repository was derived from the signatures of the original mood score data, and is therefore in signature form itself. Each dataset contains mood score signatures and their associated diagnostic classification. Data was captured from 130 individuals who took part in AmoSS study. The dataset originally had 48 patients with bipolar disorder, 31 patients with borderline personality disorder and 51 healthy volunteers. Data was collected over a period of 3 months, although 61 out of the total 130 patients gave data for 12 months. For the proposed work we were mainly focused on borderline personality disorder and healthy volunteers.


4   Methodology

In this section of the paper, We will be discussing about the proposed model, control measures taken to prevent the Overfitting of model, Bi-GRU, Attention, Bi-LSTM, Cyclic Learning Rate


















4.1   The Model

The model proposed to distinguish between borderline personality disorder and a healthy person is a GRU (bidirectional)-LSTM(bidirectional)-Attention model trained with Cyclic learning rate and Adam optimizer with a maximum learning rate of 0.005 and a minimum learning rate of 0.001. The first layer is 128 node LSTM(Long Short Term Memory) layer, followed by a 64 node GRU (Gated Recurrent Unit) layer. This GRU layer further goes through Attention Mechanism which finally gives itfs output to a 64 node Dense layer, followed by a single node layer with sigmoid activation for classification.


4.2   Control Overfitting

Keras Model Checkpoint was used to control overfitting. Keras Model Checkpoint callback method saves the model after every epoch and with the save_best_only hyperparameter the best model is not overwritten. Later for prediction the best model after the training can be called and used for future predictions.


4.3   Bi-LSTM

LSTM, commonly known as long short term memory networks learn long-term dependencies in the data. A bidirectional LSTM learns bidirectional long-term dependencies between each time step in time-series or sequential data. The learning algorithm is fed once from the beginning to the end of the layer and once from the end to the beginning of the layer. This way the LSTM learns faster and better.


4.4   Bi-GRU

GRU, commonly known as Gated recurrent Unit, is a modification over LSTM which has just two gates, namely the reset gate and the update gate. Bi-GRU similar to Bi-LSTM learns through both forward and backward propagation.


4.5   Attention

The attention mechanism has been proved to be quite useful in domains such as machine translation, sequence predictions and so on. The attention mechanism basically helps the model to understand the totality of the sentence by disregarding the noise and focus on what's important.


4.6   Cyclic Learning Rate

Cyclic Learning Rate is used to train a neural network with a learning rate that changes in a cyclic way for each batch of training instead of setting it to a constant value. The learning rate schedule varies between two preset bounds. This helps to come out of a saddle point or local minima faster and leads to convergence at much lesser epochs.


5   Results and Discussions

The model was trained for 50 epochs on an i7 CPU with Keras Model Checkpoint callback to avoid overfitting. The final AUC attained was 0.95 and accuracy attained was 98%. In the following ROC curve, x-axis denotes false positive rate and y- axis denotes true positive rate. The ROC curve tells us how well the model can distinguish between both the classes. The AUC or Area Under the Curve is 0.95 which states that the model can clearly distinguish between normal and BPD.











Fig. 2. Performance Analysis (AUC-ROC Curve)



6   Conclusion

The proposed model is trained on synthetic time series data and have verified its performance. The AUC achieved is appreciable over the other existing model. A similar architecture can be extended to other clinical problems with signature-based temporal data . A deeper model with more layers might lead to overfitting. However perfectly tuned callbacks and appropriate number of training epochs with tuned drop out after every layer might lead to better results.


Modern methods like neural architecture search can also be used to tune several hyperparameters of a deep learning model leading to better results which remains a part of our future work. This paper also shows the ability of deep learning techniques to distinguish between BPD and healthy using signature based mood data. Extending the proposed work and similar deep learning architectures to distinguish between Borderline Disorder and BPD and Borderline Disorder and Healthy individual remain a part of the future scope.



1. I. P. Arribas, K. Saunders, G. Goodwin, and T. Lyons, gA signature based machine learning model for bipolar disorder and borderline personality disorder,h 2017, arXiv preprint arXiv:1707.07124

2. -disorders.shtml

3. "The Economic Times." [Online]. Available: https:// economictimes. mental- health- day- nearly- half- of- india- inc- employees- suffer- from- depression/articleshow/66119215.cms

4. Shuang Gao, Vince D. Calhoun, Jing Sui gMachine learning in major depression: From classification to treatment outcome predictionh 2018

5. Turker Tekin Erguzel, Gokben Hizli Sayar, Nevzat Tarhan gArtificial intelligence approach to classify unipolar and bipolar depressive disordersh 2016

6. Sundaram Laksshman, Rajendra Rana Bhat, Vivek Viswanath, Xiaolin Li gDeepBipolar: Identifying genomic mutations for bipolar disorder via deep learningh 2017

7. psychiatry

8. A signature-based machine learning model for bipolar disorder and borderline personality disorder

9. Sato, J. R. et al. Can neuroimaging be used as a support to diagnosis of borderline personality disorder? An approach based on computational neuroanatomy and machine learning. J. Psychiatr. Res. 46, 1126-1132, 2012

10. Xu,T., Cullen, K.R., Houri, A.,Lim,K.O., Schulz, S.C.and Parhi, K.K. "Classification of borderline personality disorder based on spectral power of resting-state fMRI," 2014 36th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Chicago, IL, 2014, pp. 5036–5039

11. Maldonato, Nelson M., et al. "A non-linear predictive model of borderline personality disorder based on multilayer perceptron." Frontiers in psychology 9 (2018): 447





A Note on Who Funds This Journal: We Accept No Advertising, No Government Grants and No 'Foundation' Grants


We Are An Independent Organization Publishing Independent Media 100% Funded by Our Members.


If You Are Not Yet a Member, You Can Join Immediately:

Membership Registration Link »



Full (or Fellow) Membership in the BWW Society/Institute for Positive Global Solutions puts a high emphasis on perceptive minds and each person's capability to see beyond general, sterile, politically correct views. It focuses on those whose open minds reflect the determination to break down the monopolistic sledgehammers of the lobbies that would have the world see things as they do and in their own interests. 


Membership is available only to people with the qualifying criteria described above, and papers submitted for publication in the Society's journals must be of a high standard and meaningful to academic and layman alike where possible.


Because of this, many view membership in the BWW Society with a marked degree of significance in their lives, and as a pathway to a statement of their dissatisfaction with what has been going on which has led to global social and political instability, heading for general chaos, massive upheavals in populations and seemingly endless wars.


For many, the hope that their intensive effort might just find the right readers in the right places to carry their thoughts through, is of itself a beacon in their lives.


BWW Membership not only reflects each Memberfs commitment to the future but their high standing as an independent thinker.


Your dedication to presenting solid solutions to global challenges which are so sadly lacking in our overcautious institutions with their intrinsic fears, is a much needed effort worth cultivating.  Our platform -- based on the crucial interchange of ideas, across the board from great scholars to fine lay minds -- is a valid, purposeful instrument for innovation and free thought. BWW Membership reflects not only each Member's commitment to the future but their high standing as an unrepentantly independent thinker.


With all of the above in mind, you are invited to join us and Register your  Membership for the current term:


Membership Registration Link »



As a Member, you are also encouraged to submit articles, papers or commentary pieces for inclusion in our publication, the Journal of Global Issues & Solutions. Finer readers would be difficult to get together in any one place.


We need every support we can get to continue with the movement and your own is another spark in this ambitious project which only you can realize at this moment in time.


The BWW Society/Institute for Positive Global Solutions is an international interdisciplinary multi-cultural forum based on the exchange of free thought and creative ideas, and stands as a challenge to the regimented, politically correct presentations we see too much of today.


Membership is comprised of academics, business leaders, physicians and researchers, scientists, artists, writers, civic leaders, theologians, professionals, and others whose forward-thinking minds and innovative thoughts are brought together as a collective conscience for the breaking out of our constrained and restrictive societies.


You are invited to join today via the link below:


Membership Registration Link »