We analyzed the trajectories of freely foraging Gymnotus sp., a pulse-type gymnotiform weakly electric fish, swimming in a dark arena. For each fish, we compared the its initial behavior as it learned the relative location of landmarks and food with its behavior after learning was complete, i.e. after time/distance to locate food had reached a minimal asymptotic level. During initial exploration when the fish did not know the arena layout, trajectories included many sharp angle head turns that occurred at nearly completely random intervals. After spatial learning was complete, head turns became far smoother. Interestingly, the fish still did not take a stereotyped direct route to the food but instead took smooth but variable curved trajectories. We also measured the fish's heading angle error (heading angle – heading angle towards food). After spatial learning, the fish's initial heading angle errors were strongly biased to zero, i.e. the fish mostly turned towards the food. As the fish approached closer to the food, they switched to a random search strategy with a more uniform distribution of heading angle errors.

Learning the spatial relationships of important environmental features is essential for behaviors such as foraging, and such learning has been studied in vertebrates ranging from fish (Braithwaite et al., 1996; Jun et al., 2015) to mammals including rodents (Alvernhe et al., 2012) and primates (Lührs et al., 2009). Vision is typically the dominant sense for spatial learning; although blind rats can also learn to navigate, the sense(s) utilized have not been clearly identified (Save et al., 1998). Weakly electric fish can learn spatial relationships in the dark using their electrosense (Jun et al., 2015; Engelmann et al., 2021). After learning, these fish use active sensing to identify landmarks (allothetic) and subsequently use path integration (idiothetic) to guide them from home or landmarks to food (Jun et al., 2015; Wallach et al., 2018; Engelmann et al., 2021). The time course for such learning has been established previously for pulse gymnotiform fish (Jun et al., 2015). The focus of that study was on the time course of learning and on the engagement of active sensing at landmarks. As in most spatial learning studies, Jun et al. (2015) made no attempt to examine the evolution of the fish's trajectories as it learned to efficiently find food. Notably, even after learning was complete, the learned trajectories were not simply direct routes from home to food but variable even after they had achieved minimal durations and distances (Fig. 1). Here, we close this gap by analyzing the trajectories of the fish in Jun et al.’s (2015) study to determine how flexible egocentric cue-based trajectories change during spatial learning.

Fig. 1.

Early versus late learning fish example trajectories. (A,B) The fish arena is illustrated including the four landmarks and the entrance (brown) from this fish's home. In black, the original trajectories. In cyan, the smoothed trajectories using a moving average of 15. Note the complete overlap between the original (black) and smoothed (cyan) trajectories. In red, a second example of early and late trajectories from the same fish. As previously demonstrated (Jun et al., 2015), the late trajectories are shorter in both time and distance travelled than the early trajectories. (A) Individual early trajectories are extremely variable (black/cyan and red) and highly convoluted with many sharp turns. Trajectories are not stereotyped but vary extensively across trials (black/cyan versus red). (B) Late trajectories are smoother with few sharp turns (see below for quantification). Note also that the late trajectories are still variable and are not straight paths towards the food; instead, they can contain loops where the fish temporarily moves away from the food. Further, the late trajectories are still not stereotyped but vary immensely across trials.

Fig. 1.

Early versus late learning fish example trajectories. (A,B) The fish arena is illustrated including the four landmarks and the entrance (brown) from this fish's home. In black, the original trajectories. In cyan, the smoothed trajectories using a moving average of 15. Note the complete overlap between the original (black) and smoothed (cyan) trajectories. In red, a second example of early and late trajectories from the same fish. As previously demonstrated (Jun et al., 2015), the late trajectories are shorter in both time and distance travelled than the early trajectories. (A) Individual early trajectories are extremely variable (black/cyan and red) and highly convoluted with many sharp turns. Trajectories are not stereotyped but vary extensively across trials (black/cyan versus red). (B) Late trajectories are smoother with few sharp turns (see below for quantification). Note also that the late trajectories are still variable and are not straight paths towards the food; instead, they can contain loops where the fish temporarily moves away from the food. Further, the late trajectories are still not stereotyped but vary immensely across trials.

Experimental setup

The experimental setup is further detailed in our laboratory's previous paper (Jun et al., 2014). Video introductions are also available (Jun et al., 2013). The experiment made use of a 1.8×1.8×0.3 m tank resting on multiple layers of vibration-absorbing material (to minimize external vibratory stimuli). Water temperature was closely regulated to 25±1°C to prevent temperature-dependent electric organ discharge (EOD) rate fluctuations (Ardanaz et al., 2001). The power-line noise generated by the water heater underneath the tank was blocked by a Faraday cage. The tank was surrounded by a sensory-isolation chamber (to block external light, sound and radio-frequency noise). Air filtration was installed to expel excess humidity build-up caused by heating. The water was shallow (∼10 cm) to facilitate video recording. Within that tank was a circular tank (radius 80 cm) that constituted the experimental area.

The landmarks were built from thin (1.6 mm) acrylic sheets with suction cups attached to the bottom to fix them to the glass floor. Four types of landmarks were built: two squares (5.6 and 9.0 cm per side) and two circles (7.6 and 10.2 cm diameter). They were placed at rotationally symmetric positions for all fish. White grid paper of 5 cm spacing was attached underneath the glass floor to aid in landmark and food placement, and to enhance contrast with the brown fish.

Experimental protocol

Live mealworms were used as the food source and were kept in place by elastics on a suction cup. Water filtration was performed between every daily experiment, and water from each compartment (where the fish were housed prior to experiments) was mixed together during filtration to homogenize odorants.

In all experiments (including prior to the probe trials, where there was no food), thorough vacuuming of the tank bottom floor was performed as to be sure no remnants of the mealworm remained. Trials were repeated up to (but not always) four times per animal each day, and a single mealworm was used as the food source for each trial. When the trial lasted over 15 min, it was aborted.

