arXiv:1711.07446v2 [q-bio.QM] 18 Dec 2017

A generalised framework for detailed classification of
swimming paths inside the Morris Water Maze
Avgoustinos Vourosa,d , Tiago V. Gehringa , Kinga Szydlowskab , Artur Januszb ,
Mike Crouchera , Katarzyna Lukasiukb , Witold Konopkab , Carmen Sandic ,
Zehai Tua , Eleni Vasilakia,e
a The

University of Sheffield, Faculty of Engineering, Department of Computer Science,
Sheffield, UK
b Nencki Institute of Experimental Biology, Department of Molecular and Cellular
Neurobiology, Warsaw, Poland
c Laboratory of Behavioral Genetics, Brain Mind Institute, EPFL, Lausanne, Switzerland
d avouros1@sheffield.ac.uk
e e.vasilaki@sheffield.ac.uk

Abstract
The Morris Water Maze is commonly used in behavioural neuroscience for the
study of spatial learning with rodents. Over the years, various methods of
analysing rodent data collected during this task have been proposed. These
methods span from classical performance measurements (e.g. escape latency,
rodent speed, quadrant preference) to more sophisticated methods of categorisation which classify the animal swimming path into behavioural classes known as
exploration strategies. Classification techniques provide additional insight about
the different types of animal behaviours but still only a limited amount of studies
utilise them mainly because they highly depend on machine learning knowledge.
We have previously demonstrated that the animals implement various strategies
and by classifying whole trajectories can lead to the loss of important information.
In this work, we developed a generalised and robust classification methodology
which implements majority voting to boost the classification performance and
successfully nullify the need of manual tuning. Based on this framework, we
built a complete software, capable of performing the full analysis described in
this paper. The software provides an easy to use graphical user interface (GUI)
through which users can enter their trajectory data, segment and label them
and finally generate reports and figures of the results.
Keywords: Morris Water Maze, navigation, behavioural category,
semi-supervised clustering, learning memory, classification boosting

1. Introduction
The Morris Water Maze (MWM), designed by Richard Morris, was first
described back in 1981 in a study regarding the spatial localisation of rats [1].
The MWM quickly became very popular and by the end of the eighties a large
1

number of published work using the MWM had been reported [2]. For instance,
the review work of D’Hooge and Deyn mentions more than 2000 publications
related to the MWM task within the decade 1990-2001 [3]. More recently,
virtual forms of the MWM have been used directly on human subjects and this
generalisation made it possible to comparatively assess human and rodent place
navigation [4], compare spatial learning between sexes [5] and directly study
how certain factors (e.g. stimuli, age, etc.) affect the spatial navigation and how
certain areas of the brain perform under the effects of them ([6],[7],[8],[9]).
In a typical MWM experiment the rodent is placed inside a circular pool
filled with water and is tasked to find a hidden platform, which is placed in one
of the four quadrants of the pool. Since the animal is unable to see the platform,
it has to rely on external visual cues in order to navigate inside the pool and
find the platform. After a number of trials, it is expected that the animal will
have learned the location of the platform and will therefore be able to find it in
less time than in the beginning of the trials [10].
Most of the studies using the MWM experiment utilise several measurements
of performance in order to assess learning and memory. Many of these measurements have also been used to ensure that the animal groups have equal skills and
abilities (e.g. swimming ability, speed, ‘understanding’ of the escape mechanism)
[11, 12]. Notable measurements include the time that the animal spends inside
each quadrant of the pool, the latency of finding the platform in each trial, the
directionality and the total swimming distance on each trial [10, 2, 13]. There are
also a number of more sophisticated measurements such the body temperature
of the animals throughout the experiment [14] or the cumulative distance to
platform, which is the distance between the animal location and the platform
location calculated a number of times with a specific sampling rate [15, 16].
These simplistic measurements and statistics have been criticised as insufficient to capture all the different animal behaviours that are present during the
MWM experiments [16, 17]. For this reason researchers started to study the
various behaviours that the animals were expressing inside the pool, which are
known as exploration strategies. Notable are the studies of Wolfer et al., who
computed a large amount of measures for each animal swimming path inside
the maze in order to categorise the various animal strategies [18, 19, 20]. Other
studies include the automatic classification procedures of Graziano et al. [21]
and Garthe et al. [22]. Both of them specified regions of interest inside the arena
but the categorisation method of Graziano et al. was based on a number of path
measures while in work of Garthe et al. a hierarchical classification algorithm
was used and the categorisation of each swimming path was mainly based on
the amount of time that the animal spent in each region. The latter method
was also used in more recent studies ([23],[24]).
A point of criticism of the aforementioned studies is that the classification
procedure requires prior knowledge of animal behaviour strategies, while manual
classification of each trajectory is subject to bias [25]. Thus the study of Illouz
et al. attempted to minimise the human error and to create an unbiased analysis
by an automatic classification procedure based on support vector machines [26].
In their work, they extracted a set of 11 features from the X and Y coordinates
2

of the animal trajectories and using a database of labelled data (swimming paths
with pre-defined classes) they were able to automatically classify a large amount
of full animal trajectories by performing a series of hierarchical decisions.
In our previous work [17] we argued that animals employ several strategies
during each trial in order to find the platform and by assigning whole animal
trajectories to single behavioural classes results in the loss of important information. For this reason, we proposed a more sophisticated automatic quantification
methodology capable of classifying and presenting the various animal behaviours
in much more detail during each trial. According to this approach, the animal
swimming path is first split into segments and then the segments are classified
into behavioural strategies. In this way, changes in the animal behaviour within
each trial can be detected and the animal swimming path, as a whole, falls under
more than one strategies, revealing how the animal behaviour involved within
the trial.
For the classification of the segments we used a semi-supervised classification
procedure which requires manual classification (labelling) of a small amount of
data. An advantage of this procedure was that our classification is based on
a clustering algorithm which is able to detect patterns in the data. Therefore,
the behavioural classes didn’t necessarily have to be defined a priori. On the
other hand, the method developed in our previous study required a certain
degree of knowledge about machine learning methods, which prevented the direct
application of the methodology to other datasets.
In this work, we present an automatic boosted classification procedure based
on majority voting, which improves on the classification error, and a validation
framework which leads to conclusions with a high degree of confidence. Finally,
the software tools implemented for our previous work [17] have been re-engineered
in order to produce a fully working software capable of performing all of our
analyses, without requiring machine learning knowledge from the user. This software is called RODA (ROdent Data Analytics) [27] and is focused on the MWM
experiment. It provides an easy to use graphical user interface (GUI) for loading
the data and defining the experimental specifications. It also supports automatic
segmentation and semi-automatic classification, and produces quality figures
which can be exported into various image formats. The software is available on
the github repository https://github.com/RodentDataAnalytics/mwm-ml-gen
under the GNU General Public License version 3 (GPL-3.0).
2. Materials and Methods
2.1. Analysis Overview
In our proposed analysis method, the swimming paths of the animals inside
the Morris Water maze are divided into segments of approximately equal length
and a certain overlap percentage. For each segment a set of eight features is
computed. The features are then used in the classification procedure. Finally, a
small portion of the segments needs also to be assigned manually to a specific
strategy (labelling); this information is used as prior knowledge to guide the
classification procedure.
3

