Depression, or depressive disorder, is a common disease. According to the World Health Organization (WHO), the number of people with depression was estimated at more than 300 million affected worldwide [1]. Depression may severely impact well-being and functioning at work, school, and family, and can even lead to self-harm. Adolescent depression is associated with mood disorders and severe mental illness in adult life [2, 3]. Nearly 0.8 million people die from suicide each year and suicide is the fourth leading cause of death in 15–19-year-olds, according to WHO [1]. Amongst the top major diseases causing disability or incapability, five are mental illnesses—depression being the most prominent of these [4]. Hence, the disease burden due to depression is vast. The prevalence of depression in the adult population is approximately 5% across cultures, and 20% in its milder forms (i.e., partial symptoms, mild depression, and probable depression) [5]. Among adults, those most at risk are within the middle-aged population. Also, the world-wide occurrence of depression is increasing, with a rise of 18% between 2005 and 2015. However, early professional intervention can improve mental symptoms (e.g., absence of self-confidence and rumination) and resolve somatic problems (e.g., gastrointestinal problems and sleeping disorders) in most of the cases [6, 7].

Early detection of depressive symptoms followed by assessment and treatment can considerably improve chances for curbing symptoms and the underlying disease; mitigate negative implications for well-being and health as well as personal, economic, and social life [7,8,9,10]. However, detection of depressive symptoms is challenging and resource demanding. Current approaches are mainly based on clinical interviews and questionnaire surveys by hospitals or agencies [11], where psychological evaluation tables are utilized to make predictions on mental disorder. This approach is mostly based on one-to-one questionnaires and can roughly diagnose the psychological disorder for depression.

An alternative approach to interview or questionnaire-based predictions of depression is the analysis of informal texts provided by users. Previous studies in clinical psychology have shown that the relationship between the user of a language (e.g., speaker or writer) and their text is meaningful and has potential for the future [12]. A recent study by Havigerová et al. indicate a potential for text-based detection of persons at risk for depression, using a sample of informal text written about a holiday [12]. Hence, online records and data are increasingly seen as a valuable data source in supporting health care with decision support. The approach to identify depression symptoms from informal texts is promising, as it allows for benefitting from recent advances in natural language processing and Artificial Intelligence (AI). AI applied for natural language processing employs linguistics and computing techniques to help machines to understand underlying phenomena such as sentiments or emotions from texts. In that case, the core intent is to analyse opinions, ideas, and thoughts via the assignment of polarities either negative or positive.

Previous work has found that automatic analysis of depression symptoms from texts can be applied in, for example, sentiment retrieval from suicide notes and detecting insulting or depressive words or sentences in conversations or blog posts [13,14,15,16,7,18]. However, there is still substantial untapped potential in research on extracting depressive symptoms from texts. Key challenges include portraying significant cues of depression from texts. Also, there is a substantial hurdle in detecting depression symptoms from short texts.

To contribute towards solving these challenges, we aim to develop an automatic algorithm for detecting depression symptoms in texts, using a text-based sample of young people seeking advice about self-perceived depressive symptoms. We believe our automatic detection approach, describing the problems of the users in natural language, can be a substantial contribution to this research field. Hence, the current study focuses on how symptoms of depression are manifested through text in natural language using AI.

To visualize sample data of different groups in different applications, Linear Discriminant Analysis (LDA) is a good tool for data visualization based on discriminations [19,20,21,22]. It works on grouping of samples of similar classes. It tries to find the directions where the classes are best separated by considering minimizing the within-class scatter while maximizing the between-class scatter. LDA has already been used in various practical applications such as facial emotion recognition and human activity recognition. LDA projects the sample data of different classes onto a lower-dimensional vector space. Thus, the ratios of the between-class scatter and the within-class scatter is maximized to achieve highest discrimination.