Probe trials were conducted after the learning performance reached a stable plateau and followed the same protocol except that the food source was not present. For each fish, the probe trial was performed as one of the four trials run that day, with a random order (first, second, third or fourth trial).

The data

Previous research done in our lab (Jun et al., 2015) provided the data for the x and y coordinates for three fish (Gymnotus sp. Linnaeus 1758, ranging from 13.9 to 17.9 cm and labelled A, B and C) foraging in a circular tank (radius 80 cm; water depth ∼10 cm). The food source was always placed in a rotationally equivalent position at the near-center of the aquarium [coordinates (x,y)=(0 m,−0.1 m), (−0.1 m,0 m), (0 m,0.1 m) for fish A, B and C, respectively] based on the entry point (top right, bottom right and bottom left, for fish A, B and C, respectively). Jun et al. (2015) used four fish in their study, but a hard disk crash damaged the data for one fish so that it could not be used. Jun et al. (2015) showed that spatial learning in this fish was entirely comparable to the other fish, and so our smaller sample is still characteristic of electrosensory spatial learning in this species.

The data had a granularity of 100 frames s−1 but required smoothing as they were piecewise linear. We used a moving average of size 15 frames (seven on the right, center frame, seven on the left) to smooth out the trajectories. The data included the head orientation. Head orientation did not require smoothing, only the replacement of some spurious points when the fish would go from an angle of 0 to 360 deg or vice versa that were generated by our treatment of arithmetic modulo 360 deg.

In Jun et al. (2015), a definition was made for early learning (two sessions comprising of at most eight trials per fish) versus late learning (four sessions comprising of at most 12 trials and four probe trials per fish). The ‘late learning’ fish had reached asymptotically minimal trajectory distance and duration. We used these definitions for our analysis.

Change of heading angle

In this analysis, we used the ‘change in heading angle’ defined as the change in angle from time t to time t+1. We determined the distribution of change of heading angles for early and late learning; outliers of this distribution were taken as being 1.5 times the interquartile range (IQR) away from the first or third quartile (Balan and Lamothe, 2011). These outliers were defined as ‘sharp turns’ and we calculated the time intervals between the sharp turns. Note that sharp turns are thus defined uniquely for each fish and learning status. Because the distributions are so different between early and late learning, the outlier criteria of 1.5 times the IQR are at different absolute locations.

Error in heading angle

Because the location of the food source is recorded (and constant), we could calculate the optimal heading angle for the fish to get to the food source. We compared that with the current head angle. For our purposes, we call this the error in heading angle. The error in heading angle was designed to range from −180 to 180 deg, with 0 deg indicating that the fish is facing the food.

Distribution of error in heading angle

The fish, especially during early learning, spent a great deal of time along the walls; similar exploratory behavior has been described for mice upon entering a new arena (Fonio et al., 2009). This heavily distorted the distribution of heading angles. To remedy this distortion, we removed all instances of wall-swimming by eliminating the data where the fish was less than 15 cm from the wall. Another modification done was to give each trajectory the same weight instead of the inherently weighted average obtained by amalgamating short and long trajectories. That is, for each trajectory, we computed its own distribution of heading angle error, and the resulting empirical densities of heading angle error (one density function per trajectory) was then averaged to obtain a final empirical density for the collection (a collection being the trajectories that fall under one fish and one learning status). This way, the bias towards longer trajectories was eliminated.

Rayleigh test of uniformity

For a sample, θ1,…,θn, of angles, we define the sample mean resultant length as follows:
(1)
where j are the successive calculated heading angle errors. Then we have the following large-sample asymptotic distribution under uniformity, with an error of order O(n–1) (Mardia and Jupp, 2000). The test statistic for the Rayleigh test of uniformity can be calculated as follows:
(2)

This allows us to determine statistical significance on whether a sample of angles originates from a uniform distribution. Low P-values indicate that the underlying distribution is less likely to be uniform. Variants of this test also allow us to determine whether there is a significant bias towards 0 (Jammalamadaka and Sengupta, 2001).

l2 distance from uniform distribution

Given a discrete distribution with finite support, we can define the l2 distance (Euclidean norm) between that distribution and the uniform distribution with that same support. This is done by taking the square root of the sum of squared differences between the distribution's values and that of the uniform distribution. Doing this allows us to measure how different from the uniform distribution our given distribution is.

EOD rate

In previous research in our lab (Jun et al., 2014), we investigated the EOD rate of the weakly electric fish Gymnotus sp. at rest and while locomoting; in particular, we found a strong increase in EOD rate associated with initiation of movement, i.e. strong acceleration. Here, we examined the EOD rate to determine whether it also increased during sharp turns, i.e. times of strong acceleration.

Jun et al. (2014) reported that an EOD rate increase typically preceded a spontaneous movement by approximately 1.5 s. We thus expanded the sharp turn periods to include the EOD rates 1.5 s before and after a sharp turn in our analysis. The EOD rates during the smooth swimming segments between the expanded sharp turn periods were then used for comparison.

As in Jun et al. (2015), we present measures that differentiate between early learning fish and late learning fish, effectively presenting trajectory measures that vary with learning.

Effect of spatial learning on heading angle

As a first step in our analysis, we provide the box plots of the change in head angle (Fig. 2). This effectively covers the statistics of IQR, number of outliers (1.5 times the IQR away from the first or third quartile), median and outlier threshold. The outliers are identified as sharp turns.

Fig. 2.

