Scientists have trained a computer program to identify people with suicidal thoughts based on their brain scans. The study is small, but the method could one day be used for diagnosing mental health conditions, researchers say.

Nearly a million people worldwide die by suicide every year, and predicting suicide remains difficult, especially because many people feel uncomfortable talking about the issue. In a study published today in the journal Nature Communications, researchers observed the brain activity of two groups of adults — one who had suicidal thoughts and one who didn’t — while they thought about words such as “evil” or “praise.” They fed this data to an algorithm that learned to predict who had suicidal thoughts with 91 percent accuracy. It also predicted whether someone had attempted suicide before with 94 percent accuracy.

The algorithm isn't perfect — and a medical test would have to be. It may also not become widely used since brain scans are expensive. But “it’d be nice to have this additional method,” says study author Marcel Just, a psychologist at Carnegie Mellon University.

Thirty-four volunteers participated in the study: 17 with suicidal thoughts and 17 without. The volunteers read 30 words that were either positive (“bliss”), negative (“cruelty”), or related to death (“suicide”) and thought about the meanings while undergoing a type of brain scan called fMRI.

Whenever we think about a given subject, our neurons fire in a specific way, says Just. Your neurons might fire in one pattern for the word “hammer,” for example, and in another pattern for “dog.” Measuring patterns like this is more accurate than other brain studies that only look at the general brain region that is activated.

Researchers found that the responses to six words — “death,” “trouble,” “carefree,” “good,” “praise,” and “cruelty” — showed the biggest differences between the two groups of participants. So, they gave a machine-learning algorithm these results for every person except one. For any given word, they told the program which neural activation patterns came from which group. Then, they gave them the missing person’s results and asked the algorithm to predict which group the person belonged to. The machine got it right 91 percent of the time. In a second experiment, scientists used the same methods to teach an algorithm to distinguish people who had attempted suicide from those who hadn’t, this time with 94 percent accuracy.

Blake Richards, a neuroscientist at the University of Toronto, says the results are interesting, but may not be strong enough to make the test useful for diagnosis. And the activity patterns are still correlation, not causation. “There is undoubtedly a biological basis for whether someone is going to commit suicide,” he says. “There’s a biological basis for every aspect of our mental lives, but the question is whether the biological basis for these things are sufficiently accessible by fMRI to really develop a reliable test that you could use in a clinical setting.” The accuracy of the results may be high, but in order for the program to be useful in a clinical setting, and to justify any type of medical intervention, it would need to be basically perfect, he says.

Just acknowledges that the small number of participants is a limitation of today’s research. Still, he believes that in the future the algorithm could be used to diagnose people with suicidal thoughts, or even to check whether treatments for psychiatric disorders are working. To improve the accuracy of the algorithm, he’d like to do more research with more volunteers, and also try to distinguish between people who have been diagnosed with specific psychiatric disorders.