Deep neural network has been contributing a lot recently in enormous fields of research, especially in pattern recognition and AI [23,24,25,26,27,28,29,30,31,32,33,34]. Though it is more robust than typical neural networks, it however consists of two major disadvantages. The first disadvantage is overfitting problem most of the time. The last one is taking much time for modelling the underlying data. The first successful deep learning algorithm was deep belief network that consisted of Restricted Boltzmann Machines (RBMs) that made the training quite faster than other previous learning approaches. Later, convolutional neural networks (CNN) was proposed and got popular especially in image processing fields. It showed better discriminative power compared to other approaches. CNN also extracts features alongside training the data. It has some convolutional stacks to generate a progressive hierarchy of abstract features via convolution, pooling, tangent squashing, rectifier, and normalization [24]. CNN is mostly applied for image and video pattern analysis rather than temporal information decoding. Hence, it has not been adopted for time-sequential data analysis. Recurrent Neural Networks (RNNs) is however a better choice than CNN since it consists of better discriminative power over others in case of sequential data and pattern analysis [30]. Since the basic RNNs usually consist of vanishing gradient problem due to long-term dependencies when it handles high-dimensional and time-sequential data, Long Short-Term Memory (LSTM) was introduced in RNN to overcome it. Hence, this work utilizes the advantage of LSTM-based RNN to model different emotional states in text data.

Among different approaches to analyse physical and mental states of human being from different data sources, machine learning has been very widely used [35,36,37,38,39,40,41]. Since machine learning models are progressively being employed to do significant predictions in crucial contexts day by day, the demand of transparency rises in such contexts from the various stakeholders in AI industry [42]. The high risk in this regard is making and applying the AI decisions that are unjustifiable and lacks explanations of the models' behaviour. Hence, explanations of the output of a model are vital. For example, specialists in precision medicine fields need further information from the machine learning models than simple prediction for supporting their diagnosis. Such necessities may also arise in other fields as well, such as medical emergencies. Hence, focusing merely on the performances of the AI models, gradually makes the systems towards unacceptance in some cases. Therefore, current research has highlighted the importance of explainable Artificial Intelligence (XAI) for establishing trust in machine learning-based decisions through the explanations of the black-box models. Popular state-of-the-art explanation algorithms include Local Interpretable Model-Agnostic Explanations (LIME), SHapley Additive exPlanations (SHAP), and layer-wise relevance propagation (LRP). From which, LIME is very light-weight and yet tries to generate quick and satisfactory post-hoc explanations. Hence, this work adopts LIME to see the explanations (i.e., importance of the features) once the decision is provided by the model.


This work focuses on processing text data, features, and depression symptoms text recognition with the target of chatbot as a smart application. Figure 1 shows a schematic setup of a text-based depression symptoms text detection system in a smart application where a user provides a query in text format and a server processes the text to apply feature extraction and deep learning. Based on the results, the server can suggest further advices to the user. Figure 2 shows the basic architecture of the proposed system consisting of training and testing procedure for the classification of texts describing symptoms of depression. In the training part, text data from all the users is obtained and then the features are trained using RNN. In the testing part, features from a sample test are applied to the trained model to take the decision whether the user describes depression or not. LDA is applied to show the robustness of the proposed features compared to other traditional ones. Finally, we apply one of the most popular algorithms (i.e., LIME) for post-hoc, local, and meaningful explanations of the machine learning decision regarding the existence of a potential depression or not, in the text. The contribution of the paper can be summarized as bellow:

  • A large dataset of text is obtained from a public Norwegian online information channel:

  • Novel features are extracted representing the possible symptoms of depression defined by the experts from medical and psychology domains.

  • RNN is applied based on LSTM, attention, and dense layers for modelling the emotional states.

  • The machine learning decisions are explained using a state-of-the-art XAI approach, LIME to see the importance of the features.

Fig. 1
figure 1

A schematic setup for classifying texts containing symptoms of depression

Fig. 2
figure 2

Flowcharts of the proposed depression prediction system from text

Data collection and processing