Our classification procedure, which assigns segments to classes of behaviour,
is based on a semi-supervised clustering algorithm called Metric Pairwise Constrained K-Means (MPCK-Means) [28]. This algorithm incorporates the two
main approaches of semi-supervised clustering: metric learning (the measuring
of similarity, ‘distance’, between data) and constrained-based learning (the use
of labels or constrains that produce a better grouping of the data) [28]. To turn
the algorithm into a classifier, the labelled data were used not only to guide
the clustering process but also to assign clusters to classes (see supplementary
material for more details).
However, a common issue with many clustering algorithms, including MPCKMeans, is that a predefined number of target clusters needs to be provided; this
number indicates the amount of clusters in which our data will be partitioned.
Determining the optimal number of target clusters is challenging and, although
many different quality measures were proposed over time [29], this value will
depend on the specific clustering method and data at hand.
In this work, instead of searching for an optimal number of clusters and
attempting to generate an optimal classifier, we select to generate a pool of ‘strong’
classifiers whose ‘goodness’ is assessed based on the 10-fold cross validation error.
The strong classifiers generated in that way are then used to form an ‘ensemble’
which uses majority voting to reach a classification decision. The two conditions
of having both strong and diverse classifiers are essential in majority voting in
order to reach an optimal classification solution [30, 31]. This will be discussed
in more detail later. In order to assess the labelling procedure (if enough
and consistent labels have been provided) the criterion of having a minimum
of 40 strong classifiers has been added prior to majority voting. Finally, the
classification result of the ensemble is expected to have a low percentage of
unclassified segments (less than 3%) because, since the classifiers are diverse,
they will do different errors or will fail to classify different segments. Thus if they
work together and form an ensemble, the individual errors will be compensated
by the correct responses of the other members of the ensemble [30]. A diagram
of the procedure is illustrated in figure 1.
2.2. Trajectories Segmentation and Partial Labelling
To assign one trajectory to multiple classes, we earlier proposed the division of
the full animal swimming paths into segments [17]. In our method each segment
overlaps significantly with its previous one (percentages of 70% and 90% have
been performed on this analysis) to make sure that important information is not
lost due to an unfavourable segmentation. The segment length was empirically
selected to be equal to or slightly longer than one arena diameter. If the segment
length is too short it might be difficult to identify to which class segments
belong; if it’s too long it might happen that more than one class of behaviour is
represented. The latter case can be seen in our results, where the large segment
length (3 times the arena radius) causes some classes to be overshadowed by the
more common classes (refer to figure 7).
In this study, nine predefined strategies were adopted (see Classes of Behaviour). We have found empirically that the amount of data that needs to be
4

Figure 1: Workflow diagram illustrating the analysis procedure. Cyan boxes indicate
automatic process; orange boxes indicate objects of importance or results; Partial Labelling
box (magenta) implies extensive user interaction with the process; grey boxes group the
processes taking part in the classification procedure. After the trajectories segmentation,
eight trajectories features for each segment are computed and a certain number of segments
is manually labelled. Afterwards a pool of classifiers is generated. ‘Strong’ classifiers (cross
validation error < 25%) are then selected from the pool and work together (majority voting) as
a team (ensemble) to produce the classification results. Throughout the process the labelling
quality is constantly assessed and in case of weak classification results we go back to the
labelling stage.

labelled should be roughly between 8% to 12% of the total segment number but
the exact value depends greatly on the dataset under investigation. As a rule of
thumb, if fewer labels are provided then the classification results will be poor in

5

the sense that a lot of segments will remain unclassified or fall under the wrong
class. Since the labelling procedure is prone to error and subjectivity a number
of validation criteria have been implemented throughout our analysis (see figure
1).
2.3. Classification Boosting with Majority Voting
The classification boosting is an ensemble technique that is based on the idea
that many weak learners can be converted to a strong learner [32]. In machine
learning terms an ensemble of weak classifiers (classifiers that make mistakes)
can be used to form a strong classifier (classifier that makes far less mistakes)
by combining each individual’s opinion [33, 34]. This approach has been used in
various classification tasks (see Oza et al. [35] for a survey) and in addressing
complex real-world problems, when single algorithmic classification solutions are
unable to achieve high performances [36].
One way to perform classification boosting is through majority voting [33]:
many classifiers form an ensemble, vote for the class of each datapoint and the
class with the more votes wins. The output of the ensemble is expected to have
an improved accuracy since individual errors of each classifier are compensated
by the correct responses of the other members of the ensemble [30]. However, in
order to achieve such outcome, the classifiers need to be diverse (they should not
share the same errors) [37, 33]. In fact, according to [30] and [38], diversity is not
enough to ensure that randomly selected classifiers will achieve high classification
accuracy, under the scenario that all the classifiers are arbitrary week. Classifiers
have to also be strong meaning that they should be sufficiently accurate on their
own ([38]) and [39] indicate an accuracy of at least 50%).
2.3.1. Majority Voting Implementation
In our framework, we need to classify different trajectory segments into
animal behavioural classes (strategies) having only a partial set of labelled
data. The classification is parametrized by the target number of clusters of the
clustering algorithm, a value that is difficult to estimate a priori. In order to
overcome this problem we therefore generate a number of classifiers by providing
different numbers of target clusters in succession; in the end of this process a
pool of classifiers is generated. We use the 10-fold cross validation [40] process
to evaluate different number of target clusters (10 to 100). Only classifiers
with a validation error lower than 25% are used to form an ensemble (for more
information about the 10-fold cross validation procedure refer to the appendix).
We set the minimum amount of required classifiers that fulfill this criteria to
40. The reasoning behind this process is that we require a sufficient number of
‘strong’ classifiers. For the majority voting, we consider the simple scheme where
the vote of each classifier has the same weight [41, 42] and that in case of a draw
the datapoint (segment) is marked as unclassified.
2.4. Framework Validation
The validation process of the framework (see figure 2) aims to prove that
different segmentation configurations are able to lead to the same conclusion
6

(segmentation robustness). More specifically, it was used to define the bounds
(error margins) for the segment length between which we have consistent analysis
conclusions.
Throughout the validation stage and the data analysis process as a whole we
considered certain statistics and validity measurements which will be described
next.

Figure 2: Validation stage. Cyan boxes indicate automatic process; orange boxes indicate
objects of importance or results; grey boxes indicate the classification procedure. Different
segmentation configurations (varied segments length and overlap) have been tested in order to
prove that the conclusions are consistent (they are not based on a particular segmentation)
and to define the bounds for the segment length between which we have the same analysis
conclusions. Refer to table 1 for the properties of each configuration.

2.5. Statistics
The non-parametric Friedman test [43] was used for the analysis of variance
of each strategy between the two animal groups. This test was selected because
the data are not normally distributed and because of its ability to control the
variability among subjects over the different observations [44].
For our analysis the null hypothesis is that there in no difference between the
two animal groups (stress and control) over each one of the strategies (refer to
section 2.10) as well as over the number of times that the animals change their
behaviour within single trials (strategy transitions). Small p-values (< 0.05%)
generated by the Friedman test lead us to discard the null hypothesis that the
results are identical and that any differences are only due to chance (random
sampling).
In addition to the Friedman test, the 95% confidence intervals of a binomial
distribution [45] are being used, where the significance of a specific classification,
as judged by each of the classifiers that form the ensemble, is viewed as a

7

