Detection of Anticipatory Dynamics between a Pair of Zebrafish

Anticipatory dynamics (AD) is unusual in that responses from an information receiver can appear ahead of triggers from the source, and direction of information flow (DIF) is needed to establish causality. Although it is believed that anticipatory dynamics is important for animals’ survival, natural examples are rare. Time series (trajectories) from a pair of interacting zebrafish are used to look for the existence of AD in natural systems. In order to obtain the DIF between the two trajectories, we have made use of a special experimental design to designate information source. However, we have also used common statistical tools such as Granger causality and transfer entropy to detect DIF. In our experiments, we found that a majority of the fish pairs do not show any anticipatory behaviors and only a few pairs displayed possible AD. Interestingly, for fish in this latter group, they do not display AD all the time. Our findings suggest that the formation of schooling of fish might not need the help of AD, and new tools are needed in the detection of causality in AD system.


I. INTRODUCTION
It is our daily experience that causal events are ordered by time.One expects that effects follow their causes in time.But is this always the case?Recent advances in nonlinear physics discover that causal events are not always ordered by time when there are anticipatory interactions between the events.For example, in the phenomenon of anticipating synchronization (AS) proposed by Voss [1], a slave system driven by a master can produce responses ahead of its master in time.Although there are reports on the observations of AS in various specially arranged physical systems [2] to mimic the simulation, one wonders if this counter intuitive phenomenon can also be observed in nature.
One of the pre-requisite for anticipatory dynamics is that systems involved must be able to process incoming information and make use of it to anticipate future events in the incoming signal.This requirement is not easily met in natural physical systems.But anticipation is an instinct for most animals and can be found in early visual system [3].It is known that animals are using anticipation to compensate delays in the sensory or motor systems [4].
Anticipatory interactions might also play an important role in the collective motions as seen in the flocking of birds [5] or schooling of fish [6] which are still poorly understood.Presumably, during flocking or schooling, animals do not normally run into each other because they can anticipate the future positions of their group members.Therefore, interactions between moving animals might be the best place to look for anticipatory dynamics (AD) in nature.
In this article, we report results of our experiments designed to study anticipatory interaction between a pair of zebrafish in visual contact through their motion trajectories (u(t) and v(t)).The method of time lag mutual information (TLMI) [7] is first used to obtain the temporal relation between u(t) and v(t).If the events in times series u(t) is found to be ahead of the time series v(t), there are two possible scenarios: either "v(t) follows u(t)" or "u(t) anticipates v(t)".In order to resolve these two cases, we made use of the method of transfer entropy (TE) [8] to detect the direction of information flow (DIF) between the two fish.However, the DIF is found to be sensitive to history length used in the computation of TE and additional one-way mirror experiments with known DIF are needed to establish the correct history length.Our results indicate that AD can be observed much more often in fish pairs of different genders.The validity of our anticipatory dynamics detection method of using DIF is also checked by simulations of two chaotic Lorenz oscillators with anticipatory coupling; mimicking the interaction between the fish.Our simulation results further suggest that the two fish are interacting with their own internal dynamics to perform anticipation.