To reliably detect symptoms of mental health issues, the collection of data for the detection model is crucial. For instance, data from social media such as Facebook status updates does not seem to be sufficiently detailed to develop reliable models to decode emotional states from data [43]. For this work, we obtained a large text-based dataset from a public Norwegian information website: At, youth have the opportunity to post questions anonymously in Norwegian about their various challenges and problems in their everyday life. In response, corresponding professional experts (e.g. doctors, psychologist, nurses etc.) provide answers and offer advise. These questions and answers are published online and publicly available for everyone. Prior to submitting a question on, young people pre-define and categorize the topic of their post. We focused herein on the category “Mental health and emotions”. Even if the texts are relatively short, they typically describe the activating factors leading to the mental state and the ensuing symptoms and behaviour. First, a proportion of the texts describe depressive conditions already diagnosed by a health professional. Second, many of the texts describe the narrative and the ensuing symptoms, either asking if it could represent depression or suggesting depression as a possible diagnosis. We believe these texts to present self-perceived depressive symptoms. Previous research suggest that self-perceived mental states correspond well with later clinical diagnoses [44,45,46]. Last, some of the texts describe the narratives and the succeeding mental states without mentioning a possible depression. The staff interpret the texts as describing symptoms of depression. Accordingly, the data is classified into categories, depression being one of them. Then, a trained GP went through the posts, confirming descriptions of depressive symptoms. A list of sentences and words are summarized analysing the messages in the database where they may indicate the person having depression. A medical practitioner validated the sentences and words. Table 1 shows some important features from “Appendix” representing the possible sentences and/or words may occur in the queries by the youth having depression.

Table 1 Some important sentences and words used for depression in Norwegian and English (translated)

The sentences and words are used to obtain features for each message of the dataset. Five translated and paraphrased examples of depression texts derived from a Norwegian text dataset at are shown in Fig. 3. The Norwegian dataset consists of 277,552 free-text posts in different categories including depression texts. From that dataset, we utilized 11,807 and 21,470 posts of different length for our two different experiments in this work. For feature extraction process to model depression and non-depression machine learning model, we augment all the feature rows of “Appendix” first. Then, all rows in the “Appendix” are tokenized word by word and stemmed for feature extraction process. The stemmed words from the list of symptoms are represented as F = "all hat meg alt er jæv … noe mer å lev for". To extract features from a text input, one-hot process is applied on the stemmed words of the input text based on each word of F (i.e., 1 if a word from F is present and 0 otherwise). Thus, the features for the texts represents binary patterns to be applied with machine learning model of depression prediction. The collection of 189 unique words extracted from the list of possible symptoms is shown in Fig. 4 where the words in Norwegian are in alphabetical order in Fig. 4a and the corresponding translated words are in Fig. 4b. Unique extractions of stemmed words are listed to illustrate the diversity of possible words associated with symptoms of depression.

Fig. 3
figure 3

Five translated and paraphrased examples of depression posts derived from the Norwegian dataset used in the work

Fig. 4
figure 4

Unique words extracted from the stemmed words of possible symptoms reported in APENDIX A: a Norwegian words in alphabetical order and b translated in English

The symptoms presented in “Appendix” are obtained with the help of Norwegian professionals (e.g., medical doctors and psychologists). However, the way of expressing the emotions in Norwegian texts may be linguistically different from other languages. Therefore, professionals in those languages can contribute to building dataset and features in modelling depression and non-depression. To be noted, the English texts are shown in Table 1, Figs. 3, 4, and “Appendix” only for the readability of international readers and researchers. Otherwise, whole approaches from input text to emotional state modelling via feature processing, is done based on the Norwegian language.

The main reason to go for using one-hot on the robust depression features rather than traditional ones such as typical one-hot and Term Frequency—Inverse Document Frequency (TF-IDF) [47] that are related to typical word frequencies rather than word importance is, the features describing depression symptoms are much more important than just word frequencies to predict depression in the text. Figure 5 shows the algorithm for one-hot feature extraction based on the unique feature words in the list of depression symptoms. Thus, the one-hot binary features based on the depression symptoms for the ith text in the dataset can be represented as Li.

Fig. 5
figure 5

The algorithm of one-hot depression symptom feature extraction

Linear discriminant analysis (LDA) for visualization

To visualize different features, we adopt linear discriminant analysis (LDA) here. LDA is basically an eigenvalue decomposition problem trying to maximize the inter-class scatterings of the samples whereas minimizing the inner-class scatterings of them. The formulas for the inter-class scattering, \(M_{B}\) and inner-class scattering matrix, \(M_{W}\) are shown as follows:

