Sperling Medical Group

reading & research

Artificial Intelligence in Medicine: Predicting Mental Illness Based on Facebook Posts

Sharing who we are, what we think, how we feel, etc. is human nature. We want to be connected with others. We are curious to learn from them, from simple information to what it means to be human.

Today, social media platforms like Facebook have exploded the number of people with whom an individual can connect. Their network can expand exponentially with hundreds of people whom they never personally meet! The algorithms that drive social media create a vast forwarding matrix, and along with it, potential unpleasant exposure. For instance, jobseekers have lost employment opportunities over the hiring manager “spying” something objectionable on social media.

Artificial intelligence meets psychiatric diagnosis

Machine learning is a type of artificial intelligence (AI) that trains computers to learn and improve upon previous experience. By applying a set of rules to a large amount of data, computers can acquire the ability to recognize and identify patterns, anticipate requirements and perform tasks at lightning speed.

Let’s take employment opportunities for a good example of a machine learning application. Services like ZipRecruiter increasingly depend on AI to make positions available, screen applicants, and connect with those who seem best suited and qualified. “Often trained on data collected about previous or similar applicants, these tools can cut down on the effort recruiters need to expend in order to make a hire. Last year, 67 percent of hiring managers and recruiters surveyed by LinkedIn said AI was saving them time,” reports Vox.com.

Just as AI can facilitate pinpointing the right person for a job, research is ongoing to explore its use as support evidence for accurate psychiatric diagnosis. Machine learning has been studied as a way to analyze Facebook language to predict depression in medical records.[i] Now, a new study explores the use of machine learning to detect symptoms of schizophrenia spectrum and mood disorders in late adolescence and early adulthood based on Facebook posts as well as Facebook messenger.

To address this, a team of psychiatric and AI researchers trained a machine learning program by inputting 3,404,959 Facebook messages and 142,390 images across 223 voluntary participants (average age 23) who had been diagnosed and hospitalized with schizophrenia spectrum disorders (SSD) or mood disorders (MD).[ii] Study participants also included healthy volunteers (HV) for comparison. Among those who were hospitalized, the team analyzed messages up to 18 months prior to hospital admission. The authors noted the importance of including Facebook messenger, given that status updates may be geared toward a larger audience, while “…messenger represents private communication between two or more individuals and likely characterizes a more unedited and unfiltered form of text-based communication.”

Based on the content of posts and messages, the computer was programmed to recognize and classify language features such as use of sensate words (touch, see, hear, etc.), emotional language (positive or negative feelings), swear words, biologic process words (blood, pain), and grammar structure/punctuation. It was also taught to recognize patterns of posted images (size, color palette, etc.).

Based on the classifier’s results, the researchers found that throughout the study period, those with SSD generally expressed negative emotions more than HV. Both SSD and MD used more swear words than HV, while MD used more biological process words. Then, closer to the date of hospital admission, patterns escalated. Both SSD and MD used negative emotions, swear words, and punctuation more frequently vs. HV.

Study conclusion and a caution

The authors concluded that, “Machine-learning algorithms are capable of differentiating SSD and MD using Facebook activity alone over a year in advance of hospitalization.” To put it another way, since mental illness can become apparent during adolescence and into the early 20’s, a person’s educational, social and career development during that period of life may be disrupted. As one instrument of social connection, it seems reasonable that a psychologically fragile young person’s participation in Facebook would manifest his or her troubles.

When analyzed by machine learning trained to detect and identify specific cues, Facebook becomes a sort of open book into a process of decreasing mental/emotional wellness. In fact, according to the authors, “Utilizing technology to assist in identifying and monitoring individuals with mental illness is a quickly advancing field.” From the standpoint of mental health professionals, there is value to gaining a more objective view of an individual’s psychology through the history of what they post on social media, since a person’s subjective self-report may occur in isolation of other life contexts. This can assist in the evaluation, aiding diagnostic accuracy. However, the potential for privacy violations and non-consensual personal data collection by unscrupulous parties raises tremendous caution.

The authors emphasize the need to address the challenges of privacy protection and patients’ rights. As with all AI applications in physical and mental healthcare, ethics and morality demand that such tools not only avoid putting patients at risk, but actively benefit each person’s healing journey.

NOTE: This content is solely for purposes of information and does not substitute for diagnostic or medical advice. Talk to your doctor if you are experiencing pelvic pain, or have any other health concerns or questions of a personal medical nature.


[i] Eichstaedt, J. C. et al. Facebook language predicts depression in medical records. Proc. Natl Acad. Sci. USA 115, 11203–11208 (2018).
[ii] Birnbaum, M.L., Norel, R., Van Meter, A. et al. Identifying signals associated with psychiatric illness utilizing language and images posted to Facebook. npj Schizophr 6, 38 (2020).