random process generating one (significant differences) or zero (non-significant
differences). In more detail, the confidence intervals indicate our confidence
that the classifiers forming the ensemble are on average pointing to the same
conclusion as the ensemble (i.e. the majority agrees that there is significant
difference over strategies or strategies transitions). Given that the Friedman
test can have two outcomes, we hypothesise the outcomes to be the result of a
binomial distribution. We require that the 95% confidence intervals to be clearly
above 0.5 (or 50%) in order to be confident that the result in not due to chance
[46, 47].
2.6. Validity Measures
In the section below we discuss the classifier diversity and the percentage of
unclassified segments which are our key criteria use to validate the classification
process.
2.6.1. Classifier Diversity
To evaluate the diversity of the classifiers, we assess the percentage of their
agreement for the class of each segment. The result is a symmetric matrix
with rows and columns representing the classifiers and each element shows the
percentage of segments for which two classifiers agree on the assigned class. The
diagonal values of this matrix equal to 100 as each classifier is in 100% agreement
with itself (refer to figure E.12 in the appendix section for an example of an
agreement matrix). An overall agreement can be computed by averaging the
upper or lower triangular of the matrix. In addition, we consider the average
cross validation error (accuracy) over the classifiers. In order for the classifiers
to be both diverse and strong it is expected that they should have an average
percentage of agreement well below 100% (in our case around 60%) and low
cross validation error (refer to Table 2).
As it has been previously reported [30], ensembles have far less variance in
comparison with the classifiers thus it is expected to have much higher agreement.
To demonstrate this observation, we generated a number of ensembles by picking
classifiers at random from the pool. Afterwards we performed the same statistical
measurement of agreement for the ensembles, similar to the one described for
the classifiers. In contrast to the classifiers, the ensembles have high agreements
among them (more than 80%) and nearly nullify the cross validation error of
the classifiers 2. However, since in our method the cross validation was used for
both tuning and testing [17], additionally we manually assess the error of the
ensembles on two out of the four segmentations (see the appendix section).
2.6.2. Percentage of unclassified segments
A useful measure for the quality of the classification is the percentage of
unclassified segments. For certain segments, it is expected that none of the
classifiers in the ensamble will be able to determine a class, or that there could
be a draw for segments that transit between classes (refer to the results section
Table 3). This, however, does not have an impact on the results consistency (see
figure 7).
8

2.7. Mapping Segment Classes to the Full Swimming Paths
The classification has been performed on overlapping segments of the animals’ swimming paths, and therefore we need to map them back to the whole
trajectories.
As a first approach, we considered the classified segments as continuous
parts of the trajectories ignoring the overlap percentage. This method provides
consistent results on the significant differences of the strategies but fails to detect
differences on strategies transition between groups (refer to figure F.13 in the
appendix section). The reason for this is that sparse segments within each
swimming path fall under different classes thus viewing them as a sequence leads
to an overestimation of transitions (a transition happens when a segment falls
under a different class after a sequence of segments that fall under the same
class).
To address this limitation, we use a smoothing technique with parameters
independent of the segmentation choices. This was done for the following
reason: (i) to avoid subjective conclusions based on a specific segmentation
configuration and (ii) to be able to directly compare different segmentations. In
more detail, given that R equals to the radius of the arena, the swimming paths
are now divided into intervals of length R. Each of the intervals is assigned to a
certain class based on a weighed voting of all the overlapping segments. The
mathematical expression for this operation is shown in equation 1,
d2
ij

X

CTi ≡ argck max
(

Sj ∈ck
Ti ∩Sj 6=∅

wk · e− 2·σ2

(1)

)

where Ti is the ith interval, di,j is the distance from the centre of the jth segment
(Sj ) overlapping with the ith interval to the centre of the ith interval,
ck is the
P
wk = 1. The
kth segment class and wk is a class weight normalised so that
sum is to be taken over the segments intersecting with the interval Ti , belong to
class ck (unclassified segments are excluded) and fulfill the threshold requirement
d2
ij

e− 2·σ2 >= 0.14, where σ is the variance of the Gaussian and the value 0.14 is
obtained when dij = 2 · σ. The reason for the latest requirement is to create
a cutoff for the segments that are too far away from the centre of the interval.
The parameter σ controls the weight of the vote of each segment based on its
distance from the interval and in our analysis it was set equal to R in order to
achieve proportionality with the arena dimensions (other values have also been
tested, refer to the appendix section). Finally, the class weight wk was defined
as wk = P (c1 k ) , where P (ck ) is the percentage of segments belonging to class k.
The intuition for setting the class weights inversely proportional to the amount
of segments that fall under each class was to prevent more rare classes to be
overshadowed by more common ones. To prevent having too small or too large
class weights the bounds of [0.01 0.5] were set, which means that if less than 1%
or more than 50% of the segments fall under a certain category then this class
will receive weight equal to 0.5 or 0.01 respectively.

9

2.8. The RODA Software
The RODA software [27] (shown in Figure 3), which implements this framework, consists of a series of graphical user interfaces (GUIs) which offer straightforward analysis of trajectory data extracted from the Noldus Ethovision System
[48]. Every stage of the process can be tuned to meet the user’s need. The
generated figures can be exported into a variety of different image formats (JPEG,
TIFF, etc.) while the numerical data depicted in the figures are also saved in
Comma Separated Values (CSV) file format in case the user wishes to generate
the figures using a different software (e.g. Microsoft Excel).

Figure 3: Screenshots of the software. Each window is numbered to denote a separate
stage of the workflow, which consists of: (1) the data input GUI, which is used to load the
trajectory data extracted from Ethovision and select the specific tracks that will be used in the
analysis; (2) the segmentation panel, which offers fully control over the segmentation options;
(3) the labelling GUI, which offers visualisation of the whole trajectories and their segments
allowing easy labelling of the segments; (4) the classification GUI, which contains options
to tune various parts of the classification process; (5) the results panel; which generates the
analysis results. The results are generated in both graphical as well as text format. The
user has also control over the output format of the image files as well as the elements of
the generated figures such as text size, line width, etc. The arrow connecting (5) with (3)
indicates that if the analysis results are not consistent then we need to go back to the labelling
stage and provide more or better labels.