Change in heading angle. For each fish (A, B and C), change in heading angle in early learning versus late learning. Change in heading angle was computed as the difference between where the fish was facing 0.01 s ago and where it is facing now. Note that the interquartile range is consistently larger for late learning fish than for early learning fish. Furthermore, the number of outliers in early learning fish is much higher than the number of outliers for late learning fish. The outlier thresholds are indicated by bars.

Fig. 2.

Change in heading angle. For each fish (A, B and C), change in heading angle in early learning versus late learning. Change in heading angle was computed as the difference between where the fish was facing 0.01 s ago and where it is facing now. Note that the interquartile range is consistently larger for late learning fish than for early learning fish. Furthermore, the number of outliers in early learning fish is much higher than the number of outliers for late learning fish. The outlier thresholds are indicated by bars.

The median remains relatively unchanged at zero, while the IQR range is consistently greater for late versus early learning fish. The number of outliers (sharp turns) is much greater for early learning fish. We note that the size of the datasets between fish and between learning status is very variable, and so a more appropriate statistic is percentage outliers instead of number of outliers (Table 1). Note that the differences between early and late learning in Table 1 are not found when the outlier threshold for early learning fish is used for late learning fish.

Table 1.

Percentage outliers of change in heading angle

Percentage outliers of change in heading angle
Percentage outliers of change in heading angle

Intervals between sharp turns

For the early fish, we have found that the interval between sharp turns follows an exponential distribution (Fig. 3), indicating that the process may be random. The mean time interval between sharp turns was 1.64, 1.30 and 1.36 s for fish A, B and C, respectively. Sharp turns could occur within sensing distance from a landmark (<4 cm; Jun et al., 2015) and therefore might be a response to sensory input from the landmark. Alternatively, the sharp turns might occur in open water (>4 cm from a landmark) and therefore might be generated by internal neural dynamics. For early learning and across all three fish, we found 160 instances of sharp turns near landmarks and 1612 instances of sharp turns in open water. We emphasize that, in the latter case, there is no exogenous sensory input that might have evoked the turn. Furthermore, at a level of 95% confidence, fish A and C had no serial correlation at lag 1, and fish B had a weak positive serial correlation (0.19). When replacing time by distance travelled in between sharp turns, we obtained an exponential distribution again and the serial correlation at lag 1 of fish A was statistically not significant, whereas fish B and C had a very weak positive serial correlation (0.14 for both). Average speed over these intervals had a correlation at lag 1 of 0.65, 0.79 and 0.76 for fish A, B and C, respectively. This indicates that the fish swam at a fairly constant speed and explains the similarity of the distance and time results. Overall, we conclude that the fish initiated sharp turns nearly randomly and the exponential distribution of inter-turn intervals suggest that they might be modelled as a Poisson process. We also tried power law fits but found they were poor in comparison (Fig. 3).

Fig. 3.

Distribution of the interval between sharp turns in trajectories. Each distribution [(Ai–Ci) early and (Aii–Cii) late] is fitted with an exponential distribution (blue) and a power law (Pareto with minimum value 0.01) distribution (brown) with parameters obtained via maximum likelihood estimation. The exponential parameter was 0.60, 0.77 and 0.74 and the power law parameter was 1.25, 1.25 and 1.27 for fish A, B and C, respectively. Note that the fit of the exponential is good (l2 distance 0.04, 0.05 and 0.05, for fish A, B and C, respectively). The fit of the power law distribution is acceptable (l2 distance 0.29, 0.33 and 0.32, for fish A, B and C, respectively). (A) Fish A, (B) fish B and (C) fish C.

Fig. 3.

Distribution of the interval between sharp turns in trajectories. Each distribution [(Ai–Ci) early and (Aii–Cii) late] is fitted with an exponential distribution (blue) and a power law (Pareto with minimum value 0.01) distribution (brown) with parameters obtained via maximum likelihood estimation. The exponential parameter was 0.60, 0.77 and 0.74 and the power law parameter was 1.25, 1.25 and 1.27 for fish A, B and C, respectively. Note that the fit of the exponential is good (l2 distance 0.04, 0.05 and 0.05, for fish A, B and C, respectively). The fit of the power law distribution is acceptable (l2 distance 0.29, 0.33 and 0.32, for fish A, B and C, respectively). (A) Fish A, (B) fish B and (C) fish C.

EOD rate

We found no relationship between EOD rate and change in direction. The mean EOD rate for intervals temporally close to and including sharp turns (±1.5 s; see Materials and Methods) was 74.4, 73.9 and 72.5 pulses s−1 for fish A, B and C, respectively. The intervals that were not identified as sharp turns and were not 1.5 s away from a sharp turn (intervals of straight head motion) had median EOD rates of 74.3, 72.7 and 72.6 pulses s−1 for fish A, B and C, respectively. As the fish are known to increase their EOD rate when near landmarks, we considered looking at open water only (>4 cm away from the landmarks). When only looking at open water swimming, EOD rates during sharp turns had means of 74.2, 72.8 and 72.3 pulses s−1 for fish A, B and C, respectively. During smooth motion, the average EOD rate was 74.0, 72.9 and 72.8 pulses s−1 for fish A, B and C, respectively. For the late fish, using the same threshold to define outliers as early fish, sharp turns had EOD rate with medians of 82.65, 77.34 and 76.4 pulses s−1 for fish A, B and C, respectively. During smooth motion, the median EOD rates were 114.07, 76.77 and 76.8 pulses s−1 for fish A, B and C, respectively. Jun et al. (2014) reported large increases in EOD rate (∼8 Hz) before and during the spontaneous initiation of movement. In contrast, there was clearly no significant difference in EOD rate between smooth swimming and sharp turns.

Effects of spatial learning on heading angle error