II. EXPERIMENT SETUP
In the experiment, a pair of zebrafish was placed in a two-channel rectangular glass tank (Figure 1) with the two fish separated by a window such that the two fish were visible to each other.The rectangular channels were of size 21.6cm × 4.5cm.The fish were 1 ∼ 1.5 years old and of lengths 3.5 ∼ 4cm.The water levels in the two channels were kept around 2 cm deep.This depth was determined empirically to be deep enough to avoid the jumping of fish out of the water but not so deep that we can treat the fish as being confined in a quasi-one-dimensional channel.The window between the two channels was made of Plexiglass and it can be turned into a one-way mirror when a semi-reflective filter is attached to it together with different illumination levels in the two channels.The tank was placed on top of a LCD monitor (40cm × 70cm) which was controlled by a computer to provide different spatially uniform illuminations for the two channels.When the one-way mirror configuration is enabled, only the fish in the dark channel can see the other fish in the bright channel while the fish in the bright channel can only see its own reflections from the walls of the channel.A CCD camera (Basler acA4096-40um) placed 90 cm above the tank was used to capture images of the fish.An IR LED (940nm) linear array was also used to provide illumination which was visible only to the CCD but not to the fish so that captured image quality can still be maintained even when visible illumination levels in the two channels were low.The whole setup was kept inside a box with black walls ; preventing the fish from detecting spacial visual cues.
A total of more than 20 fish were kept in a large tank and selected fish were then placed into the two channels for experiments.Experiments were performed from two groups (6 each: 3 males and 3 females) which were obtained at different dates.We found that a settlement time of 0, 2.5, 5 and 10 minutes before the start of experiment recording did not affect the results of our experiments.Trajectories of the two fish during experiments were obtained from video images recorded at 30 or 60 frames per second (fps) with a spatial resolution of 1340 × 560 square pixels covering an area of 21.6cm × 9cm.The recording duration is always set to 500 s.For the health of the fish, the total experiment period per day was limited to 60 minutes.Trajectories of the fish were extracted from recorded images by the scikit-image packages.All experiments were performed at 25 • C. Data reported below were obtained from experiments recorded mainly at 30 fps as data from 60 fps recording give similar results.Figure 1 shows trajectories of two fish separated by a transparent window in the tank during a typical experiment.The horizontal span of the tank was divided into 16 discrete locations and the quasi-one-dimensional trajectories are represented by these 16 states for the computation of TLMI and TE below.These quasi-one-dimensional trajectories were divided into 16 spatial states along the length of the tank shown as vertical strips.Different shading of the strips are used to guide the eyes.Although the two trajectories have different appearance, no correlations were found between the shapes of the trajectories with gender or role in anticipatory dynamics.Keys: M=male fish and F=female fish.