$$M_{B} = \mathop \sum \limits_{i = 1}^{c} N_{i} \left( {\widetilde{{m_{i} }} - m_{j} } \right)(\widetilde{{m_{i} }} - m_{j} )^{T}$$
$$M_{W} = \mathop \sum \limits_{i = 1}^{c} \mathop \sum \limits_{{m_{k} \in C_{i} }} \left( {m_{k} - \widetilde{{m_{i} }}} \right)(m_{k} - \widetilde{{m_{i} }})^{T}$$

where c is the total number of classes, \(N_{i}\) the number samples in class \(C_{i}\), \(m_{k}\) the feature vectors from class C, \(m_{i}\) the mean of class i, and \(m_{j}\) the mean of all feature vectors. The LDA feature space representing the optimal discrimination matrix can be found by maximizing the ratio of the determinant of \(M_{B}\) and \(M_{W}\) as

$$Q_{opt} = \frac{{\left| {Q_{{}}^{T} M_{B} Q} \right|}}{{\left| {Q_{{}}^{T} M_{W} Q} \right|}}$$

where Q basically represents the set of discriminant vectors. Thus, the discriminant ratio of inner as well as inter-class samples of different classes can be found by solving an eigenvalue problem as

$$M_{B} Q = \Lambda M_{W} Q$$

where \(\Lambda\) is the eigenvalue matrix in the singular value decomposition process. Figures 6, 7, 8, and 9 show the feature visualizations using 3-D plots of typical one-hot in LDA, typical TF-IDF in LDA, and proposed features in PCA, and proposed features in LDA features spaces, respectively. In the figures, the proposed features (i.e., Fig. 9) shows superior clustering of the samples of same class and better separation among the samples of different classes compare to the two other approaches, indicating the robustness of the proposed features in this regard. However, the traditional PCA projection on the features Thus, the text feature matrix F is projected to the LDA feature space \(Q_{{{\text{opt}}}}\) as

$$U = LQ_{{{\text{opt}}}}^{T}$$
Fig. 6.
figure 6

3-D plot after LDA on the traditional one-hot features of two emotional states

Fig. 7.
figure 7

3-D plot after LDA on the traditional TF-IDF features of two emotional states

Fig. 8.
figure 8

3-D plot after PCA on the proposed robust features of two emotional states

Fig. 9.
figure 9

3-D plot after LDA on the proposed robust features of two emotional states

Deep recurrent neural network (RNN) for modelling emotional states

Emotional states can be represented as time-sequential words in text data while conversating with others. Hence, a machine learning model capable of encoding time-sequential data is quite suitable for such kind of work. Hence, Recurrent Neural Networks (RNNs) is adopted in this work. RNN can be considered as most popular deep learning approaches used to model time-sequential information [22]. RNNs basically consists of recurrent connections between history to present state and hidden states. That is a quite important role of the memory in neural networks. The usual RNN algorithms very often face a vanishing gradient problem, a limitation of processing long-term data which is mostly known as Long-Term Dependencies. To overcome the problem, Long Short-Term Memory (LSTM) was developed [23]. Figure 10 shows a sample deep neural network consists of 50 LSTM units.

Fig. 10
figure 10

A basic structure of LSTM-based RNN

Each LSTM memory block has a cell state as well as three gates, which are input, forget, and the output gates. The input gate Ft can be represented as

$$I_{t} = \beta \left( {W_{LI} L_{t} + W_{HL} H_{t - 1} + b_{I} } \right)$$

where W is weight matrix, b bias vectors, and β a logistic function. The forget gate F can be expressed as

$$F_{t} = \beta \left( {W_{LF} L_{t} + W_{HF} H_{t - 1} + b_{F} } \right).$$

The long-term memory is stored in a cell state vector S that is expressed as

$$S_{t} = F_{t} S_{t - 1} + F_{t} \tanh (W_{LS} L_{t} + W_{HS} H_{t - 1} + b_{S} ).$$

The output gate V produces the output for the unit and can be expressed as

$$V_{t} = \beta \left( {W_{LV} L_{t} + W_{HV} H_{t - 1} + b_{V} } \right).$$