The software is entirely written on MATLAB and uses a modified version
of the WEKA library [49] written in JAVA which is known as WekaUT (for
more information refer to http://www.cs.utexas.edu/users/ml/risc/code/) for
the clustering procedure.
10

2.9. Morris Water Maze Experiment and Data Properties
The data have been collected from experiments performed at the Laboratory
of Behavioural Genetics, EPFL at Lausanne, Switzerland. All procedures were
conducted in conformity with the Swiss National Institutional Guidelines on
Animal Experimentation and approved by a license from the Swiss Cantonal
Veterinary Office Committee for Animal Experimentation.
The water maze had a diameter of 200cm with a submerged platform of
diameter 12cm. The recordings of the animals trajectories were performed by
using the tracking software, Noldues EthoVision [48] version 3.1. The dataset
contains 57 rats, 30 of which were inducted into stress at peripubertal age [50]
and 27 of which were the control group. A total of 12 trials were performed per
animal divided into 3 consecutive days with 4 trials per day. The timeout of
each trial was 90 seconds and if the animal failed to find the platform within
the time limit it was guided to it. The inter-trial interval between the trials of
the same day was only a few minutes. The starting position of the animals was
altered between trials.
2.10. Classes of Behaviour
The choice of the classes of behaviours (strategies) in our analysis is motivated
by previous studies (e.g. [51, 20, 21]) which have observed and reported stereotypical animal behaviours inside the MWM (for an example of each strategy
refer to the appendix section).
Thigmotaxis. The animal moves exclusively on the periphery of the arena and
most of the time it touches the walls of the arena.
Incursion. The animal starts to distant itself from the arena periphery with
visible inward movements.
Scanning. A behaviour associated with random searches focused in the centre
of the pool. Another characteristic of this behaviour is that the animal rapidly
turns away from the arena walls if it touches them [21].
Focused Search. This behaviour is also associated with random searches but
here the animal actively searches a particular small region of the arena.
Chaining Response. A behaviour first observed in the study of Wolfer et al.
[18] where the animal appears to have memorised the distance to the platform
from the arena wall and swims circularly in order to find it.
Self Orienting. The animal performs a loop and orients itself inside the arena
[21].
Scanning Surroundings. The animal crosses a region very close to the platform of the arena but moves away [17].
Scanning Target. The animal actively searches for the arena by swapping
paths around it.
Direct Finding. The animal navigates straight to the platform.
2.11. Abbreviations
In some figures the following strategies abbreviations are being used: Thigmotaxis (TT), Incursion (IC), Scanning (SC), Focused Search (FS), Chaining
11

Response (CR), Self Orienting (SO), Scanning Surroundings (SS), Target Scanning (ST), Direct Finding (DF). In addition, we have analysed the number of
times that the animals change their behaviour within single trials (Strategy
Transitions or tr).
3. Results
3.1. Advantages of Trajectory Segmentation Analysis
Our methodology finds quantitative behavioural differences in comparison
with standard metrics on the full swimming paths of the animals. It is able to
detect additional significant differences between the strategies employed by the
two animal groups in comparison to the categorisation of the whole animals
trajectories.
In more detail, we report that the two animal groups (stress and control) differ
on the strategies of Thigmotaxis, Incursion and Chaining Response and strategies
transitions (see figure 7) in favour of the stress group meaning that stressed
animals implement these strategies and transit between different strategies more
often than the control animals (see figure 6).
Commonly used measurements of learning (animal speed, escape latency
and path length) suggest that there is a significant difference among the two
animal groups in the sense that the stress animals are faster and swap longer
paths within the trials but they still fail to find the platform in less time than
the control animals (see figure 4). Our analysis suggests that the reason for
this phenomenon is that stressed animals tend to use more low level strategies
(Thigmotaxis and Incursion) which lower their chances on finding the platform
since they spent most of the time close to the arena periphery. More high
level cognitive strategies such as scanning target do not show any significant
difference between the two groups except the Chaining Response strategy. The
latter implies that stress animals haven’t memorised exactly the location of the
platform but its distance to the wall; so they swim at that distance in hope
to find it by chance. Stressed animals also change strategy more often than
non-stressed animals. These results are relevant to studies such as [52, 53, 54]
which suggests that high levels of stress lead to weak attention and frequent
behavioural switches. Categorisation of the full animal swimming paths failed
to detect distinctive strategies such as Chaining Response; it only manages to
capture differences for the Thigmotaxis strategy (see figure 5).

12

Figure 4: Full swimming path standard metrics for the stress (black) and control
(white) animal groups. All the animals were tested for a set of 12 trials divided in 3 sessions
(days). Bars represent the first and third quartiles of the data; the grey line that splits the
bars represents the median, crosses are the outliers and whiskers indicate the minimum and
the maximum values. The Friedman test p-value over the trials is shown on the top right of
each plot. Stress animals find the platform as fast as the control group (A. escape latency,
p-value: 0.15) even though they run faster (B. speed, p-value: 2x10−8 ) and sweep (on average)
longer swimming paths (C. path length, p-value: 0.0017) within the trials than the control
group.

Figure 5: Manual classification of the full swimming paths. In the manual classification
of the full swimming paths significant differences in certain categories (Focused Search, Chaining
Response and Scanning Surroundings) couldn’t be identified. Significant difference (p-value
equal to 0.015) was detected only for the Thigmotaxis strategy. White bars: control group;
Black bars: stress group. The two groups were compared over the complete set of trials using
the Friedman test (shown on the top right corner of each graph.)

13

Figure 6: Percentage of segments falling under each strategy for the stress (black)
and control (white) animal groups over each trial. All the animals were tested for a set
of 12 trials divided in 3 sessions (days). Each segment (now path interval) is considered to be
of length equal to the length of the arena radius (100cm). For the transitions: bars represent
the first and third quartiles of the data; the black (control group) or white (stress group)
horizontal lines is the median, crosses are the outliers and whiskers indicate the minimum and
the maximum values. These results were generated by using segmentation length of 250cm
and 90% overlap; for the classification an ensemble of classifiers was created by using classifiers
with validation error less than 25%; equivalent results of the other three segmentations can
be found in the appendix section. The Friedman test p-value (shown on the top right) was
used to compare both animal groups for the complete set of trials. According to the plots
Thigmotaxis and Incursion strategies show a clear difference in favour of the stress groups
along with Chaining Response. The number of transitions between strategies shows that the
stress animals change their behaviour more ofter than control animals within single trials.

14

3.2. Robustness across different segmentations
Four different segmentations (with different segment length and/or segment
overlap) were performed (refer to table 1). For each segmentation, we generate
a pool of classifiers which consisted of classifiers with cross validation error
lower than 25%. These classifiers were used to form an ensemble and the final
classification result was computed based on majority voting within the ensemble
(refer to Table 1 for concise information about each segmentation configuration
and Table 2 for measurements about the classifiers diversity and the majority
voting benefits).
Three out of four segmentation configurations (with segment lengths 250cm
and 200cm) led to the conclusion that the two animal groups (stress and control)
have significant difference on the strategies of Thigmotaxis, Incursion and Chaining Response and strategies transitions (see figure 7) in favour of the stress group
meaning that stress animals implement these strategies and transit between
different strategies more often than the control animals (see figure 6). One out of
four segmentations (segment length 300cm) fail to capture significant difference
in the Chaining Response strategy and a probable reason is that the segment
length is too large (3 times the arena radius), thus strategies that are more rare
and significantly smaller are overshadowed by more common ones (e.g., Chaining
Response may be overshadowed by Scanning Surrounding or Thigmotaxis, refer
to 3). This is an issue introduced already during the labelling procedure. For
the Segmentation 1 only 0.67% of the samples were single-labelled as chaining
response vs 1.58%, 0.72 % 1.06 % for the Segmentations 2 to 4 correspondingly.
The larger segment makes it more difficult for the human expert to distinguish
rare classes that are adjoint to frequent ones.
In order to validate the results for all four segmentations (see Table 1) we
chose to form 21 ensembles each one of which were consisted of 11 classifiers.
This also allowed us to compare the agreement among classifiers and among
ensembles (see Table 2 ensemble average agreement). The classifiers used to
form each ensemble were picked at random each time.
We compared the performance of the classifiers, the ensemble and the multiple
ensembles formed by random sample of classifiers. Table 2 shows the relevant
results on the last stage of analysis, after the smoothing function has been
applied and the segments had been mapped to the full swimming paths; this
detail is important because the smoothing procedure increases the performance
of classifiers (for the statistical analysis prior to the smoothing function refer to
Table F.5 in the appendix section). As expected, ensembles have higher accuracy,
lower percentage of unclassified segments and higher percentage of agreement
among them in comparison to the classifiers. However, since in our method the
cross validation was used for both tuning and testing, additionally we manually
assess the error of the ensembles on two out of the four segmentations (see the
appendix section).

15

Segmentation

Segmentation

Segmentation

Segmentation

I

II

III

IV

300

250

250

200

70%

70%

90%

70%

8847

10388

29476

13283

988

1261

2445

1227

(12%)

(12%)

(8%)

(9%)

1022

1313

2568

1232

42

78

91

64

Segment
Length
Segment
Overlap
Number of
Segments
Number of
Segments Labelled
Total number
of labels
Number of
Classifiers
Table 1: Parameters for the classification of four different segmentation configurations with variable segment lengths and overlaps. For each segmentation, a pool of
classifiers was generated with varied number of classifiers depending on the cross-validation
error (only classifiers with error lower than 25% were present). The percentage of the manually
labelled segments was between 8% and 12%. Multiple labels could be given to each segment;
in this study no more than two labels were given simultaneously to a segment.

16

Figure 7: Conclusive results from the classification of each segmentation (see Table
1). Each plot shows the 95% binomial confidence intervals for the classifiers of each segmentation
regarding their agreement on the significant difference between the two animal groups for
each strategy and the strategy transitions(Friedman test p-value < 0.05). Squares indicate
the mean of the classifiers; errorbars represent the 95% confidence intervals; the dashed line
indicates the threshold of interest (0.5 or 50%). Confidence intervals clearly above 0.5 (or 50%)
confirm that there is indeed a significant difference between the the two animal groups on the
strategies and the strategy transitions. We see that in three cases (Segmentations II, III, IV)
the two animal groups show significant differences in the strategies of Thigmotaxis, Incursion
and Chaining Response and transition between strategies. Segmentation I failed to capture
the significant difference on the Chaining Response because of the lengthy segments which
caused this strategy to be overshadowed by other strategies and disappear (refer also to table
3). The table below the plots shows the Friedman test p-values for the classification result of
the ensembles. Segmentation configurations are arranged in columns and strategies in rows;
each element has the relevant p-value and grey cells indicate significant difference (p-value
< 0.05).

17

Segmentation

Segmentation

Segmentation

Segmentation

I

II

III

IV

Classifiers
Error (%)

16.8

17.5

13.9

18.0

[min-max]

[5.4 24.9]

[3.7 25.0]

[1.8 21.5]

[7.3 24.9]

2.5

2.5

1.3

3.7

58.7

61.0

59.6

56.3

Unclassified (%)
Segments
Agreement (%)

Ensemble(s)
Error (%)

0.0

0.2

0.0

0.0

0.0

0.0

0.0

0.1

83.4

82.6

82.3

80.0

Unclassified (%)
Segments
Agreement (%)

Table 2: Classification statistics (average) for the four segmentation configurations
of Table 1 and benefits of majority voting. (1) Error: the 10-fold cross validation
was used in order to select ‘strong’ classifiers based on their validation error. 10-fold cross
validation was also used to compute the average accuracy of the ‘strong’ classifiers and the
accuracy of the ensemble (in case of the ensemble, the same folds used by the classifiers were
re-used). The ensemble significantly benefits the classification accuracy. Since in our method
the cross validation was used for both tuning and testing we manually assess the error of
the ensembles on two out of the four segmentations (see the appendix section). (2) The
percentage of unclassified segments was computed separately; since the classifiers are ‘strong’
only a few segments remain unclassified, nevertheless the ensemble almost totally nullifies
the unclassified segments. (3) The average agreement between the classifiers was computed
by first calculating the percentage of agreement within each pair (we have agreement when
two classifiers have assigned the same label on a particular segment) and then averaging all
the agreements together (refer to Validity Measurements for more information). In order to
perform the same statistical measurement in the ensemble domain, 21 ensembles were created
by picking a random sample of 11 ‘strong’ classifiers from the pool. The agreement between
the classifiers is better than moderate and, as expected, the agreement of the ensembles is
high.

18

Segmentation

Segmentation

Segmentation

Segmentation

I

II

III

IV

Thigmotaxis

27.7%

24.0%

24.6%

22.5%

Incursion

19.0%

18.9%

20.6%

17.0%

Scanning

10.2%

12.3%

10.5%

11.9%

Focused Search

9.2%

8.9%

8.2%

10.0%

Chaining Response

4.5%

5.8%

5.5%

9.8%

Self Orienting

7.1%

8.8%

8.2%

8.4%

Scanning Surroundings

17.4%

15.8%

16.8%

12.9%

Target Scanning

4.9%

5.6%

5.6%

7.4%

Unclassified

0.0%

0.0%

0.0%

0.1%

Table 3: Percentage of segments falling under each class for the four segmentation
configurations of Table 1. Some differences among the four segmentations are visible
although based on the results of figure 7 consistency on the conclusions is preserved in
segmentations II, III and IV. Regarding segmentation I, where there is no indication of any
difference between the two animal groups regarding the Chaining Response strategy,;more
segments are identified as Thigmotaxis and Scanning Surroundings. This indicates the
possibility that some segments which transit between Chaining Response and one of these
strategies are classified either as Thigmotaxis or Scanning Surroundings.

19

4. Discussion
Methodologies that classify swimming paths in MWM to behavioural classes
can reveal different stages of learning in animal groups. However, up to now,
there are very few examples of earlier research that have made use of machine
learning techniques to automatically detect animal behaviours. Most of them
have proposed methods that are difficult to generalise and require machine
learning knowledge. In our previous study [17] we addressed some limitations of
the previous techniques by focusing on the fact that forcing whole swimming
paths into a single class of behaviour can be suboptimal as each trajectory
incorporates a number of different behaviours. Our methodology of detailed
trajectory classification can reveal additional behavioural differences between two
groups of animals and can be used even when small amount of trajectory data
are available since the segmentation process, due to overlapping, typically creates
a significant amount of data. Nevertheless, our previously proposed method
of segmented trajectories classification required a decent amount of machine
learning knowledge to be used correctly, and allowed an amount of subjectivity
when choosing classifiers.
In this work, we address these issues by proposing to improve the robustness
of the technique via majority voting. Our results are no longer based on a
single classification tuning (classifier) but on the agreement of many. This
technique alleviated the subjective assignment of the swimming path segments to
classes since, in practice, many classifiers that seemingly perform equally well in
validation, have relatively high disagreement, and how to best chose among them
might be unclear. Here, we systematically investigate different segmentations
to identify what are the bounds under which our method produce meaningful
results (minimum and maximum segmentation length and number of labels that
needs to be provided). Furthermore, the binomial confidence intervals on the
ensemble of the classifiers are informative regarding the quality of our results.
Our methodology leads to results that differ from our earlier work [17]: they
do not detect any significant difference for the scanning strategy. This is due
to a number of factors: (i) the use of only one classifier, which results in higher
error (see also figure 7), (ii) the merging of three different segmentations that
resulted in classifications that didn’t fully agree with each other. Here we base
our conclusions on the majority voting of many classifiers that are shown to have
an improved performance versus the single classifiers, and therefore lead to more
reliable results.
One important point that should be mentioned is that despite the fact that
for each segmentation the ensemble formed has extremely low to zero error (%),
the largest segmentation failed to indicate difference on the chaining response
strategy. We have identified as cause of this issue the difficulty involved when
labelling large segments; in this case the chaining response can be masked by more
dominant classes such as Thigmotaxis. It is worthy noting that the smoothing
function, which is used to map the segments back to the whole trajectories,
again do not affect the conclusions formed based on the strategies. Even without
the smoothing function, again, three segmentations agree on the differences
20

between the two animal groups on the Thigmotaxis, Incursion and Chaining
Response strategies while the segmentation with the more lengthy segments
cannot capture the difference on Chaining Response (refer to the appendix for
the non-smoothed classification results). For this reason, the criterion for correct
classification cannot be based on the classification error alone. We also require
consistent results within a reasonable variation of the segmentation length, in
our case 200-250cm, i.e., 2R and 2.5R, with R being the radius of the maze.
To facilitate the use of this methodology by the scientific community, we
provide a complete software incorporating of our framework which includes a
Graphical User Interface (GUI) to guide the user throughout all the analysis
stages and allows for the manual configuration of each procedure.
Finally, it should be noted that the work we present here can generalise to
other species of rodents inside the MWM (e.g. mice) as well as other experiments
similar to the MWM (e.g. open field tasks, place avoidance). Two main
significant changes to be made are the strategy definitions and in case of other
tasks involving navigation and the trajectory features. In our recent work [55]
we addressed the issue of pre-defined strategies by using a fully unsupervised
procedure to find patterns of behaviour in the active allothetic place avoidance
task. In that experiment there is no previous knowledge of animal behaviours
thus supervised or semi-supervised techniques cannot be applied. However, we
mentioned that our classification depends on the trajectory features that we
used. A combined work of the classification boosting technique, an unsupervised
methodology [55], and the engineering of trajectory features that not linked to a
specific experiment has the potential to lead to a robust generalised framework
of trajectory analysis for many different animal species used in experimental
procedures (e.g. octopus [56] and zebrafish [57]).
Acknowledgments
E.V. acknowledges the grant number 264872 by EC-FP7-PEOPLE from the
NAMASEN Marie-Curie Initial Training Network. C.S. acknowledges the grant
number 31003A 176206 from the Swiss National Science Foundation Project.
K.L. acknowledges the grant number W19/7.PR/2014 from the Polish Ministry
of Science and Education and the grant number 602102 from the FP7-HEALTH
project (EPITARGET).
Conflict of Interest Statement
The authors declare that the research was conducted in the absence of any
commercial or financial relationships that could be construed as a potential
conflict of interest.
Author Contributions
A.V. and E.V. designed the methodology and wrote the manuscript. A.V.
developed the stand-alone RODA software and performed the experiments.
21

T.V.G. and E.V. designed the initial methodology. T.V.G. developed the original
software tools. K.S., A.J., K.L., W.K. validated and tested the analysis and
the software. M.C. contributed to the software development. C.S. provided the
MWM experimental data. Z.T., tested alternative classification methods. All
authors provided feedback to the manuscript.
References
References
[1] R. G. Morris, Spatial localization does not require the presence of local cues,
Learning and motivation 12 (2) (1981) 239–260.
[2] R. Brandeis, Y. Brandys, S. Yehuda, The use of the morris water maze in
the study of memory and learning, International Journal of Neuroscience
48 (1-2) (1989) 29–69.
[3] R. D’Hooge, P. P. De Deyn, Applications of the morris water maze in the
study of learning and memory, Brain research reviews 36 (1) (2001) 60–90.
[4] R. Schoenfeld, T. Schiffelholz, C. Beyer, B. Leplow, N. Foreman, Variations
of the morris water maze task to comparatively assess human and rodent
place navigation, Neurobiology of Learning and Memory.
[5] R. S. Astur, M. L. Ortiz, R. J. Sutherland, A characterization of performance
by men and women in a virtual morris water task:: A large and reliable sex
difference, Behavioural brain research 93 (1) (1998) 185–190.
[6] B. R. Cornwell, L. L. Johnson, T. Holroyd, F. W. Carver, C. Grillon, Human hippocampal and parahippocampal theta during goal-directed spatial
navigation predicts performance on a virtual morris water maze, Journal of
Neuroscience 28 (23) (2008) 5983–5990.
[7] A. M. Daugherty, A. R. Bender, P. Yuan, N. Raz, Changes in search
path complexity and length during learning of a virtual water maze: Age
differences and differential associations with hippocampal subfield volumes,
Cerebral Cortex (2015) bhv061.
[8] D. Piber, K. Schultebraucks, S. C. Mueller, C. E. Deuter, K. Wingenfeld,
C. Otte, Mineralocorticoid receptor stimulation effects on spatial memory
in healthy young adults: A study using the virtual morris water maze task,
Neurobiology of Learning and Memory 136 (2016) 139–146.
[9] L. Korthauer, N. Nowak, M. Frahmand, I. Driscoll, Cognitive correlates
of spatial navigation: Associations between executive functioning and the
virtual morris water task, Behavioural brain research 317 (2017) 470–478.
[10] R. Morris, Developments of a water-maze procedure for studying spatial
learning in the rat, Journal of neuroscience methods 11 (1) (1984) 47–60.
22

[11] C. V. Vorhees, M. T. Williams, Assessing spatial learning and memory in
rodents, ILAR Journal 55 (2) (2014) 310–332.
[12] H. R. Maei, K. Zaslavsky, C. M. Teixeira, P. W. Frankland, What is the
most sensitive measure of water maze probe test performance?, Frontiers in
integrative neuroscience 3 (2009) 4.
[13] M. D. Lindner, Reliability, distribution, and validity of age-related cognitive
deficits in the morris water maze, Neurobiology of learning and memory
68 (3) (1997) 203–220.
[14] M. D. Lindner, V. K. Gribkoff, Relationship between performance in the
morris water task, visual acuity, and thermoregulatory function in aged
f-344 rats, Behavioural brain research 45 (1) (1991) 45–55.
[15] M. Gallagher, R. Burwell, M. R. Burchinal, Severity of spatial learning
impairment in aging: development of a learning index for performance in
the morris water maze., Behavioral neuroscience 107 (4) (1993) 618.
[16] S. Dalm, J. Grootendorst, E. R. De Kloet, M. S. Oitzl, Quantification
of swim patterns in the morris water maze, Behavior Research Methods,
Instruments, & Computers 32 (1) (2000) 134–139.
[17] T. V. Gehring, G. Luksys, C. Sandi, E. Vasilaki, Detailed classification of
swimming paths in the morris water maze: multiple strategies within one
trial, Scientific reports 5.
[18] D. P. Wolfer, H.-P. Lipp, Dissecting the behaviour of transgenic mice: is it
the mutation, the genetic background, or the environment?, Experimental
physiology 85 (06) (2000) 627–634.
[19] D. P. Wolfer, R. Madani, P. Valenti, H.-P. Lipp, Extended analysis of
path data from mutant mice using the public domain software wintrack,
Physiology & Behavior 73 (5) (2001) 745–753.
[20] D. P. Wolfer, M. Stagljar-Bozicevic, M. L. Errington, H.-P. Lipp, Spatial
memory and learning in transgenic mice: fact or artifact?, Physiology 13 (3)
(1998) 118–123.
[21] A. Graziano, L. Petrosini, A. Bartoletti, Automatic recognition of explorative
strategies in the morris water maze, Journal of neuroscience methods 130 (1)
(2003) 33–44.
[22] A. Garthe, J. Behr, G. Kempermann, Adult-generated hippocampal neurons
allow the flexible use of spatially precise learning strategies, PloS one 4 (5)
(2009) e5464.
[23] J. Rogers, L. Churilov, A. J. Hannan, T. Renoir, Search strategy selection in
the morris water maze indicates allocentric map formation during learning
that underpins spatial memory formation, Neurobiology of learning and
memory 139 (2017) 37–49.
23

[24] S. Yeshurun, J. Rogers, A. K. Short, T. Renoir, T. Y. Pang, A. J. Hannan,
Elevated paternal glucocorticoid exposure modifies memory retention in
female offspring, Psychoneuroendocrinology.
[25] T. Illouz, R. Madar, Y. Louzon, K. J. Griffioen, E. Okun, Unraveling
cognitive traits using the morris water maze unbiased strategy classification
(must-c) algorithm, Brain, behavior, and immunity 52 (2016) 132–144.
[26] C. Cortes, V. Vapnik, Support-vector networks, Machine learning 20 (3)
(1995) 273–297.
[27] A. Vouros, M. Croucher, RodentDataAnalytics/mwm-ml-gen: Version 4.0.3beta RodentDataAnalytics/mwm-ml-gen: Version 4.0.3-beta (Dec. 2017).
doi:10.5281/zenodo.1117837.
URL https://doi.org/10.5281/zenodo.1117837
[28] M. Bilenko, S. Basu, R. J. Mooney, Integrating constraints and metric
learning in semi-supervised clustering, in: Proceedings of the twenty-first
international conference on Machine learning, ACM, 2004, p. 11.
[29] F. Kovács, C. Legány, A. Babos, Cluster validity measurement techniques,
in: 6th International symposium of hungarian researchers on computational
intelligence, Citeseer, 2005.
[30] A. Sharkey, N. Sharkey, Diversity, selection, and ensembles of artificial
neural nets, Neural Networks and their Applications (NEURAP97) (1997)
205–212.
[31] Z.-H. Zhou, J. Wu, W. Tang, Ensembling neural networks: many could be
better than all, Artificial intelligence 137 (1-2) (2002) 239–263.
[32] M. J. Kearns, L. G. Valiant, Cryptographic limitations on learning boolean
formulae and finite automata, in: Machine Learning: From Theory to
Applications, Springer, 1993, pp. 29–49.
[33] U. Gerecke, N. E. Sharkey, A. J. Sharkey, Common evidence vectors for
self-organized ensemble localization, Neurocomputing 55 (3) (2003) 499–519.
[34] A. Jurek, Y. Bi, S. Wu, C. Nugent, Classification by cluster analysis: A
new meta-learning based approach, in: International Workshop on Multiple
Classifier Systems, Springer, 2011, pp. 259–268.
[35] N. C. Oza, K. Tumer, Classifier ensembles: Select real-world applications,
Information Fusion 9 (1) (2008) 4–20.
[36] A. Acharya, E. R. Hruschka, J. Ghosh, S. Acharyya, C 3e: A framework for
combining ensembles of classifiers and clusterers, in: International Workshop
on Multiple Classifier Systems, Springer, 2011, pp. 269–278.
[37] R. E. Schapire, The strength of weak learnability, Machine learning 5 (2)
(1990) 197–227.
24

[38] M. Zhu, Use of majority votes in statistical learning, Wiley Interdisciplinary
Reviews: Computational Statistics 7 (6) (2015) 357–371.
[39] D. Ruta, B. Gabrys, A theoretical analysis of the limits of majority voting
errors for multiple classifier systems, Pattern Analysis and Applications
5 (4) (2002) 333–350.
[40] S. Varma, R. Simon, Bias in error estimation when using cross-validation
for model selection, BMC bioinformatics 7 (1) (2006) 91.
[41] A. Liaw, M. Wiener, Classification and regression by randomforest, R news
2 (3) (2002) 18–22.
[42] H. Bouziane, B. Messabih, A. Chouarfia, Profiles and majority voting-based
ensemble method for protein secondary structure prediction, Evolutionary
bioinformatics online 7 (2011) 171.
[43] S. Siegel, Nonparametric statistics for the behavioral sciences.
[44] E. Theodorsson-Norheim, Friedman and quade tests: Basic computer program to perform nonparametric two-way analysis of variance and multiple
comparisons on ranks of several related samples, Computers in biology and
medicine 17 (2) (1987) 85–99.
[45] S. Wallis, Binomial confidence intervals and contingency tests: mathematical fundamentals and the evaluation of alternative methods, Journal of
Quantitative Linguistics 20 (3) (2013) 178–208.
[46] L. D. Brown, T. T. Cai, A. DasGupta, Interval estimation for a binomial
proportion, Statistical science (2001) 101–117.
[47] R. Peck, Statistics : the exploration and analysis of data, Brooks/Cole,
Cengage Learning, Australia United States, 2012.
[48] L. P. Noldus, A. J. Spink, R. A. Tegelenbosch, Ethovision: a versatile
video tracking system for automation of behavioral experiments, Behavior
Research Methods, Instruments, & Computers 33 (3) (2001) 398–414.
[49] E. Frank, M. A. Hall, I. H. Witten, The WEKA Workbench, Online Appendix for ”Data Mining: Practical Machine Learning Tools and Techniques”, Morgan Kaufmann, Fourth Edition, 2016.
[50] C. Márquez, G. L. Poirier, M. I. Cordero, M. H. Larsen, A. Groner, J. Marquis, P. J. Magistretti, D. Trono, C. Sandi, Peripuberty stress leads to
abnormal aggression, altered amygdala and orbitofrontal reactivity and
increased prefrontal maoa gene expression, Translational psychiatry 3 (1)
(2013) e216.
[51] D. P. Wolfer, H.-P. Lipp, A new computer program for detailed off-line
analysis of swimming navigation in the morris water maze, Journal of
neuroscience methods 41 (1) (1992) 65–74.
25

[52] G. Aston-Jones, J. Rajkowski, J. Cohen, Locus coeruleus and regulation of
behavioral flexibility and attention, Progress in brain research 126 (2000)
165–182.
[53] G. Luksys, W. Gerstner, C. Sandi, Stress, genotype and norepinephrine
in the prediction of mouse behavior using reinforcement learning, Nature
neuroscience 12 (9) (2009) 1180–1186.
[54] G. Luksys, C. Sandi, Neural mechanisms and computations underlying
stress effects on learning and memory, Current opinion in neurobiology
21 (3) (2011) 502–508.
[55] T. V. Gehring, M. J. Wesierska, D. K. Wójcik, E. Vasilaki, Analysis of
behaviour in the active allothetic place avoidance task based on cluster
analysis of the rat movement motifs, bioRxiv (2017) 157859.
[56] J. G. Boal, A. W. Dunham, K. T. Williams, R. T. Hanlon, Experimental
evidence for spatial learning in octopuses (octopus bimaculoides)., Journal
of Comparative Psychology 114 (3) (2000) 246.
[57] R. Gerlai, Zebrafish and relational memory: Could a simple fish be useful
for the analysis of biological mechanisms of complex vertebrate learning?,
Behavioural Processes.
[58] A. K. Jain, Data clustering: 50 years beyond k-means, Pattern recognition
letters 31 (8) (2010) 651–666.

26

Appendix A. Examples of Rodents Stereotypical Behaviours

Figure A.8: Stereotypical classes of behaviour. Each figure shows an example of a
trajectory segment falling under each behavioural class. Throughout the experiment, the
animals implement different strategies in order to solve the maze. By detailed analysis of each
trial trajectory data into segments the interchange of these stereotypical animal behaviours
become visible.

27

Appendix B. Semi-supervised Classification Algorithm
Our classification algorithm is based on the Metric Pairwise Constrained
K-Means (MPCKMeans) clustering algorithm implemented by Bilenko et al.
[28].
MPCKMeans is inspired by the standard K-means [58] clustering algorithm
and belongs to the family of semi-supervised algorithms. It is able to organise a
set of datapoints into groups (clusters) according to their pattern similarities
and it uses a set of labelled data (predefined knowledge) in the form of “cannotlink” and “must-link” constraints in order to improve the accuracy of assigning
datapoints into clusters [17]. Moreover, it has the ability to create clusters of
different shapes and sizes by using different metrics to minimize the distance
between datapoints of the same cluster and to maximize the distance between
datapoints of different clusters (features weighting) [28].
With the use of labelled data it is possible not only to guide the clustering
procedure (with the creation of constraints) but to also combine clusters together
and form larger groups (classes) which are actually the categories of the labelled
data. This mapping of clusters into classes is illustrated in our previous work
[17] and it is done by converting a cluster into a class based on the number of
labelled segments within the cluster and its size as its is shown in the equation
below:
Si ≡ dsi ∗ lmin,i e, where lmin,i ≡ max(s−γ
i , lmin ) and

(B.1)

si ≡ cluster size, γ = 0.75, lmin = 0.01 (or 1%)
Regarding the constrains a MUST-LINK constraint is generated between two
datapoints with the same label and a CANNOT-LINK constraint is generated
between two datapoints with a different label. Multilabelled datapoints are
considered distinctive meaning that if for example a datapoint is labelled as
thigmotaxis and incursion then a MUST-LINK constraints will be generated
only with datapoints that are also labelled as thigmotaxis and incursion. In
addition, a constrain is created only between relatively close datapoints, i.e.
if the Euclidian distance between the two labelled datapoints is less that 0.25
(the features of the datapoints are normalized between [0 1]). The last rule has
been implemented in our previous work [17] to limit the number of generated
constraints which can be significantly large and create computational issues.
In order to improve the classification quality we performed the ‘two-stage
clustering’ where first we cluster the data using only the “cannot-link” constraints
and then clusters that could not be mapped to a class are sub-divided by
another clustering step, this time, however, both “cannot-link” and “must-link”
constraints are used. Moreover multiple target number of clusters are tried in
succession from 2 up to two times the initial number of clusters used in the first
clustering. A sub-partioning is considered correctly if one of the sub-clusters
could be classified. The stages of this process are shown in figure B.9.

28

Figure B.9: Stages of the Semi-supervised Classification Algorithm. As inputs the
computed features of the segments along with a partial set of labels of the segments are
provided. In addition, a predefined number of target clusters needs to be provided, which
specifies the number of clusters that the algorithm needs to detect. As output the algorithm
provides the class in which each segment falls into. The labels are used to formed the list of
constraints of which data should not be (‘cannot-link’) or should be (‘must-link’) in the same
clusters. In the first-stage clustering only the ‘cannot-link’ constrains are used to guide the
clustering procedure and then clusters that could not be mapped into classes are sub-divided
and a second clustering stage begins this time with both cannot-link and must-link constraints.

29

Appendix C. 10-Fold Cross Validation (for tuning and testing)

Figure C.10: 10-Fold cross validation process. The manually labelled data are split into
10 folds and 9 folds are used for training and 1 fold for testing the classification results. The
classification error (expressed in percentage) is calculated based on the differences between the
test set and the classified test set. The same process is repeated 10 times and each time the
testing set is changed with a different portion of the training set. The 10-fold cross validation
error is the average error from each iteration. This process is used for the selection of the strong
classifiers and for the estimation of the ensemble error. For the later, the same folds which
were used to estimate the error of the classifiers are used to estimate the error of the ensemble.
More strictly, in cross validation the algorithm under testing must be trained exclusively on
the training set and do not receive any input from the test test (in our case the algorithm is
trained using all the data but less labels). However, we use cross validation for both tuning
and testing because the objective is not to create a generic classification but a specific one for
the target dataset (other datasets would again require 8% to 12% labelling) [17]. The ensemble
results of two segmentations (Segmentations II and IV) were manually assessed.

30

Segmentation II

Segmentation IV

TT

1.4%

1.0%

IC

8.0%

1.5%

SC

6.6%

4.1%

FS

6.0%

3.7%

CR

11.5%

12.6%

SO

11.0%

8.1%

SS

9.6%

3.2%

ST

2.3%

1.0%

average

5.7%

4.4%

total

6.3%

2.8%

Table C.4: Manual estimation of ensemble error. The ensemble error was manually
assessed for the segmentations II and IV. The table shows both the total error and the error
among the different classes (including the average). The total manually estimated error of the
ensembles is still significant lower than the average error of the classifiers (6.3% vs 17.5% for
Segmentation II and 2.8% vs 18.0% for Segmentation IV). The results of the ensembles were
manually assessed for two reasons: (i) to estimate the overfitting, which is likely to be caused
because the same data for both tuning and testing, and (ii) because our testing set was very
small since limited amount of labels have been provided, the error estimation is likely to be
overly optimistic.

31

Appendix D. Smoothing Function

Figure D.11: Empirically defined area of tuning for the smoothing function. R refers
to the arena radius (in cm); x-axis (sigma) refers to a particular value of σ (variance of the
Gaussian); y-axis (interval) refers to a particular value of the length of the interval; green boxes
indicate areas under which the smoothing function (refer to section 2.7 Mapping Segment
Classes to the Full Swimming Paths) yields consistent results for every segmentation (excluding
Segmentation I where the segments length is too large). Interval of length 2 · R is at the limit
and from this point onwards consistency cannot be sustained.

32

Appendix E. Agreement Matrix

Figure E.12: Agreement matrix for the classifiers of Segmentation III (see Table 1).
The classifier of each column is being compared with the classifier of each row. The comparison
is based on the percentage of segments that both classifiers agree that belong to the same class.
The diagonal values of the matrix indicate 100% agreement since each classifier is compared
with itself.

33

Appendix F. Results of each Segmentation without the Smoothing
Function

Figure F.13: Conclusive pre-smoothing results from the classification of each segmentation (see Table 1). Considering segments as continuous parts of the trajectories
ignoring the overlapping provides consistent results when differences between the implemented
strategies of the groups are being investigated but creates an overestimation on the number
of transitions between strategies. Each plot shows the 95% binomial confidence intervals for
the classifiers of each segmentation regarding their agreement if there is significant difference
between the two animal groups (Friedman test p-value < 0.05) on each strategy and strategy
transitions or not. Squares indicate the mean of the classifiers that point out that there is
significant difference on this particular case; errorbars are the 95% confidence intervals; the
dashed line indicates the threshold of interest (0.5 or 50%). In order to be confident that there
is indeed a significant difference between the the two animal groups on each strategy and the
strategy transitions the confidence intervals should be clearly above 0.5 (or 50%). Compared
to the results in the main manuscript (refer to figure 7) we see that the smoothing function
which maps the segments to the full swimming paths is actually beneficial on revealing the
animal transitions between strategies. Other than that the results and the conclusions are the
same.

34

Segmentation

Segmentation

Segmentation

Segmentation

I

II

III

IV

Classifiers
Unclassified (%)
24.8

24.3

30.0

29.0

53.2

55.5

48.8

52.1

Segments
Agreement (%)

Ensemble(s)
Unclassified (%)
1.2

0.7

0.8

1.1

84.7

83.3

79.8

80.0

Segments
Agreement (%)

Table F.5: Classification statistics for the four segmentation configurations of Table
1 prior to smoothing. In comparison with the results of Table 2 we see that the percentage
of unclassified segments among the classifiers is higher and the agreement between them lower.
However, the ensemble (or ensembles in case of the agreement) again nearly nullifies the
unclassified segments and significantly boosts the agreement percentage.

35

Appendix G. Ensemble Results of each Segmentation

Figure G.14: Percentage of segments falling under each strategy for the stress
(black) and control (white) animal groups over each trial for the Segmentation I
of Table 1. All the animals were tested for a set of 12 trials divided in 3 sessions (days). Each
segment is considered to be of length equal to the length of the arena radius (100cm). For the
transitions: bars represent the first and third quartiles of the data; the black (control group)
or white (stress group) horizontal lines is the median, crosses are the outliers and whiskers
indicate the minimum and the maximum values. The Friedman test p-value (shown on the top
right) was used to compare both animal groups for the complete set of trials. According to the
plots stress animals swap longer paths since the average number of strategy implementations
in higher than the one of the control group. Thigmotaxis and Incursion strategies show a clear
difference in favor of the stress groups along with the strategies transitions. This Segmentation
configuration fails to reveal significant different on the Chaining Response because of the
segment length which causes some more rare strategies to disappear.

36

Figure G.15: Percentage of segments falling under each strategy for the stress
(black) and control (white) animal groups over each trial for the Segmentation II
of Table 1. All the animals were tested for a set of 12 trials divided in 3 sessions (days). Each
segment is considered to be of length equal to the length of the arena radius (100cm). For the
transitions: bars represent the first and third quartiles of the data; the black (control group)
or white (stress group) horizontal lines is the median, crosses are the outliers and whiskers
indicate the minimum and the maximum values. The Friedman test p-value (shown on the top
right) was used to compare both animal groups for the complete set of trials. According to the
plots stress animals swap longer paths since the average number of strategy implementations
in higher than the one of the control group. Thigmotaxis and Incursion strategies show a clear
difference in favor of the stress groups along with Chaining Response, which is not implemented
systematically though. The number of transitions between strategies shows that the stress
animals change their behaviour more ofter within single trials.

37

Figure G.16: Percentage of segments falling under each strategy for the stress
(black) and control (white) animal groups over each trial for the Segmentation IV
of Table 1. All the animals were tested for a set of 12 trials divided in 3 sessions (days). Each
segment is considered to be of length equal to the length of the arena radius (100cm). For the
transitions: bars represent the first and third quartiles of the data; the black (control group)
or white (stress group) horizontal lines is the median, crosses are the outliers and whiskers
indicate the minimum and the maximum values. The Friedman test p-value (shown on the top
right) was used to compare both animal groups for the complete set of trials. According to the
plots stress animals swap longer paths since the average number of strategy implementations
in higher than the one of the control group. Thigmotaxis and Incursion strategies show a clear
difference in favor of the stress groups along with Chaining Response, which is not implemented
systematically though. The number of transitions between strategies shows that the stress
animals change their behaviour more ofter within single trials.

38