III. EXPERIMENTAL RESULTS
Figure 2 is the results of the analysis of the trajectories shown in Figure 1.The measured trajectories of fish were represented as two time series: U ≡ {u i } and V ≡ {v i } shown in Figure 2a.Here u i and v i are the positions (discretized in to 16 states) of the two fish respectively at the i th step with a step size of 1/60s.It can be seen that the two fish were always close to each other; indicating that there was an attractive interaction between them.
We found that the interaction between the two fish was visual.There was little interaction between the two fish when the background illumination provided by the LCD monitor was switched off.The background illumination in Figure 2 was 135 cd/m 2 .The interaction was found to be not too sensitive to this background illumination; similar results can be obtained when the background illumination was changed by ±30%.
We have also performed experiments similar to that shown in Figure 1 in tanks with different lengths.For a longer tank (length = 44cm), since the two fish can be quite far apart, there were interactions between them only when they were visible and close to each other; resulting in a much smaller peak in the measured cross-TLMI curve (Figure 2b).On the other hand, for a shorter tank (length = 10cm), it seems that the fish did not adapt well to such a confined space and they can be seen to move back and forth between the two ends of the channels endlessly and not interested in each other; resulting in a TLMI curve with no peak.Our choice of a tank with a length of 21.6cm was based on these observations to optimize the interactions between the two fish.To investigate the temporal relation between U and V , we make use of the TLMI [9] between U and V which is defined as: where P (...) is the probability distribution or joint distribution of the variables in (...).It measures how much information is being shared between {u i } and {v i } when U is shifted j step (δt = j∆t) ahead of V with ∆t being the step size.The TLMI from the same time series is also called the auto-TLMI and cross-TLMI for those from two different time series.
The TLMI between U and V as a function of δt (time lag) is shown in Figure 2b.As references, the figure also shows the corresponding auto-TLMI of U and V which measure how information between two temporal points (δt apart) in the same time series are being shared.The peak position of T LM I(U, V, δt) provides information of how events in U and V are related temporally [9].The peaks for the auto-TLMI are of course located at δt = 0.
It can be seen that both T LM I(U, U, δt) and T LM I(V, V, δt) decrease similarly in both the positive and negative δt direction.
Different from the auto-TLMI, the peak of the cross-TLMI between U and V can be located either at δt > 0 or δt < 0, depending on the temporal relation between U and V .A peak at δt = δt p > 0 for T LM I(U, V, δt) indicates that V at t−δt p contains most information of U at t.In other words, events in V is leading events in U .This peak location is also called the anticipatory horizon.This last statement could mean one of two possibilities: either a) U follows V or b) V anticipates U and vice versa for peaks at δt < 0. However, in some experiments, two peaks in the TLMI can be observed as shown in Figure 3.In such 2-peak TLMI cases, one possible interpretation is that events in V are leading those in U only during some of the time and vice versa for events in U .From our experiments, there is only a single peak in the majority of the measured TLMI (see Table I).
For the cases of TLMI with a single peak, we made use of the method of TE to compute the direction of the net flow of information between the two fish to resolve the two possibilities of "anticipate" and "follow".We follow the definition of TE of Schreiber [8], and calculate the TE from time series U to V as: where H(.|.) denotes the conditional entropy.The notation represents the history of V (t) ≡ v t with a length of k time step before the time bin t and FIG.3: A typical example of 2-peak TLMI in experiments similar to that shown in Figure 2. Two peaks can be clearly seen in the measured TLMI.These peaks could origin from a scenario that the male and the female fish can be leading at different periods of time during the experiment.
similarly for U .This TE measures the reduction of entropy of the V (t) by using both V 's own history and that of U with history length k and l time step respectively.With this definition, T E ≥ 0. If T E(U, V ) is positive, we will have information transfer from U to V .Since there might be information flow in both directions, we can obtain the DIF from the net information flow between U and V .If T E(U, V ) > T E(V, U ), DIF is from U to V .Usually, TE is defined at equal time for both U and V .However, to take into account the effect of time shifted in anticipatory dynamics, we also need to shift one of the time series by δt p obtained in Figure 2b when we compute TE.The use of TE to detect causal relationship between two time series is not new.Butail et al [10] used TE to detect "leaders" in interaction between zebrafish.However, in Ref [10], a history length of one was used and no effects of time lag due to anticipatory dynamics were considered.To simplify analysis, we have set the history lengths in both U and V to be the same and labeled it as h.Since it is not known a priori the correct history length to be used to compute the two TEs, we have computed the history length dependence of TE as shown in Figure 2c.It can be seen that the DIF can be reversed if different history lengths (h) were used.Note that the difference of TE in the two directions are quite small.Presumably, this is due to the similarity of the two trajectories.
In order to determine the correct h to be used, we have setup one-way mirror experiments transfer directions.Since it is known that the DIF is from the bright to the dark channel, the correct history length should be between 0.1 and 0.25 s. c) The same as a) except that the two fish were exchanged.The experimental conditions here were the same as those in Figure 2; except that the transparent window between the two channels was replaced by an one-way mirror.
in which only one fish can see the other and therefore the DIF is known.These oneway mirror experiments were implemented by using different illumination levels in the two channels and replacing the transparent window separating the two channels in the tank by a semi-reflective window.Figure 4 is the typical result of a one-way mirror experiment.The light intensity in the two channels were 135 cd/m 2 and less than 1 cd/m 2 for the bright and dark channel respectively.If one labels the fish in the bright/dark channel as Fish B/D respectively, then only Fish D can see Fish B while Fish B sees its own reflection in the one-way mirror as mentioned above.Therefore, information is flowing from the bright channel to the dark channel.Figure 4 shows typical results from such one-way mirror experiments.Figure 4a shows that the female tended to follow the male fish, and the TE computation (Figure 4b) shows the correct direction of information flow when the history length is between 0.1 and 0.25 s.If we exchange the two fish in the channels, there were little interaction (Figure 4c).Also, the peak of the TLMI between Fish B and Fish D in Figure 4a was found to be only a fraction of that from Figure 2b; indicating that the interaction between the two fish in the one-way mirror experiment was weaker than that when both fish can see each other.
More one-way experiments (N > 15) have also been carried out with different pairs of fish similar to those in regular experiments to check for the correct h needed and we find that the obtained DIF will be correct if h is between 0.1 and 0.25 s.When this calibrated criterion on h was used to obtain the DIF for different regular experiments with a transparent window, we found that anticipatory dynamics can be observed mostly when the two fish are of different genders with information flowing from the males to females while the trajectories of females seemed to be leading those from the males.Table I is a summary of our finding in the regular experiments (same illumination levels in both channels) based on a history length between 0.1 and 0.25 s.The important features from the table are: a) peaks of the cross-TLMI are higher from fish pairs of different genders, b) For pairs of different genders, we observed more cases of "anticipate" than "follow", c) females were more likely to be the net information receiver.However, point c) might be related to the fact that experiments were being performed with a certain group of fish.