The heading angle error is the difference between the current direction the fish is heading and the direct direction towards the food (see Materials and Methods). Our initial comparison of the entire error distribution did not reveal any significant difference between early versus late learning fish (not shown). Given that the fish efficiently find food during late learning and heading angle error from a landmark to food is reduced after learning (Jun et al., 2015), we initially wondered whether the late fish that knew where the food was initially employed an ‘exploration’ strategy until they decided on an ‘exploitation’ strategy (Sutton and Barto, 2014), and, once they had estimated that they were close to the food, turned to swim directly towards it. To test this hypothesis, we divided each late trajectory into the first 50% and the last 50%. We then computed their distributions (one for the first 50%, and one for the last 50%). If the hypothesis was true, we would see a strong bias centered around 0 for the second half (when the fish goes straight to the food), and no bias in the first half.

Our hypothesis was wrong. The first half of the late learning trajectories had strong bias near 0, i.e. the fish were mostly headed towards the food (Fig. 4Ai–Ci, blue). In contrast, early learning trajectories were not biased to zero (Fig. 4Ai–Ci, green). The second half was not biased towards the food in either late (blue) or early (green) trials, i.e. the fish were headed more randomly with respect to the food (Fig. 4Aii–Cii). When the entire trajectory was examined, this difference was washed out.

Fig. 4.

Distribution of error in heading angle for the first (top) and last (bottom) 50% of each trajectory. Each trajectory has its distribution computed, the density of which is average for all trajectories in a single fish and learning status (early or late) for (A) fish A, (B) fish B and (C) fish C. This shows both the early learning trajectory distributions (in green) and the late learning trajectory distributions (in blue). On the radial axis, the (average) density of the distribution. The black circular line indicates the expected uniform distribution. A linear plot of the same data is presented below the radial plot and the black line indicates the uniform distribution. (Ai–Ci) The first 50% of each trajectory. Note the difference in distribution shape between early and late learning fish, centered around 0 for late learning and uniform or peaked far from 0 for early learning. (Aii–Cii) The last 50% of each trajectory. Note the lack of difference in distribution shape (both uniform) between early and late learning fish – both have random peaks not centered at 0.

Fig. 4.

Distribution of error in heading angle for the first (top) and last (bottom) 50% of each trajectory. Each trajectory has its distribution computed, the density of which is average for all trajectories in a single fish and learning status (early or late) for (A) fish A, (B) fish B and (C) fish C. This shows both the early learning trajectory distributions (in green) and the late learning trajectory distributions (in blue). On the radial axis, the (average) density of the distribution. The black circular line indicates the expected uniform distribution. A linear plot of the same data is presented below the radial plot and the black line indicates the uniform distribution. (Ai–Ci) The first 50% of each trajectory. Note the difference in distribution shape between early and late learning fish, centered around 0 for late learning and uniform or peaked far from 0 for early learning. (Aii–Cii) The last 50% of each trajectory. Note the lack of difference in distribution shape (both uniform) between early and late learning fish – both have random peaks not centered at 0.

We assessed these results statistically through the circular mean, statistic and Rayleigh test of uniformity (Mardia and Jupp, 2000) (Table S1) and found evidence consistent with the conclusions drawn from Fig. 4. These results indicate a difference between the first and second half of the trajectories. Particularly, we found some differences in the Rayleigh test P-values that make the first half of the late learning fish trajectories stand out from the second half and from the early learning trajectories. To a lesser extent, the for the first half of the late learning fish differs from the second half and from the early learning fish. These differences are not enough to be statistically significant. However, only splitting the trajectories into two results in large intervals of time. As a result, differences that are more finely time-dependent could be washed out and go undetected statistically. Thus, a finer-grained analysis is important for the purposes of meaningful statistical tests.

We therefore extended this analysis to an analysis of the change in heading error over time. We extracted ‘slices’ of trajectories. A slice is a sub-trajectory for a particular interval of time. As we do not have infinite data, we cannot take arbitrarily small slices. Nevertheless, we want it fine enough that we see progress over time (over the slice number). A balance between the two yields slices of 0.3 s (approximately 1/20th of most trajectories). We can look at the first 10 slices taken from late learning fish A as an example to see how the distribution of heading direction error changes over time (Fig. 5).

Fig. 5.

Distributions of error in heading angle of slices 1 to 10 (0.3 s each slice) visibly going from a unimodal distribution with a peak at 0 to a more uniform distribution lacking a single clear peak at 0. Late fish A trajectories were amalgamated (all trials were joined) to produce the slices of distributions. Within the first 3 s of the trajectory, there is a change in the distribution of error in heading angle.

Fig. 5.

Distributions of error in heading angle of slices 1 to 10 (0.3 s each slice) visibly going from a unimodal distribution with a peak at 0 to a more uniform distribution lacking a single clear peak at 0. Late fish A trajectories were amalgamated (all trials were joined) to produce the slices of distributions. Within the first 3 s of the trajectory, there is a change in the distribution of error in heading angle.

For the first five slices, the fish mostly heads towards the food, with randomly occurring trajectories with a lesser number of large heading angle errors that correspond to the loop structures seen in Fig. 1B. The last five trajectories paint a very different picture. There is no longer a clear high peak at 0; the heading angle error can have multiple peaks far from 0 (slices 6, 7 and 10) or appear nearly uniform (slices 8 and 9). In order to better understand this non-intuitive finding, we plotted the fish locations for all of these trials (Fig. 6A).

Fig. 6.

Fish locations per slice during trajectories in late learning. (A) For late fish A (as per Fig. 5), the gray cross indicates the food location, the blue triangle indicates the average position of the fish for that slice of time and the red dot indicates the nearest point to the food among the sub-trajectories’ locations. The nearest point to the food from the slices in the figure occurs at slice 10, with a distance of 8 cm. Shortly after, in slice 12 (not shown), the nearest distance goes under the threshold for food detection (<4 cm). (B) The average distance from food and the closest the fish came (nearest distance) to the food for the trajectories in A (late learning fish A). As in A, blue triangles indicate the average and red circles indicate the nearest point. The fish trajectories reach closer to the food in correspondence with the heading angle error becoming more uniform. (C) Fish B. (D) Fish C.

