Unsupervised identification of the internal states that shape natural behavior

Adam J. Calhoun, Jonathan W. Pillow, Mala Murthy

Abstract

Internal states can shape stimulus responses and decision-making, but we lack methods to identify internal states and how they evolve over time. To address this gap, we have developed an unsupervised method to identify internal states from behavioral data, and have applied it to the study of a dynamic social interaction. During courtship, Drosophila melanogaster males pattern their songs using feedback cues from their partner. Our model uncovers three latent states underlying this behavior, and is able to predict the moment-to-moment variation in natural song patterning decisions. These distinct behavioral states correspond to different sensorimotor strategies, each of which is characterized by different mappings from feedback cues to song modes. Using the model, we show that a pair of neurons previously thought to be command neurons for song production are sufficient to drive switching between states. Our results reveal how animals compose behavior from previously unidentified internal states, a necessary step for quantitative descriptions of animal behavior that link environmental cues, internal needs, neuronal activity, and motor outputs.

Introduction

In neuroscience and ethology, researchers often attempt to map a stimulus directly to a response. However, animals are not simple input-output machines; their behavior is highly variable and modulated by "internal states" like hunger, arousal, or attention. A male fruit fly might respond to a female’s movement with a specific song one minute, but ignore the same cue the next. The challenge lies in the fact that these states are often invisible to observers. While external factors like walking speed can be measured, robust, unsupervised methods to identify how an animal’s internal "strategy" for processing information changes over time have been lacking. This study bridges that gap by introducing a model that infers hidden states directly from behavioral data.

Methodology: The GLM-HMM Framework

The researchers developed a hybrid model called the GLM-HMM (Generalized Linear Model - Hidden Markov Model). This framework treats behavior as a "mixture of experts," where each expert represents a different sensorimotor strategy.

  • The GLM component: Acts as a filter describing how sensory cues (e.g., distance to a partner) are integrated over time to predict a behavioral output (e.g., a specific song mode).
  • The HMM component: Traditionally assumes transitions between discrete states with fixed probabilities.
  • The Innovation: In this model, both the transitions between states and the behavioral outputs within those states are governed by GLMs. This means the probability of switching states is not random but depends on the sensory feedback the fly receives.
The GLM-HMM framework integrates sensory feedback to predict state transitions and behavioral outputs.

To train and validate this model, the study utilized a massive dataset of 2,765 minutes of courtship interactions from 276 pairs of Drosophila melanogaster, tracking 17 distinct feedback variables using a custom neural network tracker called "DeepFlyTrack."

Results: Three Latent States of Courtship

The GLM-HMM identified three distinct latent states that define the male fly's courtship behavior: "Close", "Chasing", and "Whatever". Crucially, these states are defined by different "strategies"—how the fly processes information—rather than just the actions themselves.

Identification of three distinct sensorimotor states ("Close", "Chasing", "Whatever") in Drosophila courtship and their associated strategies.

As shown in Figure 2, each state has a unique mapping from feedback cues to song modes. For instance, in the "Close" state (characterized by low speed and high proximity), increasing distance makes the fly more likely to sing. Conversely, in the "Chasing" state (high speed following), an increase in distance has the opposite effect. The "Whatever" state occurs when the flies are further apart and oriented away from each other, resulting in mostly no song.

Predictive Power and Neural Basis

The 3-state GLM-HMM demonstrated significant predictive power, capturing 84.6% of the information available in song patterning decisions. Compared to a standard GLM, it provided a 110% increase in predicting transitions between song modes.

The model also provided new insights into the neural basis of behavior. The researchers revisited the pIP10 neuron, previously categorized as a "command neuron" for song production. The GLM-HMM revealed that pIP10 activation does more than just trigger song; it biases the fly’s internal state toward the "Close" strategy, fundamentally changing how the fly responds to subsequent sensory feedback.

Conclusion

This unsupervised approach reveals how animals compose complex behavior from previously unidentified internal states. By showing that states represent distinct neural processing modes (or filters), the study provides a quantitative framework for linking environmental cues to motor outputs. Future work may expand this into hierarchical models to explore how higher-order states, such as hunger, modulate these lower-level sensorimotor strategies.

Summary updated

BibTeX
@inproceedings{calhoun2019unsupervised,
  author = {Adam J. Calhoun and Jonathan W. Pillow and Mala Murthy},
  title = {{Unsupervised identification of the internal states that shape natural behavior}},
  booktitle = {Nature Neuroscience},
  year = {2019},
  doi = {10.1038/s41593-019-0533-x},
}
Figure