Individuality in the hive - Learning to embed lifetime social behaviour of honey bees

1 INTRODUCTION . Animals living in large groups often coordinate their behaviors , resulting in emergent properties at the group level , from flocking birds to democratic elections . In most animal groups , the role an individual plays in this process is thought to be reflected in the way it interacts with group members . Technological advances have made it possible to track all individuals and their interactions in animal societies , ranging from social insects to primate groups ( Mersch et al. , 2013 ; Gernat et al. , 2018 ; Mathis et al. , 2018 ; Graving et al. , 2019 ; Pereira et al. , 2019 ) . These datasets have unprecedented scale and complexity , but understanding these data has emerged as a new and challenging problem in itself ( Pinter-Wollman et al. , 2014 ; Krause et al. , 2015 ; Brask et al. , 2020 ) . A popular approach to understand high-dimensional data is to learn semantic embeddings ( Frome et al. , 2013 ; Asgari & Mofrad , 2015 ; Camacho-Collados & Pilehvar , 2018 ; Nelson et al. , 2019 ) . Such embeddings can be learned without supervision , are interpretable , and are useful for accomplishing downstream tasks . Individuals in animal societies can be described with semantic embeddings extracted from social interaction networks using matrix factorization methods . For example , in symmetric non-negative matrix factorization ( SymNMF ) , the dot products of any two animals ’ factor vectors reconstruct the interaction matrix ( Wang et al. , 2011 ; Shi et al. , 2015 ) , see Figure 1 a and b ) . If the embeddings allow us to predict relevant behavioral properties , they serve our understanding as semantic representations . However , in temporal settings where the interaction matrices change over time , there is no straightforward extension of this algorithm . The interaction matrices at different time points can be factorized individually , but there is no guarantee that the embeddings stay semantically consistent over time , i.e . the prediction of relevant behavioral properties will deteriorate . In living systems , interaction dynamics are highly variable ; individuals differ in when they appear in the data and how long they live . Different non-overlapping groups of individuals , e.g . from different years , may not interact with each other at all . How can we find a common semantic embedding even in these extreme cases ? How do we learn embeddings that generalize to different groups and still provide insights into each individual ’ s functional role ? If animals take on roles partially determined by a common factor , such as age , how can we learn this dependency ? Several approaches to extend NMF to temporal settings have been proposed in a variety of problem settings . Yu et al . ( 2016 ) and Mackevicius et al . ( 2019 ) propose a factorization method for time series analysis . Gauvin et al . ( 2014 ) focus on the analysis of communities that are determined by their temporal activity patterns . Jiao et al . ( 2017 ) consider the case of communities from graphs over time and enforce temporal consistency with an additional loss term . Yu et al . ( 2017 ) and Wang et al . ( 2017 ) represent networks as a function of time . Temporal matrix factorization can be seen as a tensor decomposition problem , for which methods with many applications have been proposed in the literature , see Kolda & Bader ( 2009 ) for a review . In particular , time-shifted tensor decomposition methods have been used in multi-neuronal spike train analysis when recordings of multiple trials from a population of neurons are available ( Mørup et al. , 2008 ; Williams , 2020 ) . However , to our knowledge , no method yet considers the case of entities following a common trajectory depending on an observable property ( e.g. , the age of an individual ) , which we show to be a powerful inductive bias . We approach this question using honey bees , a popular model system for studying individual and collective behavior ( Elekonich & Roberts , 2005 ) . Bees allocate tasks across thousands of individuals without central control , using an age-based system : young bees care for brood , middle-aged bees perform within-nest labor , and old bees forage outside ( Seeley , 1982 ; Johnson , 2010 ) . Colonies are also organized spatially : brood is reared in the center , honey and pollen are stored at the periphery , and foragers offload nectar near the exit . Therefore , an individual ’ s role is partially reflected in its location , which allows us to evaluate whether the embeddings our method learns are semantically meaningful . We propose jointly learning two meaningful representations of honey bee social behavior : 1 ) an individuality embedding that characterizes the lifetime behavior of each individual and 2 ) a daily representation of the individual ’ s functional position in the social network that can be derived from the individuality embeddings . We show that these representations can be learned in an unsupervised fashion , using only interaction matrices of the individuals over time . We analyze a dataset obtained by tracking thousands of individually marked honey bees in two colonies , at high temporal and spatial resolution over a total of 155 days , covering entire lifespans and multiple generations . We evaluate how well the embeddings capture the semantic differences of individual honey bee development by evaluating their predictiveness for different tasks and behaviorally relevant metrics . Our method can be used to study dynamic groups in which individual units change their latent properties over time , and group composition is not fixed due to birth , death , or migration of individuals . We provide a new perspective on how to extract fundamental factors that underlie behavioral and developmental plasticity in animal groups . 2 METHODS . 2.1 TEMPORAL NMF ALGORITHM . SymNMF factorizes a matrix A ∈ RN×N+ such that it can be approximated by the product FF T , where F ∈ RN×M+ and M N : F̂ = argmin F≥0 ∥∥∥A− FF T∥∥∥2 Ai , j ≈ f ( i ) · f ( j ) T f ( i ) = Fi , : f ( i ) ∈ RM+ ( 1 ) When applied to social networks , f ( i ) can represent the role of an entity within the social network A ( Wang et al. , 2011 ; Shi et al. , 2015 ) - however , in temporal settings , factorizing the matrices for different times separately will result in semantically inconsistent factors F . Here we present a novel temporal NMF algorithm ( TNMF ) which extends SymNMF to temporal settings in which A ∈ RT×N×N+ changes over time t. We assume that the entities i ∈ { 0 , 1 , . . . , N } follow to some extent a common trajectory depending on an observable property ( for example the age of an individual ) . We represent an entity at a specific point in time t using a factor vector f+ ( t , i ) such that Ât , i , j = f+ ( t , i ) · f+ ( t , j ) T Â ∈ RT×N×N+ f+ ( t , i ) ∈ RM+ ( 2 ) In contrast to SymNMF , we do not directly factorize At to find the optimal factors that reconstruct the matrices . Instead , we decompose the problem into learning an average trajectory of factors m ( c ( t , i ) ) and structured variations from this trajectory o ( t , i ) that depend on the observable property c ( t , i ) : f ( t , i ) = m ( c ( t , i ) ) + o ( t , i ) f+ ( t , i ) = max ( 0 , f ( t , i ) ) ( 3 ) c : NT×N → N m : N→ RM+ o : NT×N → RM This decomposition is an inductive bias that allows the model to learn semantically consistent factors for entities , even if they do not share any data points ( e.g. , there is no overlap in their interaction partners ) , as long as the relationship between functional role and c ( t , i ) is stable . Note that in the simplest case c ( t , i ) = t , TNMF can be seen as a tensor decomposition model , i.e . the trajectory of all entities is aligned with the temporal dimension t of A . In our case , c ( t , i ) maps to the age of individual i at time t. While many parameterizations for the function o ( t , i ) are possible , we only consider one particular case in this work : We learn a set of individuality basis functions b ( c ( t , i ) ) ( shared among all entities ) that define a coordinate system of possible individual variations and the individuality embeddings φ , which capture to what extent each basis function applies to an entity : o ( t , i ) = K∑ k=0 φi , k · bk ( c ( t , i ) ) φ : RN×K bk : NT → R ( 4 ) where K is the number of learned basis functions . This parameterization allows us to disentangle the forms of individual variability ( individuality basis functions ) and the distribution of this variability ( individuality embeddings ) in the data . We implement the functions m ( c ( t , i ) ) and b ( c ( t , i ) ) with small fully connected neural networks with non-linearities and several hidden layers . The parameters θ of these functions and the entities ’ embeddings φ are learned jointly using minibatch stochastic gradient descent : θ̂ , φ̂ = argmin θ , φ ∥∥∥A− Â∥∥∥2 ( 5 ) Note that non-negativity is not strictly necessary , but we only consider the non-negative case in this work for consistency with prior work ( Wang et al. , 2011 ; Shi et al. , 2015 ) . Furthermore , instead of one common property with discrete time steps , the factors could depend on multiple continuous properties , i.e . c : RT×N → RP , e.g . the day and time in a intraday analysis of social networks . 2.2 REGULARIZATION . Due to the inductive bias , the model performs well without additional explicit regularization in the datasets considered in this work ( see Table 2 ) . However , we find that the model ’ s interpretability can be improved using additional regularization terms without significantly affecting its performance . We encourage sparsity in both the number of used factors and individuality basis functions by adding L1 penalties of the mean absolute magnitude of the factors f ( t , i ) and basis functions b ( c ( t , i ) ) to the objective . We encourage individuals ’ lifetimes to be represented with a sparse embedding using an L1 penalty of the learned individuality embeddings φ . We also introduce an optional adversarial loss term to encourage the model to learn embeddings that are semantically consistent over time , i.e . to only represent two entities that were present in the dataset at different times with different embeddings if this is strictly necessary to factorize the matrices A . We jointly train a discriminative network d ( φi ) that tries to classify the time of the first occurrence of all entities based on their individuality embeddings φ . The negative cross-entropy loss of this model is added as a regularization term to equation 5 in a training regime similar to generative adversarial networks ( Goodfellow et al. , 2014 ) . See appendix A.2.1 for more details and A.4 for an ablation study of the effect the individual regularization terms have on the results of the model .

Summary: The authors introduce a novel method for non-negative matrix factorization for timeseries and apply it to longitudinal honey bee interaction data.  The model leverages consistency of individuals over time by forcing the factors (or rather, the residuals of the factors with respect to a global trajectory) to be linear combinations of a small set of temporal basis functions.  These temporal basis functions are functions of the bee’s age.  In other words, the factor embedding of each bee is a vector of linear combinations of 16 learned basis functions of time.  Since all bees use the same 16 temporal basis functions, given these basis functions the lifetime embedding of each bee is encapsulated by a small matrix of numbers, namely the coefficients for the temporal basis functions for each factor (and in practice only two factors were significant, so each bee’s life is embedded in 32-dimensional space).  There are a number of regularizations on the temporal basis functions and the embedding coefficients.