Quantifying finer-scale behaviours using self-organising maps (SOMs) to link accelerometery signatures with behavioural patterns in free-roaming terrestrial animals
Data collectionData were collected in the Sunshine Coast region in Queensland, Australia (− 26.65° S, 153.07° E), from February to April 2019. All methods were carried out in accordance with relevant guidelines and regulations. All experimental protocols and methods were approved and carried out in compliance with the ARRIVE guidelines under the approval of the University of the Sunshine Coast (USC) Animal Ethics permit (ANA/16/109T); Human Ethics permit (A181114) and in conjunction with the Sunshine Coast Council (SCC) Local Law permit (OM18/19).
Animals used in the trialsWe recruited 10 domestic cats through an approved media release (males n = 6; females n = 4; weight 2.8–8.4 kg; age 1.5–12 years; body length 38–53 cm; foreleg length 16–19 cm). As per the Sunshine Coast Council local law requirements, all cats had to be neutered, registered and microchipped to participate in the study.
EquipmentWe fitted each cat with a retail harness, to which we attached a tri-axial accelerometer (AX3; Axivity, Newcastle University, UK; 23 × 32.5 × 8.9 mm; 11 g) using cable ties (Fig. 1a). The accelerometer was initialised using the Open Movement Graphical User Interaction application (OMGUI; V1.0.0.37). Because a trade-off exists between data resolution and battery life, we logged data at 50 Hz and with a dynamic range of ± 8 g, with a 13-bit resolution, similar to a previous study23. When combined with the in-built memory storage capacity of 512 MB, and battery limitations, this configuration resulted in a maximum of 8–14 days of data collection. The quartz Real Time Clock and calendar provided a timestamp with a frequency of 32.768 kHz and a precision of ± 50 ppm, with manufacturer specifications indicating a drift of 0.18 s per hour. To overcome this drift over the eight days, we calibrated devices by video recording the signals of five claps/taps on the device, at the start and end of each individual data collection period, and also at random times during the day.Figure 1(a) The anatomical position of the accelerometer (AX3) on the sternum of the cat. (b) The activity of swatting stimulated by the use of a feather. (c) The axis orientation of the accelerometer planes, which are represented in the accelerometer trace data in the MATLAB interface. Fore-aft (surge), lateral (sway) and dorso-ventral (heave) movement is reflected in the X, Y and Z signals.Full size imageWe positioned the accelerometer on the scapular brace-strap of the harness, inverted such that the accelerometer was on the sternum of the cat (Fig. 1a–c). Field trials over four months on four cats in the study determined that this position, in comparison with mounting on the dorsal cranial median plane, did not interfere with the animals’ balance; it also removed all of the abnormal movement behaviours and unnecessary discomfort to the cat2. The positioning of the logging device on the frontal anterior, median plane, resulted in the primary axis for fore-aft (surge), lateral (sway) and dorso-ventral (heave) movement to be reflected in the X, Y and Z signals, respectively (Fig. 1c).The accelerometer harness was used in conjunction with the CatBib for the relevant treatment periods. The total combined mass of the harness, accelerometer and Catbib was to 34.1 g, with a minimum cat mass of 2.8 kg, suggesting the equipment did not weigh above 1.2% of total body weight in any cat studied. The CatBib is a prey protector device, manufactured from a lightweight, washable neoprene material, that is attached to a cat’s safety collar (Fig. 1b). The dimensions of the bib are 17.5 mm × 17.5 mm × 6.5 mm, with a total mass of 23.1 g and it is purple in colour. All cats adjusted to the harness and CatBib within the first hour of deployment and no subsequent adjustments were required. All cats had unrestricted access to roam freely outside during the eight days of field trials.To capture training data, each cat was filmed with a GoPro + 3 Hero device (H.264—1920 × 1080; f/2.8; 60 fps), undertaking natural or stimulated active behaviours through play (Fig. 1b). These activities or behaviours were manually documented to track the activity, date and the timestamps. We conducted two treatments over the eight days: in the first, cats were fitted with CatBib, whereas in the other, bibs were not worn. Each treatment was conducted for four consecutive days, and the sequence of treatments for each cat was randomised. The accelerometer device on the harness was left on the cats for the entire field trial and recorded continuously for the eight days (~ 192 h per cat; total = 2304 h).Data analysisEach accelerometer trace file was exported as a raw binary file through OMIGUI and imported into a custom-built MATLAB GUI. To build our training dataset, the video file timestamp information, determined using Mediainfo (version 18.08, 2018), was used to define the start time for a subset of the accelerometer trace, and the video length to define the end point (Supp. Fig. 1). Offsets between the accelerometer trace and video files were determined using the closest calibrated tap signal trace for each day. We were able to watch each video file in synchrony with the accelerometer trace, and manually annotate each movement/activity from the video files to the accelerometer subset (Clemente et al.)24 (Supp. 1.1. Matlab interface instructions; Supp. Fig. 1).We grouped activities according to behaviour into three classes: Sedentary, Eating and Locomotive and Hunting. We further subdivided each group into behaviours. Sedentary included lying, sitting, grooming and watching; Eating and Locomotive included—eating/drinking, walking, trotting; and for Hunting—galloping, jumping, pouncing, swatting, biting/holding (Supp. Table 1).The accelerometer trace was then further divided into rolling epochs of 50 samples in length, using 1 s duration at 50 Hz to ensure intensive acceleratory bursts of short duration such as jumping and pouncing are captured. The behaviour with the maximum frequency within each epoch was assigned as that epoch’s label. Raw accelerometer data in each epoch was assigned as that epoch’s label. Raw accelerometer data in each epoch was summarized using 26 of the most effective variables for procedure accuracy identified by Tatler et al.25. We included: axial acceleration (X, Y, Z),mean acceleration (X, Y, Z); minimum acceleration.(X, Y, Z); maximum acceleration (X, Y, Z); standard deviation of acceleration (X, Y, Z); Signal Magnitude Area, minimum Overall Dynamic Body Acceleration (ODBA); maximum ODBA, minimum Vectorial Dynamic Body Acceleration VDBA; maximum VDBA, sum ODBA; sum VDBA; correlation (XY, YZ, XZ); skewness (X, Y, Z); and kurtosis (X, Y, Z)25 (See Supp. Table 2 for a detailed description of each variable). Finally, we coded the two treatments: BibON and BibOFF and included this information in the training data set.Classification modellingTo determine whether we could predict cat hunting behaviours, we analysed the training data sets using a Kohonen super Self Organising Map (SOM) in the R package ‘Kohonen’ version 2.0.1926,27.Machine learning procedures such as random forest and support vector machines each provide computationally powerful methods of data classification, however each method is not equal in how it visualises its output. SOMS have been used in behavioural studies10,13,14,15 for their ability to efficiently create easily interpreted maps and identify patterns of behaviour. Self-organizing maps differ from other artificial neural networks as they apply competitive learning as opposed to error-correction learning. In this study, a self-organising map algorithm was chosen for its efficiency in visualising multi-dimensional and complex data onto an easily interpreted two dimensional map output. SOMs also have the ability to visualise which variables are most influential with the use of component planes (Fig. 3b–e) and unlike other procedures mentioned, SOMs use cluster analysis which in this study aids in identifying similar behaviours and visualising them closer together (in clusters) on the map output.To prepare data for the SOM function a random sample of the classifiers for the trained data were extracted, along with their associated behaviour, and combined into a list with 2 elements (measurements and activity). This list was then input into the function supersom.R function, with the grid argument defined using the somgrid.R function [e.g. supersom(TrainingData, grid = somgrid(7, 7, “hexagonal”))]. The 7 × 7 grid function was chosen based on a sensitivity analysis exploring all combinations of grids between 4 to 9 units in length (n = 36, Supp. Fig. 2). The 7 × 7 grid represented the grid which produced the highest accuracy and map symmetry26,28,29. We further tested the effect of the number of times the complete data set is presented to the network by varying the rlen argument in the supersom.R function. We found no obvious increase in overall accuracy with increased iterations, and therefore used the default length of 100 times (Supp. Figure 3). Each supersom procedure created was then tested using the predict.R function, with the newdata argument directed to a testing data set, which was a similar 2 element list containing all samples not included in the training data set. The result of this test was then assembled into a confusion matrix using the table.R function with predictions compared with the known behaviours in the test data set [e.g. table(predictions = ssom.pred$predictions$activity, activity = testData$activity) ]. A confusion matrix is a table where each row represents the instances in a predicted class, while each column represents the instances in the observed class, allowing mislabelled epochs to be easily identified. The confusion matrix was then finally used to compute four specific accuracy metrics—sensitivity (or recall), precision, specificity, as well as overall accuracy.To identify relationships between the size of training dataset, we trained a randomised subset of the BibOFF training data, to predict the remaining BibOFF data from all cats. We tested 35 different subset sample sizes from 100 to 100,000, replicating each sample size ten times (with replacement) to determine variation at each sample size.We then tested the extent to which accelerometer traces are modified by the presence of the CatBib. This modification was indicated by a change in overall prediction accuracy of the SOM between BibOFF and BibON treatments. To do this, we trained the SOM using a subset of the trained data for BibOFF and tested it against annotated classified BibON samples. In order to statistically compare results from bootstrap resampling, we took the median among bootstrap samples as the estimate of performance and quantified uncertainty using the corresponding 2.5th and 97.5th percentiles to represent credible 95% confidence intervals (CIs). We chose the median as a measure of central tendency, because resampling distributions were truncated at 1, so were skewed. If CIs for any pair of estimates (medians) do not overlap, then this is evidence of a significant difference between the estimates. If, however, one estimated median fell within the confidence interval for another estimate, then this was used as evidence of a lack of significant difference. For all other outcomes, differences are equivocal, and we interpreted them tentatively on the basis of the relative overlap in CIs.Finally we compared the output of the SOM with the output from a decision tree classification method using a random forest (RF) approach from the randomForest.R package30. We chose random forest as a comparison as this method has previously been shown to perform better than other similar methods (e.g. k-nearest neighbour, support vector machine, and naïve Bayes) when classifying behavioural data on free moving animals25,31. We trained both the SOM and RF procedures using the same 20,000 randomly selected epochs, and compared the overall accuracy for predicting the behaviour for the remaining ~ 192,000 epochs. The SOM was built using a 7 × 7 grid patterns, with the rlen argument set to 100. The RF was built with the number of trees set to 100 and the number of variables randomly sampled as candidates at each split set to 4. More