Fig. 6.

Fish locations per slice during trajectories in late learning. (A) For late fish A (as per Fig. 5), the gray cross indicates the food location, the blue triangle indicates the average position of the fish for that slice of time and the red dot indicates the nearest point to the food among the sub-trajectories’ locations. The nearest point to the food from the slices in the figure occurs at slice 10, with a distance of 8 cm. Shortly after, in slice 12 (not shown), the nearest distance goes under the threshold for food detection (<4 cm). (B) The average distance from food and the closest the fish came (nearest distance) to the food for the trajectories in A (late learning fish A). As in A, blue triangles indicate the average and red circles indicate the nearest point. The fish trajectories reach closer to the food in correspondence with the heading angle error becoming more uniform. (C) Fish B. (D) Fish C.

Here, we see that fish A on average appears to be moving towards the food and that its closest location to the food diminishes in the later slices. Combining the data illustrated in Figs 5 and 6 suggests that the fish is initially oriented towards the food but, as it becomes closer to food, its trajectories become more random and lose their precise orientation. Finally, we analyzed the overall change in trajectories for all three fish (Fig. 7).

Fig. 7.

Distance from the distribution of error in heading angle to uniform for slices of time (each slice is 0.3 s). (A) Early learning. The fish heading direction errors are consistently high and roughly the same distance from uniform through all slices (range: 0.28–0.55, average slope: −0.005, not significantly different from 0 with α=0.05, n=3). Light green, forest green and dark green correspond to fish A, B and C, respectively. (B) Late learning. The heading direction error distribution starts off far from uniform, corresponding to the peaks seen in Fig. 4Ai–Ci and Fig. 5 slices 1 to 5. The distribution gradually becomes closer to uniform, corresponding to the distributions of Fig. 4Aii–Cii and Fig. 5 slides 6 to 10. Light blue, blue-grey and dark blue correspond to fish A, B and C, respectively (range: 0.14–0.42, average slope: −0.021, significantly different from 0 with α=0.05, n=3). It is important to note that the early learning fish have fewer data points in their distributions because there were fewer early trajectories by definition. Thus, the distribution is naturally further from the underlying distribution (presumably a uniform distribution) and the l2 distance from the uniform distribution increases as a result. The late learning fish (12 trajectories for all fish) have twice the amount of data in each point, making it closer to the underlying distribution. Thus, the y-axis values of early and late learning in this figure are not comparable. The important conclusion is that one is a decreasing function (late) whereas the other is not (early).

Fig. 7.

Distance from the distribution of error in heading angle to uniform for slices of time (each slice is 0.3 s). (A) Early learning. The fish heading direction errors are consistently high and roughly the same distance from uniform through all slices (range: 0.28–0.55, average slope: −0.005, not significantly different from 0 with α=0.05, n=3). Light green, forest green and dark green correspond to fish A, B and C, respectively. (B) Late learning. The heading direction error distribution starts off far from uniform, corresponding to the peaks seen in Fig. 4Ai–Ci and Fig. 5 slices 1 to 5. The distribution gradually becomes closer to uniform, corresponding to the distributions of Fig. 4Aii–Cii and Fig. 5 slides 6 to 10. Light blue, blue-grey and dark blue correspond to fish A, B and C, respectively (range: 0.14–0.42, average slope: −0.021, significantly different from 0 with α=0.05, n=3). It is important to note that the early learning fish have fewer data points in their distributions because there were fewer early trajectories by definition. Thus, the distribution is naturally further from the underlying distribution (presumably a uniform distribution) and the l2 distance from the uniform distribution increases as a result. The late learning fish (12 trajectories for all fish) have twice the amount of data in each point, making it closer to the underlying distribution. Thus, the y-axis values of early and late learning in this figure are not comparable. The important conclusion is that one is a decreasing function (late) whereas the other is not (early).

Notice that the late learning distribution gradually converges to a uniform distribution (Fig. 7B) as the fish approach the food (average slope −0.021, one-sided t-test). This is not the case for early learning (Fig. 7A), where there is no downward slope, indicating no change in distribution (average slope −0.005, one sided t-test). This is a strong finding, showing a clear difference between early and late learning fish and reveals the unexpected finding that, after learning, the fish are initially more oriented towards the food but search more randomly when they near the food.

We considered the possibility that the fish were initially orienting to olfactory or passive electrosensory signals emanating from the food (Von der Emde and Bleckmann, 1998). Jun et al. (2015), using a strong increase in EOD rate, determined that the passive electric signal was detected at 4 cm from prey; the EOD rate increase did not occur during probe trials. The initial distance to prey location was far greater than 4 cm (87.3 cm) and was therefore unlikely to depend on passive electrosensory signals (Jun et al., 2015). We checked the probe trials when no food was present in order to determine whether olfactory cues might play a role in the initial orientation towards prey. We used two tests for this purpose. First, we found similar results of initial orientation to prey as in Fig. 5 for fish A (N=4) and fish C (N=3) but not fish B (N=4) (Fig. S1 illustrates this point for fish A). Second, we analyzed the distance the fish traversed before it reached the 4 cm passive electrosense detection distance. Because of the low sample size (early max. N=6, late max. N=12, probe max. N=4, per fish), we pooled all fish together to effectively triple the sample size (early N=17, late N=36, probe N=11). Using these pooled samples and for both median (Wilcoxon test) and mean (t-test), we found that the early trials took longer to get to 4 cm to the food than both the late and the probe trials. Meanwhile, the late and probe trials were not statistically different. The results are shown in Table 2. Because the tank was thoroughly cleaned before every probe trial, we can conclude that the fish do not orient themselves through a tuned olfactory sense, and instead use spatial information.