IV. COMPARISONS WITH LORENZ OSCILLATORS
Our method of using difference of TE to determine the direction of information flow has also been tested by the simulation of two Lorenz attractors [11] (L 1 and L 2 ) with anticipatory coupling through their x variables.We used the anticipatory coupling mechanism introduced by Voss [1].The governing equations for the L 1 are: Similarly for L 2 : The anticipatory interaction in L 1 is the term Anticipate and Follow.For both the "Anticipate" and "Follow" conditions, the cases are further subdivided into FM (female anticipates/follows male) and MF (male anticipates/follows female).
About half of the cases from different genders data show anticipation and these pairs are interacting better than those of same gender as shown in the column "Avg MI Peak" (the average cross-TLMI peak height measured as the percentage of the auto-TLMI peak height).
used here for simplicity to simulate the situation where both fish have similar anticipatory capabilities.However, k 1 and k 2 can be different because different fish or fish of different genders could have different roles during interaction.The usual Lorentz parameters σ, β and ρ are 10, 8/3 and 28 respectively so that the system is in the chaotic regime.The interaction between L 1 and L 2 is also made noisy by the noise term with λ 1 and λ 2 being the amplitude of the Gaussian noise (η 1 and η 2 ) with zero mean and unity standard deviation.The noise term is needed in order to produce results similar to experiments as will be shown below.
All the parameters here are dimensionless.Euler's method is used to integrate the models with a time step ∆t = 0.001 and a smaller time step will not change the essential features of the results.The delayed feedback time τ is always set to 0.05 for all the simulation.The values of k 1 , k 2 , λ 1 , and λ 2 reported below are chosen to reproduce TLMI similar to those observed in experiments for various conditions.showing the leading of x 2 .b) The TLMI between x 1 and x 2 ; showing that either "L 1 is anticipating The history length dependence of TE from x 1 to x 2 and vice versa.
A. Anticipation in a Master-Slave system without noise We will consider the simple case without noise first.If k 1 is zero, L 1 is autonomous and acts like a master while L 2 is a slave which can only receive information from L 1 .The system L 2 will synchronize with L 1 when the anticipatory interaction vanishes.Therefore, one would expect L 1 to be in a chaotic state while L 2 is synchronized with 5 is a typical result of simulations for such a master slave system (k 1 = 0) with the noises in both L 1 and L 2 set to zero.It can be seen that the two systems can be synchronized (Figure 5a) by the coupling only in the x variable with L 2 being ahead of L 1 .In other words, L 2 is anticipatory of L 1 .However the corresponding TLMI shown in Figure 5b is very different from those found in experiments.The peak of the cross-TLMI has the same height as that of the auto-TLMI.The equal heights of the peaks can be understood from fact that the two system are synchronized with a phase (time) shift and therefore the cross-TLMI should be the same as the auto-TLMI except with only a shift in time (time lag).
No history dependence of TE is shown because our simulation results show that TE in both direction are always equal as expected.Note that the k 2 and τ are chosen so that the two systems can synchronize.If k 2 or τ is too large, the two oscillators cannot be synchronized.
The phenomenon reported here is known as anticipating synchronization [1].
B. Anticipation in a Master-Slave system with noise Figure 6 shows typical results of a master-slave (k 1 = 0) system when λ 1 = 0 and λ 2 = 0.
Similar results can also be obtained when both λ are not zero (not shown).It can be seen from Figure 6a that the trajectory of x 2 (t) is now noisy and L 2 is again ahead of L 1 ; similar to Figure 5a.However, L 1 and L 2 are not synchronized.Since they are not synchronized, the peak of the cross-TLMI is then related to how well the two systems are correlated.This later correlation is related to k 2 when τ is fixed as in our case.When k 2 is too small, there is hardly any interaction and therefore very small correlation.However, when k 2 is too large, L 2 over-reacts to the influence from L 1 through the anticipatory term and the system becomes unstable with oscillatory responses.Therefore, there is an optimal k 2 for a given τ .Since the synchronization (perfect correlation) is destroyed by the addition of noise, we found that both the height and the position of the peak of the cross-TLMI are function of noise strength λ 2 as shown in Figure 7 which indicates that when the noise strength increases both the peak height of the cross-TLMI and the anticipatory horizon decrease.Of course, the noise amplitude cannot be too large; otherwise there will be no anticipation.When the noise amplitude is small, the shape of the attractor of L 2 , although noisy, still resembles the Lorentz form of those from L 1 .In such a case, there is still anticipation.However, when the noise amplitude is too large, the shape of the attractor of L 2 loses its Lorentz shape and there is no longer anticipation.We found that the effects of noise described above is not sensitive to where it is added.It can be added to the master or slave.Even when noises are added to both the master and slave, similar effects can be found.Voss [12] to create an adaptive slave L 3 as: Note that L 3 has only relaxation dynamics to ensure close to zero output when there is no input from the anticipatory term and does not require the knowledge of Lorenz dynamics to perform anticipation.The parameter α and k 3 are the relaxation and strength of anticipatory interaction of the system while λ 3 and η 3 are defined similarly as other λ and η above.It is through the anticipatory term from which L 3 can acquire (adapt to) the dynamics of L 1 when α and k 3 are properly chosen.Intuitively, one needs a sufficiently large k 3 to produce reasonable anticipation.However, from the simulation, it is found that in order to produce stable response from L 3 , k 3 must not be too large and it is related to α for a fixed τ .If k 3 is large, there will be oscillations in the response because of too much gain and then a larger α can be used to damp out the oscillations.Therefore, in order to generate stable response from L 3 , α and k 3 cannot be varied independently.The α and k 3 reported here are chosen by using parameters scanning to produce TLMI and TE similar to those obtained from the experiments.
Figure 10 shows a typical simulation of L 1 and L 3 without noise but with the properly chosen k 3 and α to mimic the experiment findings.Similar to the finding of Ref [12], it can be seen that x 3 is anticipatory (ahead) of x 1 .Since L 3 does not have the dynamics of L 1 , the cross-TLMI will always have a peak with height smaller than that of the auto-TLMI; no noises are needed.For the computed TE, Figure 10c shows that DIF is correct but its form is quite different from what we found in experiments.When moderate amount of noise is added to L 1 or L 3 , or even to both L 1 and L 3 simultaneously, the effects of noise is to reduce both the height and the anticipatory horizon of the TLMI peak in Figure 10b; similar to those shown in Figure 7.However, the form of the history dependence of TE remains similar to Figure 10c.This last finding suggests that the form of the history dependence of TE is different for active and passive anticipation at least for the Lorenz system.
Finally, we can also use L 3 to perform anticipation on the trajectory of a master obtained from an experiment with anticipation as shown in Figure 11 to see if passive anticipation is taking place during fish interaction.In Figure 11, one simulation step is set to correspond to 16.6 ms (1/fps) in our experiments and x 1 (t) in Eqn( 7) is replaced by the trajectory of a master.Also, we have done a parameter scan to obtain the best anticipatory capability for L 3 .It can be seen from the figure that although the direction of information flow is correct (Figure 11b) for history length between 67 and 233 ms, the anticipatory capability of x 3 is not as good as that obtained from a real fish!Both the peak height and the anticipatory horizon of the cross-TLMI are smaller from those obtained from experimental results.Figure 11 suggests that the fish are using their own similar internal dynamics for anticipation .