The hidden state H is expressed as

$$H_{t} = V_{t} \tanh (S_{t} ).$$

We adopt an attention layer over the LSTM units before applying dense layer [48] as

$$A\left( {att} \right)_{t} = LSTM\left( {H_{t} ,A\left( {att} \right)_{t - 1} } \right)$$

The attention technique is basically used for emphasising important information in the current task rather than other useless information. Hence, it can be applied on top of the LSTM layers to improve the model's accuracy. Finally, the output can be determined using a softmax function as

$$O = {\text{softmax}}\left( {W_{O} A_{O} + b_{O} } \right)$$

where W and b represent weights and bias, respectively. Figures 11 and 12 show the algorithms for training and prediction of depression or non-depression through RNN, respectively.

Fig. 11
figure 11

The algorithm of training features from all texts with RNN

Fig. 12
figure 12

The algorithm of testing of a test text message with the trained RNN

Experimental results and discussion

For experiments, two text datasets were obtained from the queries and answers from website. The dataset comprises of several categories including depression texts. The annotations of the messages were done with the help of professionals such as medical doctors and psychologists. All the experiments are done on a computer that has Intel(R) Core(TM) i7-7700HQ CPU with the speed of 2.80 GHz and 2.81 GHz, memory of 32 GB, Windows® 10 operating system, and TensorFlow deep learning tool version 2.4.1.

First dataset and experiments

From the whole collection of texts of different categories, 11,807 of them were extracted for the first dataset and experiments that consisted of 1820 texts categorized as depression texts (describing symptoms of depression) and the other 9987 as non-depression texts (not describing symptoms of depression). Tables 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 represent the classification reports of tenfold used in the experiments where each fold consist of 90% data as training and rest as testing. Figures 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 show the confusion matrices of each fold. Figure 23 depicts the accuracy and loss for 100 epochs during the training of the ten different folds. The overall training of the folds looks good except a little negligible fluctuation. Figure 24 shows the attention-based LSTM model used in this work where there are 53,358 parameters represented by an LSTM layer with 50 memory units, an attention layer, and a dense layer for 2 different emotional states (i.e., depression and non-depression).

Table 2 Classification report of fold-1 in the first dataset using proposed approach
Table 3 Classification report of fold-2 in the first dataset using proposed approach
Table 4 Classification report of fold-3 in the first dataset using proposed approach
Table 5 Classification report of fold-4 in the first dataset using proposed approach
Table 6 Classification report of fold-5 in the first dataset using proposed approach
Table 7 Classification report of fold-6 in the first dataset using proposed approach
Table 8 Classification report of fold-7 in the first dataset using proposed approach
Table 9 Classification report of fold-8 in the first dataset using proposed approach
Table 10 Classification report of fold-9 in the first dataset using proposed approach
Table 11 Classification report of fold-10 in the first dataset using proposed approach
Fig. 13
figure 13

Confusion matrix of fold-1 in the first dataset using proposed approach

Fig. 14
figure 14

Confusion matrix of fold-2 in the first dataset using proposed approach

Fig. 15
figure 15

Confusion matrix of fold-3 in the first dataset using proposed approach

Fig. 16
figure 16

Confusion matrix of fold-4 in the first dataset using proposed approach

Fig. 17
figure 17

Confusion matrix of fold-5 in the first dataset using proposed approach

Fig. 18
figure 18

Confusion matrix of fold-6 in the first dataset using proposed approach

Fig. 19
figure 19

Confusion matrix of fold-7 in the first dataset using proposed approach

Fig. 20
figure 20

Confusion matrix of fold-8 in the first dataset using proposed approach

Fig. 21
figure 21

Confusion matrix of fold-9in the first dataset using proposed approach

Fig. 22
figure 22

Confusion matrix of fold-10 in the first dataset using proposed approach

Fig. 23
figure 23

a Accuracy and b loss of 10-folds during experiments on the first dataset using the proposed approach

Fig. 24
figure 24

The emotional state model structure and parameters based on attention over LSTM units

Comparison with traditional approaches