Table 2.

Time to 4 cm of the food and P-value of Wilcoxon test (for median) and t-test (for average)

Time to 4 cm of the food and P-value of Wilcoxon test (for median) and t-test (for average)
Time to 4 cm of the food and P-value of Wilcoxon test (for median) and t-test (for average)

Jun et al. (2015) first analyzed spatial learning of gymnotiform fish in the dark, i.e. when they only had their electrosense for identifying landmarks and food, and presumably learned to go from landmarks to food utilizing path integration via idiothetic cues (Jun et al., 2015; Wallach et al., 2018). Here, we updated this analysis by focusing on and comparing the trajectories taken during early versus late learning. In early learning, the trajectories are very complex, with stretches of relatively straight (low curvature) swimming interrupted by many sharp turns (outliers) that result in a very different swim direction (Fig. 2). The trajectories are also very different across trials. This is not surprising given that the fish has no idea as to the food location and is exploring its environment (Fig. 1A). In contrast, shorter trajectories of the late learning trials are mostly smooth with far fewer sharp turns (outliers in Fig. 2). The late trajectories are surprising in two ways. First, they are typically not a minimum energy straight route between home or a landmark and the food; instead, they may take complicated routes often consisting of loops that temporarily point away from the food (Fig. 1B). Second, the routes are not at all stereotyped but greatly vary from trial to trial (Fig. 1B). Given the great differences between early and late learning trajectories, we discuss them separately.

Early learning trajectories

Foraging has been extensively studied under two different conditions: (1) where cues (e.g. odorants) as to the food location are sparsely and erratically distributed in the animal's environment and (2) where there are no local cues that might serve to guide the animal's search and food is sparsely distributed over a large area. Two prominent strategies for the first case are ‘infotaxis’ (Vergassola et al., 2007) and ‘energy constrained proportional betting’ (Chen et al., 2020); both require continuous monitoring of the relevant sensory cue. Clearly, these strategies would not be applicable in our case, where there are no sensory cues available when the fish is far from home or a landmark (Jun et al., 2015). In the second case, a prominent theory suggests that foraging is a ‘Levy flight’ – random walks with distances between successive locations following a long-tailed power law distribution (Campeau et al., 2022; Viswanathan et al., 1996). Searching in these cases is typically over very long distances (Viswanathan et al., 1996). We found that the intervals (time or distance) between sharp turns were well described by an exponential distribution with only a poor fit by a power law distribution. However, it should be noted that the tank diameter used for the experiments was only 1.5 m (Jun et al., 2013) and so longer intervals were effectively not possible. In the wild, gymnotiform fish appear to forage over much larger areas (Steinbach, 1970; Henninger et al., 2020). It will therefore be important to study foraging of gymnotiform fish in the wild to determine whether the distance intervals between successive search sites also follow a putatively optimal power law distribution.

Jun et al. (2014) have noted that the fish utilized in our study made random swim starts. The underlying mechanisms for random swim starts and sharp turns are likely different. The intervals between random starts were lognormal with means ranging from 3.8 to 5.3 s, and thus longer than the mean of the exponential distribution of sharp turn intervals (1.4 to 1.6 s). Furthermore, there was no increase in EOD rate associated with sharp turns in contrast with the strong increase associated with swim starts (Jun et al., 2014). Melanson et al. (2017) proposed that the non-stationary dynamics driving random swim starts were driven over long time scales by the peptidergic hypothalamic neurons already known to be important for vertebrate motor activity.

In contrast, a recent theoretical analysis (Recanatesi et al., 2021) suggested that fast variable timing of behavior sequences could be generated by reciprocally coupling a thalamic feedforward nucleus with a cortical recurrent network to generate metastable attractors. The gymnotiform thalamus and pallium includes circuitry (Giassi et al., 2012a,b; Trinh et al., 2016; Elliot et al., 2016) and physiology (Trinh et al., 2019; Elliot and Maler, 2015), consistent with the Recanatesi et al. (2021) model. These pallial regions are already believed to be responsible for spatial learning and navigation (Fotowat et al., 2019; Wallach et al., 2018; Mazzitelli-Fuentes et al., 2022). Pulse gymnotiform fish may therefore be a simple model for investigating the neural bases of apparently random behavior over a wide range of time scales.

Late learning trajectories

Trajectories after learning initially head towards the food location, but, once near the site, the fish swims erratically (Figs 47). Although the number of sharp turns is reduced (Fig. 2), the fish's trajectories are rarely directly towards the food, but are still variable and often looped (Fig. 1). This is surprising because the energy expended to find food increases with trajectory length. We consider two, not necessarily exclusive, views as to why the initial straight heading for food is not maintained: (1) accumulation of path integration error and (2) a mechanism to reduce predictability and therefore predation.

The path integrator is dependent on noisy signals from multiple sources including vestibular and proprioceptive afferents, and these result in accumulation of error within the neural path integrator of a wide range of taxa including mammals (McNaughton et al., 1996), insects (Muller and Wehner, 2010) and shrimp (Patel and Cronin, 2020). Interestingly, in the shrimp, path integration error results in loops in the trajectory similar to those illustrated in Fig. 1. Our data are therefore consistent with Muller and Wehner (2010): in the absence of error correction by landmarks, the fish become increasingly uncertain as to the food location and switch to a random search strategy (Wallach et al., 2018).

A second hypothesis is that the trajectory variability serves to reduce predictability. Jun et al. (2014) hypothesized that the reason for the fish's random swim starts was to reduce predictability and therefore predation risk. By the same reasoning, we hypothesized that predictable direct routes to a food source would also increase predation risk and that this is mitigated by the unpredictable sharp turns within even late trajectories.