FIG. 1 :
FIG.1: Typical 80s trajectories of two fish in the tank.The tank was divided into two equal halves by a transparent window (the dotted line) which can be turned into a one-way mirror.

FIG. 2 :
FIG. 2: Typical experimental results for an interacting pair of fish of different genders.a) The time course of the states from the trajectories of Figure 1.It can be seen that F is leading M. b) TLMI as a function of time lag computed from the two time series shown in a).c) History length dependence of TE for both directions from F → M and M → F .Keys: M=male, F=female, TLMI(A,B) = time lag mutual information between A and B and TE(A,B) = transfer entropy from A to B.
t o r y L e n g t h ( s ) b )

FIG. 4 :
FIG.4: Typical results from one-way mirror experiments: a) Time lag dependence of TLMI between Fish B in the bright and Fish D in the dark channels; showing that the trajectory of Fish B (male) is ahead of that from Fish D (female).b) History length dependence of TE for both

FIG. 5 :
FIG. 5: Simulation results of two chaotic Lorenz oscillators (L 1 and L 2 ) coupled through their x variables; with L 1 being the master and L 2 being the slave.a) The time course of the x 1 and x 2 ;

FIG. 6 :
FIG.6: Simulation results of L 1 and L 2 with noisy (λ 1 = 0 and λ 2 = 3.8) anticipatory interaction (τ = 0.05); with L 1 being the master (k 1 = 0) and L 2 being the slave (k 2 = 1).a) The time course of the x 1 and x 2 ; showing the leading of L 2 .b) The TLMI between x 1 and x 2 .c) The history length dependence of TE from x 1 to x 2 and vice versa.The direction of information flow is correct only when the history length is taken between 1 and 17 simulation time step.

