Finding Neural Patterns in the Din

A new algorithm, called seqNMF, can detect sequences in neural data generated by 'internal behaviors,' such as an animal thinking or sleeping.

Listening to Mozart’s iconic “Turkish March,” it’s easy to pick out the motifs that recur throughout the piece. But identifying that string of notes would be much more challenging if the music were played through a radio with static, if it were sped up or slowed down, or if lots of notes were missing, says György Buzsáki, a neuroscientist at New York University.

That’s the task that neuroscientists are often faced with. They want to find sequences of neural activity — neurons that fire in a given pattern — that are tied to navigation, decision-making, memory and other cognitive processes. But they must sift through noisy or piecemeal data.

A new algorithm, called seqNMF, provides an efficient way to identify sequences without knowing anything in advance about the sequences themselves or the conditions that generated them. “This method allows you to extract structure from the internal life of the brain without being forced to make reference to inputs or output,” says Michale Fee, a neuroscientist at the Massachusetts Institute of Technology and investigator with the Simons Collaboration on the Global Brain. Fee’s team developed the algorithm in collaboration with that of Mark Goldman, a computational neuroscientist at the University of California Davis and SCGB investigator. “I think it will be a powerful approach for that.”

Young zebra finch (left) learns songs from its father (right)
Zebra finches sing stereotyped songs, which they learn from from their fathers. Image courtesy of Georg Kosche

To date, the easiest way to find neural sequences has been to look for activity patterns tied to an external behavior. For mice running in a maze, scientists align neural activity to the animal’s location. They can then pull out a clear sequence that repeats every time the animal traverses that maze. Birdsong is another example — adult songbirds produce sequences of activity when they sing, which scientists detect by aligning neural signals to a particular syllable of a song.

Uncovering neural sequences that are not tied to a sequential activity is much more challenging. Buzsáki and collaborators published one of the first examples in 2008, demonstrating that animals displayed different neural sequences depending on whether they planned to turn left or right in an upcoming part of a maze. A number of other groups have since reported similar findings, theorizing that these sequences are tied to memory. “That suggests there is something fundamental about encoding things in the world and in memory in a sequential manner,” Goldman says.

Existing methods for detecting patterns in noisy data rely on one of three basic approaches. The simplest is a brute-force search for repeated patterns, but such methods can be computationally prohibitive. When studying a stereotyped behavior,  aligning neural activity with the behavior and averaging activity across trials is the most efficient approach. In the absence of stereotyped behavior, such as when an animal is sleeping or simply thinking, researchers commonly find patterns by detecting constellations of neurons that tend to fire at the same time.

However, by focusing on which neurons fire together at a certain time, these methods ignore a lot of information, such as whether those two neurons tend to fire in a certain order. “When two neurons never fire at the same time but often fire one time-step apart from each other, that information is completely lost in preprocessing by most of the standard techniques,” says Goldman. “What else is in our data that we throw away when we use these techniques?”

A song is born

Fee’s lab is trying to understand how neural sequences linked to birdsong emerge during development. Neural activity in young birds, which haven’t yet learned a stereotyped song, is much noisier than in adult songbirds. His team has recorded activity from hundreds of neurons in young birds as they learn their song. But without a stereotyped song to align neural activity, they struggled to identify sequences, Fee says. “We had beautiful data and no idea how to understand what’s going on in there,” Fee says.

SeqNMF, developed by Fee, Goldman, Emily Mackevicius, Andrew Bahle and collaborators, evolved out of a project at the Methods in Computational Neuroscience summer course at the Marine Biological Laboratory in Woods Hole. (SCGB helps support this and other courses.) In search of a way to make sense of complex datasets from immature birds, researchers uncovered a paper from 2004 that outlined a modified version of a technique called non-negative matrix (NMF) factorization.

NMF is a general framework for extracting signals from data by detecting repeated patterns. It is used a number of applications, including processing calcium imaging signals. Traditional NMF ignores time information, but the modified version, convolutional NMF, makes it possible to look for patterns that unfold over time.

Mackevicius and collaborators adapted the convolutional NMF algorithm, designed to find patterns in speech, to analyze neural data. “Instead of looking for repeated speech sounds, we looked for repeated brief temporal patterns of neural activity,” Goldman says. They also fixed some flaws that emerged when applied to noisy neural data — the algorithm would mistakenly split one sequence into two or give the same sequence two different labels. The researchers incorporated penalties for these events into the algorithm, then validated it on fake datasets. They also tested it on Buzsáki’s original dataset from 2008.

By clicking to watch this video, you agree to our privacy policy.

Mackevicius, who presented the research at the Cosyne meeting in Denver in March, used the algorithm to study neural activity in birds that had never been schooled in how to sing. “It was unclear if they form sequences like adult birds or if they are more like juvenile birds before learning a song,” she says. It turns out these birds do form sequences, but they deploy them in an unusual way. While typical birds run just one sequence at a time, the untutored birds might have two or their sequences might stutter.

Fee and collaborators are now using seqNMF to study how neural sequences emerge as birds learn their song. Based on previous work, the researchers had predicted that tutoring would trigger the formation of a sequence. However, preliminary analysis suggests that sequences exist in this region even before the bird has listened to a tutor song.

Chart showing raw neural activity: Raw neural activity recorded from 75 cells during birdsong (top) shows no obvious sequences. But seqNMF extracts three sequences, w1, w2 and w3 (bottom left). Researchers can then arrange neurons (each row represents one neuron) according to the sequence they belong to and when in that sequence the neuron fires (bottom right).
Raw neural activity recorded from 75 cells during birdsong (top) shows no obvious sequences. But seqNMF extracts three sequences, w1, w2 and w3 (bottom left). Researchers can then arrange neurons (each row represents one neuron) according to the sequence they belong to and when in that sequence the neuron fires (bottom right). When aligned with a spectrogram of the song (middle) it’s clear that sequence w2 occurs with certain song syllables (*). Credit: Emily Mackevicius/Fee lab

Other researchers now plan to use seqNMF to search for sequences in different types of neural data. “We can start looking at patterns where you don’t have any expectations, such as during sleep,” says Buzsáki. Existing research examining neural sequences during sleep focuses on patterns that occurred when the animal was awake. But there may be many more sequences that had previously gone unrecognized. “Before, we looked for a repeating template in sea of randomness,” Buzsáki says. “But maybe the sea is not random.”

Mackevicius reports that she’s already received a number of inquiries about the algorithm, which is available on GitHub. “A lot of people have a case where they think sequences are there but are not sure how to find them in an unsupervised way,” she says. (A tutorial on SeqNMF is available here.)

The algorithm isn’t just useful for studying neural activity. Fee’s team has used seqNMF to find sequential patterns in song spectrograms. Others are interested in using it to detect repeated patterns in behavior. “If you can parse behavior into repeated patterns, you can look at what happens on each repeat of the pattern in the brain,” Mackevicius says.

Goldman is looking forward to applying the technique to many different types of data. In many cases, existing analysis techniques will have discarded potential sequences, which can be mistaken for noise, he says. “I think the possibilities are enormous.”