Deep Learning Decodes Brain Signals to Identify ADHD

Using Math to Model Brain Activity

In front of you are three doors​,​ and you need to ​choose​. A new car hides behind one door, while a goat hides behind each of the other two. You point toward your selection, and someone who knows what lies behind each door must open one of the remaining doors, and it must be a door that hides a goat. You understand that the car is either behind the door you picked or the remaining closed door. Do you change your selection or stick with your first choice?​​​​

​​This well-known brain teaser is dubbed the Monty Hall problem. And it’s because of this conundrum that Álvaro López-Medrano entered the field of computational psychiatry and developed a tool that could change how​ doctors diagnose attention-deficit/hyperactivity disorder, ADHD.

Neuroscientists, neurologists, psychiatrists, and psychologists alike struggle to connect behavioral symptoms of psychiatric disorders such as ADHD with the neural mechanisms that underlie them. Those in the brain sciences search for reliable and accessible biomarkers that take the guesswork out of psychiatric diagnosis. López-Medrano and his ​startup ​company, ​​Bitsphi, are solving that problem for ADHD diagnoses by processing brain signals with an algorithm that picks up on patterns specific to the disorder.

Cognitive Models and Information Theories

When confronted with the three doors and a second chance to pick the right door, what do you do? The answer is it’s best to switch. There’s always a chance that in switching, you end up choosing the wrong door. But with two goats and one car, it’s more likely than not that your first choice is a goat. So once the other goat is revealed, it’s more likely that you’ll find the car when you switch doors.

The Monty Hall problem.

Sitting in his living room 10 years ago, López-Medrano grappled with the Monty Hall problem and its solution. López-Medrano, an electrical engineer, wrestled with the counterintuitive solution and began to think deeply about how the brain processes information and makes decisions. Exploring this topic sent him down a Google® Scholar rabbit hole. He jumped from paper to paper about the Monty Hall problem until he landed on one discussing a cognitive model based on Shannon’s information theory.

The theory creates a framework for communication: how a source transmits information to a receiver and the work done to connect and enable that exchange. But of the cognitive models drawing on this theory, López-Medrano didn’t find one that satisfyingly explained the differences between the basic ways the brain processes information: top-down and bottom-up. In top-down processing, your thoughts influence how you perceive and react to your environment, such as what you should pay attention to or how you react to a stimulus in different situations. Your brain analyzes sensory stimuli and then reacts in bottom-up processing. Thinking about this problem gave him new ideas about cognition.

Inspired, López-Medrano sought to develop a cognitive model that represented how the brain processed information, drawing on concepts from probability and information theory. His mathematical model of cognition seeks to explain information flow in the brain and how we go from uncertain to decisive.

He brought his model to Fernando Maestú, a cognitive neuroscience professor at the Complutense University of Madrid and director of the Center for Cognitive and Computational Neuroscience. Maestú studies the brain’s electrophysiological activity to search for biomarkers for neurological and psychiatric disorders.

Considering the model, Maestú thought it might be used as a new way to approach his work. He told López-Medrano they might be able to use the model to help diagnose cognitive disorders. He recommended starting with attention-deficit/hyperactivity disorder (ADHD), a common disorder needing an objective diagnostic tool. Globally, ​​over 84 million people have ADHD.

Getting to the Source

To diagnose psychiatric disorders, clinicians use the Diagnostic and Statistical Manual of Mental Disorders, Fifth Edition (DSM-5). Although experts base the diagnostic criteria on hundreds of scientific studies and white papers, there is an art to diagnosis. Many criteria are subjective. For example, one ADHD symptom in the DSM-5 is: ​“​Often does not seem to listen when spoken to directly​.” ​Definitions of “often” or what it looks like to listen to someone are subjective and vary between clinicians.

“We believe that if we look at the source of the problem, the brain, we might be able to make better diagnoses and make sure that children who need medication receive it and avoid prescribing medication to those who don’t.”

Clinicians also use results from cognitive tests to assess symptoms and diagnose psychiatric disorders. These tests gauge how well patients perform tasks designed to make use of the function of certain brain networks, such as the attentional or memory systems. But this method is also far from foolproof. “When someone has a heart condition, you tend to look at the heart, where the problem is​,” ​explains Sandra Ortiz Hernández, product manager at Bitsphi. ​“So, when we have a problem that is related to cognition in the brain, why are we looking at reaction times or how many letters this person can cross​?”​

Cognitive test results can​ also​ mask disorders. In some ​ADHD ​assessments, Ortiz says, a person ​with the disorder ​could perform very well and miss out on a diagnosis that could get them the treatment they need. People with ADHD may have other disorders, such as dyslexia, which may confuse diagnostic efforts. ​“​Comorbidities make behavioral testing difficult and sometimes misleading. ​It’s ​not a good method for everyone​,” ​she says.

Clinicians need a more precise tool. ​“​We believe that if we look at the source of the problem, ​the brain, we might be able to make better diagnoses and make sure that children who need medication receive it and avoid prescribing medication to those who ​don’t​,” says Ortiz.

These problems motivated López-Medrano and Miguel Blanco Carmona, ​CTO​ at Bitsphi, to explore whether their cognitive model had real-world relevance. ​“​We had a theoretical model​,​ but we needed some evidence that shows how the brain really works​,” ​says Blanco.

To create a tool that could determine if a child has ADHD, Blanco and López-Medrano needed to recruit children both with and without ADHD diagnoses. Then they record​ed​ the ​children’s ​brain activity ​to ​see if, based on their model, a statistical algorithm could differentiate between the two groups.