Figure 6c shows the 2 and λ 2
Figure6cshows the history dependence of the TE for both directions.It can be see that their forms and values are similar to those from experiments.An important observation from Figure6is that the DIF is correct only when the history length used for TE is below certain value; similar to experiments.Presumably, the effects of noise accumulates over time

2 TFIG. 7 :
FIG.7: Effects of noise on the anticipatory capability of L 2 .The λ 2 dependence of height and location of the peak in the cross-TLMI for a simulation similar to that shown in Figure6.

FIG. 8 :FIG. 9 :
FIG. 8: Mutual anticipation between L 1 and L 2 with equal strength: a) The time course of the x 1 and x 2 of L 1 and L 2 ; showing no leader.b) The TLMI between x 1 and x 2 with peak close to the origin.c) A typical example of history length dependence of TE from x 1 to x 2 and vice versa; giving a difference of TE in these two directions very close but not equal to zero.The simulation parameters are: τ = 0.05, k 1 = 1, k 2 = 1, λ 1 = 3.8 and λ 2 = 3.8.

FIG. 10 :
FIG. 10: Anticipation of L 1 using L 3 without noise.a) The time course of the x 1 and x 3 of L 1 and L 3 ; showing the leading of L 3 .b) The TLMI between x 1 and x 3 .c) The history length dependence of TE from x 1 to x 3 and vice versa.The direction of information flow is correct irrespective to history length.The simulation parameters are: τ = 0.05, k 1 = 0, k 3 = 55.0, α = 34.0,λ 1 = 0 and λ 3 = 0.

FIG. 11 :
FIG. 11: Anticipation of experimental data the experiment shown in Figure 2 using L 3 .a) Same as Figure 1a with the addition of cross-TLMI between L3 and experimental data for comparison.b) History dependence of TE in both directions.The simulation parameters for L 3 are: τ = 0.05, k 3 = 150.0,α = 150.0 and λ 3 = 0. To match the simulation with the experiment, one simulation time step (∆t = 0.001) corresponds to 1/fps in the experiment which is 16.6 ms.