In either case, the vestibular system provides input heading direction via its responses to rotations in the horizontal plane and is therefore essential for path integration (Wiener et al., 1995). Vestibular afferents code best for frequencies <20 Hz (Sadeghi et al., 2007), and we assume that smooth turning motions are well encoded while the sharp turns may produce higher frequency signals that are not faithfully encoded. We hypothesize that the mostly smooth but variable trajectories are a search mechanism compensating for path integration error while the sharp turns may act to reduce predictability and predation risks.

Conclusions

Weakly electric fish learn to find food in the dark primarily by the use of path integration (Engelmann et al., 2021). The smooth learning curves reported by Jun et al. (2015) suggested that this was a simple process. Our more detailed analyses of the changes in trajectories during learning demonstrates that, even in a fish, spatial learning is far from simple and that factors other than minimizing trajectory length and duration play a role in the learning process.

We thank Simone Azeglio for discussions and help with data interpretation. We would also like to thank two anonymous reviewers for their suggestions that have greatly improved the quality of the paper.

Author contributions

Conceptualization: C.M., M.F., L.M.; Methodology: C.M., M.F., L.M.; Software: C.M.; Formal analysis: C.M.; Investigation: C.M.; Data curation: C.M.; Writing - original draft: C.M.; Writing - review & editing: C.M., M.F., L.M.; Visualization: C.M.; Supervision: M.F., L.M.; Project administration: C.M., M.F., L.M.; Funding acquisition: M.F., L.M.

Funding

We acknowledge the support of the Natural Sciences and Engineering Research Council of Canada (NSERC) funding reference numbers RGPIN-2017-06901 (M.F.) and RGPIN-2017-147489 (L.M.).