For these early tests, López-Medrano and Blanco recorded brain activity using magnetoencephalography, or MEG. Active neurons produce electrical activity​,​ which generates magnetic fields in the brain, and MEG scanners record the magnetic signals to map active networks.

They recruited children for these early tests and used Maestú’s MEG facilities to collect data. While in the MEG scanner, children completed a cognitive task that tested their attentional abilities to ​focus​ on relevant details and ignore irrelevant ones. In this ​“​go/no-go” ​task, as neuroscientists call it, a participant presses a button when they see a certain ​stimulus but​ holds back when they see an irrelevant one. ​Children ​with ADHD ​don’t ​usually perform as well​ as their neurotypical peers ​at suppressing their impulse to press the button.

Four images of the brain with lines of red and blue superimposed on top, showing the areas of high and low connectivity.

Differences in brain's functional connectivity between brain regions. Red indicates lower connectivity and blue indicates higher. (Image credit: Bitsphi Diagnosis)

Side-by-side line graphs with topographies of the brain.

(Left) The mean and standard deviation of the evoked response of a group of subjects to a stimulus and its spatial distribution at the sensor level. (Right) The differences between the pre- and post-stimulus amplitude. (Image credit: Bitsphi Diagnosis)

After two years, López-Medrano and Blanco collected MEG data showing brain connectivity and activity patterns from 40 children, 20 with ADHD and 20 without, while the children completed the go/no-go task. Based on previous neuroscience studies, López-Medrano and Blanco knew what neural circuitry they needed to evaluate: primarily, the dorsal and ventral attention networks. “The next step was to apply our mathematical modeling to the connectivity results we obtained from testing,” says López-Medrano. But they weren’t sure how best to do that.

López-Medrano and Blanco decided to apply to the MathWorks Startup Program for the technical support and expertise needed to get Bitsphi’s technology off the ground. Equipped with the MATLAB Suite from the startup program, they began testing their model and analyzing the brain data with Signal Processing Toolbox™ and MATLAB®. After these early tests, they determined their model accurately predicted which participants had ADHD diagnoses. “The control group performed better than the ADHD group on the go/no-go test,” says López-Medrano. “The data showed the connection between ventral and dorsal attention networks was much more efficient in the control group than in the ADHD group.”

While their model was successful, the team knew the model would never be commercially viable if it required data from MEG scans. MEG scanners are expensive, bulky, and hard to come by—in Spain, for instance, there are only three MEG scanners. Now the Bitsphi team is working to give their model a reality check.

From Lab to Life

Bitsphi looked to a classic brain imaging technology, electroencephalography (EEG). Scientists and doctors have been using EEG for over a hundred years to record electrical activity emanating from the brain. Though not as accurate as MEG, EEG is inexpensive, portable, and available in most hospitals. Through a cap studded with electrodes set tightly against the scalp, EEG records electrical activity from neurons in near-real time. But it lacks the spatial resolution of MEG, which is why the Bitsphi team started with MEG.

“MATLAB allows us to reduce our development efforts and focus on the core of our technology.”

“Now, we know what we are looking for, we know what regions are involved, and we are in a much better position to find what we want with EEG,” says Blanco.

The Bitsphi team is partnering with a network of hospitals in Madrid to recruit 150 adolescent participants to replicate their MEG results with EEG. To ensure they can find similar biomarkers of ADHD, they’re using MATLAB to translate between MEG and EEG data. “MATLAB allows us to reduce our development efforts and focus on the core of our technology,” says Blanco.

Next, they plan to use a form of artificial intelligence called deep learning to accelerate and automate diagnosis. The data from the EEG electrodes will be used to train a neural network in MATLAB to determine biomarkers based on the connectivity between brain areas. The neural network will streamline data processing, rejecting artifacts from muscle movement or eye blinks during EEG recordings, a task usually requiring a human expert. The resulting deep learning algorithm will compute the probability that a child has ADHD and help determine if the child has the hyperactive and/or inattentive subtype of ADHD.

Screenshot of the diagnostic tool developed in MATLAB. The interface includes images of two heads wearing an EEG electrode cap.

Clinician-facing MATLAB application showing various images of the EEG capture. (Image credit: Bitsphi Diagnosis)

As part of the MathWorks Startup Program, the Bitsphi engineers have worked with a MathWorks application engineer to brainstorm commercial directions for their technology and are using MATLAB to develop a clinician-facing application to display test results. The tool has a way to go before it’s ready for market, but López-Medrano envisions it as a diagnostic aid to complement rather than replace the clinician’s diagnosis. “This is something you would use for cases that aren’t clear,” he says, rather than using it to diagnose every patient.

López-Medrano ​says​ they expect to release their product​ in the next year or so​. From there, the Bitsphi team has set its sights beyond ADHD. ​“​The ​ADHD ​model could ​apply​ to other ​​disorders, such as schizophrenia or autism spectrum disorder​,” ​says Blanco. ​They’re ​already planning clinical trials with other disorders to evaluate connectivity patterns that could assist clinicians in diagnosis.

​​“​Using EEG, ​we’re ​going to be able to offer this as a worldwide solution available for everyone​,” ​says Blanco. ​“​​That’s ​our mission.”

Read Other Stories

Panel Navigation


Machine Learning Aids Neurosurgeon During Brain Surgery

Improving Parkinson’s Surgery with AI and Signal Processing

Panel Navigation
Panel Navigation


Machine Learning Brings Arrhythmia Treatment into 21st Century

Startup Brings Arrhythmia Treatment into the 21st Century