We compared the proposed approach with traditional approaches where the proposed one showed superior results than others. We first applied traditional machine learning approaches using different features (i.e., typical one-hot, TF-IDF, and proposed features) with other conventional machine learning algorithms (i.e., logistic regression, decision trees, support vector machines (SVM), typical large artificial neural network (ANN), DBN, and CNN) but could not achieve more than 91% of mean accuracy as shown in Table 12. Furthermore, we tried LSTM with the traditional as well as proposed features to decode and model the time-sequential information to determine the emotional states. Table 13 and chart in Fig. 25 show the performance of three different approaches to the first dataset where the proposed approach shows the superiority by achieving 98% of mean accuracy over two other approaches.

Table 12 Prediction accuracy using different approaches to all subjects (%)
Table 13 Prediction accuracy using different approaches to all subjects (%)
Fig. 25
figure 25

Performance of three different approaches to the first dataset

Besides, another straight-forward approach was applied where the direct presence of the symptoms from “Appendix” was checked to take the binary decision of depression or non-depression. This approach was applied on the whole dataset rather than splitting into training and testing since it was a simple rule-based classification. The direct presence of one or more symptoms-based approach achieved the accuracy of 84.20% where 1684 depression texts were correctly classified among a total of 1807 depression texts and 1730 non-depression texts correctly classified among 10,000 non-depression text. Since there are different ways to express self-depression in texts of different length, it is hard to apply just a binary rule to determine the depression in the text. Hence, it is better to combine the base words from all the symptoms to define collection of features for depression to apply some complicated algorithms such as sequence-based machine learning algorithm using LSTM-based RNN that has been applied in this work.

Second dataset and experiments

For the second dataset, a total of 21,470 text samples were obtained consisting of depression—and non-depressions texts. From which, 1470 were depression texts and rest of the 20,000 were non-depression texts. We applied fivefold cross validation for the second phase experiments with the proposed approach, i.e. using RNN on the robust features. Only the results using the proposed approach is reported here since it showed the best results than the other approaches as shown in the experiments of the first phase, i.e. first dataset. Figures 26, 27, 28, 29, 30 represent the confusion matrices of fivefold used in the second experiments where each fold consist of 80% data as training and rest 20% as testing. The experimental results show a remarkable performance of the proposed features followed by one-hot and LSTM where the mean recall rate of depression and non-depression is 0.98 and 0.99, respectively. The mean accuracy is 0.99 that shows the robustness of the proposed approach.

Fig. 26
figure 26

Confusion matrix of fold-1 in the second dataset using proposed approach

Fig. 27
figure 27

Confusion matrix of fold-2 in the second dataset using proposed approach

Fig. 28
figure 28

Confusion matrix of fold-3 in the second dataset using proposed approach

Fig. 29
figure 29

Confusion matrix of fold-4 in the second dataset using proposed approach

Fig. 30
figure 30

Confusion matrix of fold-5 in the second dataset using proposed approach

In summary, the above experimental results show the overall efficiency of the proposed depression prediction system using depression symptom-based features and time-sequential LSTM-based machine learning model. The proposed system shows better results than existing latest approaches for depression prediction. For instance, in [12], the work is basically based on a measuring scale considering depression, anxiety and stress, which is a point-based measuring scale obtained by writing four different kind of letters by the candidates. The candidates collected by formal advertisements were asked to write these letters whereas in our database, the participants wrote the text spontaneously expressing their necessity to seek assistance over a national portal. The model used [12] is logistic regression, a simple and basic machine learning model which is usually simple linear model and hence, should not generally fit well where the sample data is distributed non-linearly. On the contrary, our work adopted time-sequential LSTM-based machine learning model that can separate both linearly and nonlinearly distributed samples from different classes. The proposed approach also overpowers other popular deep learning models such as DBN and CNN which are usually used for non-sequential event modelling.

XAI to explain the ML decisions