Alvernhe
,
A.
,
Sargolini
,
F.
and
Poucet
,
B.
(
2012
).
Rats build and update topological representations through exploration
.
Anim. Cogn.
15
,
359
-
368
.
Ardanaz
,
J. L.
,
Silva
,
A.
and
Macadar
,
O.
(
2001
).
Temperature sensitivity of the electric organ discharge waveform in Gymnotus carapo
.
J. Comp. Physiol. A
187
,
853
-
864
.
Balan
,
R.
and
Lamothe
,
G
. (
2011
).
Expect the Unexpected: A First Course in Biostatistics
.
World Scientific
.
Braithwaite
,
V. A.
,
Armstrong
,
J. D.
,
McAdam
,
H. M.
and
Huntingford
,
F. A.
(
1996
).
Can juvenile Atlantic salmon use multiple cue systems in spatial learning?
Anim. Behav.
51
,
1409
-
1415
.
Campeau
,
W.
,
Simons
,
A. M.
and
Stevens
,
B.
(
2022
).
The evolutionary maintenance of Lévy flight foraging
.
PLoS Comput. Biol.
18
,
e1009490
.
Chen
,
C.
,
Murphey
,
T.
and
MacIver
,
M. A.
(
2020
).
Tuning movement for sensing in an uncertain world
.
eLife
9
,
e52371
.
Elliot
,
B. S.
and
Maler
,
L.
(
2015
).
Stimulus-induced up states in the dorsal pallium of a weakly electric fish
.
J. Neurophysiol.
114
,
2071
-
2076
.
Elliot
,
B. S.
,
Harvey-Girard
,
E.
,
Giassi
,
A. C. C.
and
Maler
,
L.
(
2016
).
Hippocampal-like circuitry in the pallium of an electric fish: Possible substrates for recursive pattern separation and completion
.
Comp. Neurol.
525
,
8
-
46
.
Engelmann
,
J.
,
Wallach
,
A.
and
Maler
,
L.
(
2021
).
Linking active sensing and spatial learning in weakly electric fish
.
Curr. Opin. Neurobiol.
71
,
1
-
10
.
Fonio
,
E.
,
Benjamini
,
Y.
and
Golani
,
I.
(
2009
).
Freedom of movement and the stability of its unfolding in free exploration of mice
.
Proc. Natl. Acad. Sci. USA
106
,
21335
-
21340
.
Fotowat
,
H.
,
Lee
,
C.
,
Jun
,
J. J.
and
Maler
,
L.
(
2019
).
Neural activity in a hippocampus-like region of the teleost pallium is associated with active sensing and navigation
.
Elife
8
,
e44119
.
Giassi
,
A. C. C.
,
Ellis
,
W.
and
Maler
,
L.
(
2012a
).
Organization of the gymnotiform fish pallium in relation to learning and memory: III. Intrinsic connections
.
Comp. Neurol.
520
,
3369
-
3394
.
Giassi
,
A. C. C.
,
Duarte
,
T. T.
,
Ellis
,
W.
and
Maler
,
L.
(
2012b
).
Organization of the gymnotiform fish pallium in relation to learning and memory: II. Extrinsic connections
.
Comp. Neurol.
520
,
3338
-
3368
.
Henninger
,
J.
,
Krahe
,
R.
,
Sinz
,
F.
and
Benda
,
J.
(
2020
).
Tracking activity patterns of a multispecies community of gymnotiform weakly electric fish in their neotropical habitat without tagging
.
J. Exp. Biol.
223
,
jeb206342
.
Jammalamadaka
,
S. R.
and
Sengupta
,
A
. (
2001
).
Topics in Circular Statistics
, Vol.
5
.
World Scientific
.
Jun
,
J. J.
,
Longtin
,
A.
and
Maler
,
L.
(
2013
).
Real-time localization of moving dipole sources for tracking multiple free-swimming weakly electric fish
.
PloS one
8
,
e66596
.
Jun
,
J. J.
,
Longtin
,
A.
and
Maler
,
L.
(
2014
).
Enhanced sensory sampling precedes self-initiated locomotion in an electric fish
.
J. Exp. Biol.
217
,
2577
-
2592
.
Jun
,
J. J.
,
Longtin
,
A.
and
Maler
,
L.
(
2015
).
Active sensing associated with spatial learning reveals memory-based attention in an electric fish
.
J. Neurophysiol.
115
,
2577
-
2592
.
Lührs
,
M. L.
,
Dammhahn
,
M.
,
Kappeler
,
P. M.
and
Fichtel
,
C.
(
2009
).
Spatial memory in the grey mouse lemur (Microcebus murinus)
.
Anim. Cogn.
12
,
599
-
609
.
Mardia
,
K. V.
and
Jupp
,
P. E
. (
2000
).
Directional Statistics
.
John Wiley and Sons
.
Mazzitelli-Fuentes
,
L. S.
,
Román
,
F. R.
,
Castillo
,
E. J. R.
,
Deleglise
,
E. B.
and
Mongiat
,
L. A.
(
2022
).
Spatial learning promotes adult neurogenesis in specific regions of the Zebrafish pallium
.
Front. Cell Dev. Biol
10
,
840964
.
McNaughton
,
B. L.
,
Barnes
,
C. A.
,
Gerrard
,
J. L.
,
Gothard
,
K.
,
Jung
,
M. W.
,
Knierim
,
J. J.
,
Kudrimoti
,
H.
,
Qin
,
Y.
,
Skaggs
,
W. E.
,
Suster
,
M.
et al. 
(
1996
).
Deciphering the hippocampal polyglot: the hippocampus as a path integration system
.
J. Exp. Biol.
199
,
173
-
185
.
Melanson
,
A.
,
Meijas
,
J. F.
,
Jun
,
J. J.
,
Maler
,
L.
,
Longtin
,
A.
(
2017
).
Nonstationary Stochastic Dynamics Underlie Spontaneous Transitions between Active and Inactive Behavioral States
.
eNeuro
4
,
ENEURO.0355-16.2017
.
Muller
,
M.
and
Wehner
,
R.
(
2010
).
Path integration provides a scaffold for landmark learning in desert ants
.
Curr. Biol.
20
,
1368
-
1371
.
Patel
,
R. N.
and
Cronin
,
T. W.
(
2020
).
Path integration error and adaptable search behaviors in a mantis shrimp
.
J. Exp. Biol.
223
, jeb
224618
.
Recanatesi
,
S.
,
Pereira-Obilinovic
,
U.
,
Murakami
,
M.
and
Mainen
,
Z.
(
2021
).
Metastable attractors explain the variable timing of stable behavioral action sequences
.
Neuron
110
,
139
-
153
.
Sadeghi
,
S. G.
,
Chacron
,
M. J.
,
Taylor
,
M. C.
and
Cullen
,
K. E.
(
2007
).
Neural variability, detection thresholds, and information transmission in the vestibular system
.
J. Neurosci.
27
,
771
-
781
.
Save
,
E.
,
Cressant
,
A.
,
Thinus-Blanc
,
C.
and
Poucet
,
B.
(
1998
).
Spatial firing of hippocampal place cells in blind rats
.
J. Neurosci.
18
,
1818
-
1826
.
Steinbach
,
A. B.
(
1970
).
Diurnal movements and discharge characteristics of electric gymnotid fishes in the Rio Negro, Brazil
.
Biol. Bull.
138
,
200
-
210
.
Sutton
,
R. S.
and
Barto
,
A. G
. (
2014
).
Reinforcement Learning: An Introduction
.
The MIT Press
.
Trinh
,
A.-T.
,
Harvey-Girard
,
E.
,
Teixeira
,
F.
and
Maler
,
L.
(
2016
).
Cryptic laminar and columnar organization in the dorsolateral pallium of a weakly electric fish
.
J. Comp. Neurol
524
,
408
-
428
.
Trinh
,
A.-T.
,
Clarke
,
S. E.
,
Harvey-Girard
,
E.
and
Maler
,
L.
(
2019
).
Cellular and network mechanisms may generate sparse coding of sequential object encounters in hippocampal-like circuits
.
eNeuro
6
,
ENEURO.0108-19.2019
.
Vergassola
,
M.
,
Villermaux
,
E.
and
Shraiman
,
B.
(
2007
).
‘Infotaxis’ as a strategy for searching without gradients
.
Nature
445
,
406
-
409
.
Viswanathan
,
G.
,
Afanasyev
,
V.
,
Buldyrev
,
S.
,
Murphy
,
E. J.
,
Prince
,
P. A.
and
Stanley
,
H. E.
(
1996
).
Lévy flight search patterns of wandering albatrosses
.
Nature
381
,
413
-
415
.
Von der Emde
,
G.
and
Bleckmann
,
H.
(
1998
).
Finding food: senses involved in foraging for insect larvae in the electric fish Gnathonemus petersii
.
J. Exp. Biol.
201
,
969
-
980
.
Wallach
,
A.
,
Harvey-Girard
,
E.
,
Jun
,
J. J.
,
Longtin
,
A.
and
Maler
,
L.
(
2018
).
A time-stamp mechanism may provide temporal information necessary for egocentric to allocentric spatial transformations
.
eLife
7
,
e36769
.
Wiener
,
S. I.
,
Korshunov
,
V. A.
,
Garcia
,
R.
and
Berthoz
,
A.
(
1995
).
Inertial, substratal and landmark cue control of hippocampal CA1 place cell activity
.
Eur. J. Neurosci.
7
,
2206
-
2219
.

Competing interests

The authors declare no competing or financial interests.

Supplementary information