## 2 Data Acquisition, Preparation and Feature Selection
### Data preparation and feature selection  
In preparation for the classification algorithm, the clicks were manually detected, filtered for echoes, and checked for acceptable noise levels. These clicks were then denoised using a standard soft-thresholding algorithm, available in Wavelab [17], and synchronised using a matched filter on the low dominant frequency with a typical example click. Initially, the data were band-pass filtered between 100 and 20,000 Hz. Data from seven different animals were available for this study, comprised of six single click trains and a complete dive. This dive was considered to be especially interesting as it allowed to see the performance of the algorithm, and validity of features, for the duration of an entire dive. Therefore, the dive was split up in two unequal parts. One click train early in the dive was separated and joined together with the other six available click trains used for training. The remainder of the dive was put in its own set and was only used to test the classifier, it was never used for training or parameter selection. This approach simulated the situation where a classifier would have to be trained with data at the start of a recording and allowed to assess its capacity to generalise to patterns much later in the dive sequence, that may have undergone changes as in Figure 1.  
The seven click trains were used to train the classifiers. As the objective of the classification is that a classifier can be trained with only the start of a recording and then autonomously classify the remainder, only the first 50 clicks were used from the start of each click train, which corresponds to roughly 50 seconds. The other available patterns in the click trains were used for validation, but were never considered for training. The features were selected using a local discriminant basis [18, 19] for the seven classes. The exact same procedure was followed as in [6]. First, each click in the training set was expressed in a wavelet packet table. Where the usual wavelet filter retains the high-pass wavelet coefficients and continues filtering the low-pass scale coefficients, the wavelet packet table filters both outputs again, creating a redundant library of bases that can be selected for reconstruction of the signal (a detailed discussion about the relationship between wavelets and filter banks can be found in [20]). With each pass through the wavelet filter the frequency band of the input signal is split in two, producing low and high frequency outputs. These outputs are stored and passed through the filter again. In this paper these recursive steps will be called the splitting level, e.g., at level 3 the signal has been passed through the filter twice. At a splitting level \(l\) there will be \(2^{l-1}\) band limited signals, each with a bandwidth of \(F_{s}/2^{l}\) with \(F_{s}\) the sampling frequency. These signals will be called frequency bins (holding the energy of their respective frequency bands) and indexed with \(k\). The coefficients inside each bin will be indexed by \(m\). After the creation of the packet table, a basis is selected that emphasises the differences between the classes. This difference is measured with the help of a time-frequency energy map, defined as follows:  
\[\Gamma_{c}(j,k,m)=\sum_{i}^{N_{c}}(\hat{x}_{i}^{c}(j,k,m))^{2}/\sum_{i}^{N_{c} }||\mathbf{x}_{i}^{c}||^{2} \tag{1}\]  
where \((j,k,m)\) denotes the position in the packet table, at splitting level \(j\), frequency band \(k\) and coefficient \(m\) within the bin; \(\hat{x}_{i}^{c}(j,k,m)\) denotes the wavelet coefficient of click sample \(i\) and class \(c\) at position \((j,k,m)\); \(\mathbf{x}_{i}^{c}\) the click sample \(i\) of class \(c\); \(N_{c}\) the number of training samples in class \(c\). This map basically sums the packet tables of the clicks within one class and allows the comparison of the energy in a specific bin \((j,k,\cdot)\) between different classes.