Even the simplest of animals exhibit behavioral sequences with complex
temporal dynamics. Prominent amongst the proposed organizing principles for
these dynamics has been the idea of a hierarchy, wherein the movements an
animal makes can be understood as a set of nested sub-clusters. Although this
type of organization holds potential advantages in terms of motion control and
neural circuitry, measurements demonstrating this for an animal's entire
behavioral repertoire have been limited in scope and temporal complexity. Here,
we use a recently developed unsupervised technique to discover and track the
occurrence of all stereotyped behaviors performed by fruit flies moving in a
shallow arena. Calculating the optimally predictive representation of the fly's
future behaviors, we show that fly behavior exhibits multiple time scales and
is organized into a hierarchical structure that is indicative of its underlying
behavioral programs and its changing internal states