Humans are basically restrained to accept approaches that are not interpretable or trustworthy, pushes the demand for transparent AI to increase. Hence, focusing only on performance of the AI models, gradually makes the systems towards unacceptance. Though there is a trade-off between the performance and transparency of machine learning models, improvements in the understanding of the models via explainability can however lead to the correction of the model's deficiencies as well. Therefore, with the target of overcoming the limitations of accepting the current generation AI models, XAI should focus on machine learning techniques to produce more and more explainable models while upholding a high level of accuracy. Besides, they can also make it happen for humans to appropriately understand, trust, and manage the emerging AI phenomena as much as possible. Explainability is a main factor to gain confidence of whether a model would act as intended for a given problem. Most certainly, it is a property of any explainable model. Local explanations in AI models handle explainability by dividing the model's complex solutions space into several less complex solution subspaces which are relevant for the whole model. These explanations can utilize some approaches with the differentiating property to explain the model to some basic extent.

Most of the techniques of model simplification are based on rule extraction techniques. The most popular contributions for local post-hoc explanation is based on the approach called Local Interpretable Model-Agnostic Explanations (LIME) [35]. LIME basically generates locally linear models for the predictions of a machine learning model to explain it. It falls under category of the rule-based local explanations by simplification. Explanations by simplification builds a whole new system based on the trained model to be explained. Then, the new simplified model usually tries to optimize its resemblance to its predecessor model functions while reducing the complexity and at the same time, keeping a similar performance. Therefore, once the machine learning decision is obtained, XAI algorithm LIME is applied to see the importance of the features and probabilities towards the decision. Hence, we can understand the presence of the feature importance in the input for the decision, that helps understanding the outcomes of the system. Figure 31 shows the total class probabilities, top 10 features, their probabilities, and automatically highlighted features in a sample input text using LIME. As can be seen in right side of the figure, features towards depression get higher weights altogether than non-depression class, indicates the person to be in depression mode. The input text, features, and highlights were originally in Norwegian language since the database is from a Norwegian national portal to interact with youth, but the figure shows the corresponding translated text in English for better readability and understanding of the approach. According to the decision from machine learning model and explanations from LIME, the sample text consists of depression. To be noted, the ground truth for the sample text in the figure was the same as the model's prediction (i.e., depression), indicating the robustness of the model's decision and explanation.

Fig. 31
figure 31

Total class probabilities, top 10 features, their probabilities, and automatically highlighted features in a sample input text using LIME

Furthermore, Fig. 32 shows summarized probabilities of top 10 features for a paraphrased non-depression example text using LIME. In the figure, left side represents the original part after applying the algorithm and right side the corresponding representation in English for better readability as well as understandability. The overall probabilities of the non-depression text from the machine learning model for depression and non-depression classes were 0.001 and 0.999, respectively.

Fig. 32
figure 32

a Probabilities of top 10 features for a normal non-depression text (on the top) using LIME and b corresponding English on the right


To automatically detect depression symptoms in text for decision support in health care is important. In this work, a multimodal human depression prediction approach has been investigated based on one-hot approach on robust features based on describing depression symptoms and deep learning method, RNN. First, the young users' text data has been obtained from, a public information channel targeting young people in Norway. Then, one-hot method is applied after sequentially extracting the words from different sentences and words representing the symptoms of depression. Furthermore, the one-hot features have been applied to train a deep RNN based on LSTM method to model two different emotional states: depression and non-depression. Finally, the trained RNN has been used for predicting the underlying emotional state in unknown sensor text data. Using the proposed approach, 98% and 99% mean prediction performance has been achieved on first and second dataset consists of around 11,807 and 21,807 texts, respectively. Whereas, the traditional approaches could achieve maximum of 91% mean recognition performance, indicating the robustness of the proposed approach. The proposed approach outperforms the other traditional approaches such as using the proposed features with logistic regression, DBN, and CNN models as well as using typical one-hot and TF-IDF features with RNN. Besides, an XAI algorithm, LIME has been utilized to see whether the proposed system generates meaningful explanations to support its decision. Thus, the features used in this work can be used to support the machine learning decisions and to contribute to design effective user interface for better affective care. The deep learning-based efficient system can be explored in greater levels with comprehensive dataset. Detection of depression symptoms in texts can be applied in mental health care services for real-time analysing and predicting normal as well as severe states of mood disorders in smart environments combined with latest technologies. For instance, smart chatbot systems providing informational support about depression can be a feasible solution for both health professionals working with youth and youths struggling with mental health issues.