Supervised learning algorithm for analysis of communication signals in the weakly electric fish Apteronotus leptorhynchus

Signal analysis plays a preeminent role in neuroethological research. Traditionally, signal identification has been based on pre-defined signal (sub-)types, thus being subject to the investigator’s bias. To address this deficiency, we have developed a supervised learning algorithm for the detection of subtypes of chirps—frequency/amplitude modulations of the electric organ discharge that are generated predominantly during electric interactions of individuals of the weakly electric fish Apteronotus leptorhynchus. This machine learning paradigm can learn, from a ‘ground truth’ data set, a function that assigns proper outputs (here: time instances of chirps and associated chirp types) to inputs (here: time-series frequency and amplitude data). By employing this artificial intelligence approach, we have validated previous classifications of chirps into different types and shown that further differentiation into subtypes is possible. This demonstration of its superiority compared to traditional methods might serve as proof-of-principle of the suitability of the supervised machine learning paradigm for a broad range of signals to be analyzed in neuroethology.


Introduction
Signals as vehicles for transmission of information from a sender to a receiver play a pivotal role in animal communication (Bradbury and Vehrencamp 2011).Broadcasting of signals is mediated by a variety of sensory channels, such as visual, acoustic, tactile, chemical, and electric.Diversity of signals, either within one sensory modality or by activation of several sensory channels, enables animals to use different signals for different behavioral functions.Within one sensory modality, signal diversity is often achieved by modulation of a generic type of signal.For example, different acoustic signals can be produced by temporal frequency and amplitude modulations, and even rather subtle differences can have profoundly different functional effects (Schwartz et al. 2007;Feng et al. 2009;Hechavarría et al. 2020).
While acoustic signals are displayed intermittently only (although sometimes for prolonged periods at high rates), some electric fishes produce a generic form of electric signal continuously throughout life.This group includes the brown ghost knifefish (Apteronotus leptorhynchus), a species of the taxonomic order Gymnotiformes that has been intensively studied as model organisms in ethology and neuroethology.
Apteronotus leptorhynchus generates such continuous electric discharges with its electric organ composed of modified axonal terminals of spinal motoneurons (for review see Zupanc and Bullock 2005).The synchronous depolarization of these so-called electrocytes produces electric pulses separated by short inter-pulse intervals.This results in the appearance of a continuous, wave-like signal, commonly referred to as electric organ discharge (EOD).The frequency at which the fish generates the EOD train is determined, in a one-to-one fashion, by the frequency of the neural oscillations of a central pattern generator in the medulla oblongata, the pacemaker nucleus.Within the species-specific frequency range of 650-1000 Hz, males discharge at higher frequencies than females, with little overlap between the sexes (Meyer et al. 1987;Zupanc et al. 2014).Owing to this sexual dimorphism, the EOD contains information about the sex of its sender.
Whereas the species as whole occupies a broad EOD frequency range, the frequency of the discharges of a given individual within this frequency band is highly constant, as indicated by the coefficient of variation [cv = (standard deviation / mean) × 100 (%)], which assumes values of less than 0.2% over 30-min (Eske et al. 2023).Nevertheless, transient modulations may occur, resulting in diversification of the generic EOD signal.The best-characterized type comprises chirps.In isolated individuals of A. leptorhynchus, chirps are very rarely produced, on average less than once per 10 min (Engler et al. 2000;Zupanc et al. 2001;Eske et al. 2023).However, during stimulation with the EODs of conspecific fish or with electric signals mimicking such EODs, or after administration of certain drugs, chirp production may increase one-thousand-fold to rates as high as 2 s −1 (Zupanc and Maler 1993;Engler and Zupanc 2001;Eske et al. 2023).
Chirps last between some tens and a few hundred milliseconds and involve complex frequency and amplitude modulations.Six distinct chirp types have been identified (Engler et al. 2000;Zupanc et al. 2006).They are defined by differences in duration, extent of the frequency and amplitude modulations, as well as additional features, such as the presence or absence of an undershoot before the frequency returns to baseline levels as evident in time-frequency plots.The usefulness of these features for differentiating different chirp types has been shown in several other studies (Ho et al. 2013a, b;Turner et al. 2007;Oboti et al. 2023).Most notably, by employing this approach, a comparative analysis revealed an enormous diversity of chirp signals in 13 species of apteronotids, which included not only variation across species but also between congeners and populations of the same species (Turner et al. 2007).
In A. leptorhynchus, spontaneously produced chirps are predominantly of type 1, whereas most chirps evoked by the EODs of a neighboring fish (or mimics of such electric signals) or by proper pharmacological stimulation belong to the type 2 category (Engler et al. 2000;Zupanc et al. 2006;Eske et al. 2023).Both type 1 and type 2 chirps are rather short (duration approximately 20 ms) but distinct in terms of the degree of frequency increase (400 Hz versus 100 Hz) and amplitude reduction (approximately 50% versus <10%).Longer chirps of type 3-6 are, most typically, generated by older individuals and directed to fish of the other sex.
While chirps can be elicited from either sex, at similar rates, through application of pharmacological agents (Eske et al. 2023), during electric interaction with conspecifics or in response to electric stimuli mimicking a fish's EOD males chirp at much higher rates than females (Zupanc and Maler 1993;Dulka and Maler 1994;Dunlap et al. 1998;Dunlap 2002;Triefenbach and Zakon 2003;Hupé and Lewis 2008).In addition, chirps are optimally evoked by electric stimuli with frequencies within ±10 Hz of the fish's EOD frequency (Engler and Zupanc 2001).Thus, type 2 chirps are typically exchanged by males.Moreover, the chirps produced by two electrically interacting fish are not independent of each other (Zupanc et al. 2006).Instead, the chirps generated by one fish follow the chirps of the other individual with a preferred latency of roughly 500-1000 ms (Zupanc et al. 2006).This 'echo response' may serve a communicatory function during social interactions, such as aggressive encounters.
Traditionally, different chirp types have been identified and quantified by visual inspection of time-voltage and time-frequency plots (e.g., Engler et al. 2000;Engler and Zupanc 2001;Zupanc et al. 2001;Dunlap and Larkins-Ford 2003;Zupanc et al. 2006;Kolodziejski et al. 2007;Hupé and Lewis 2008;Smith and Combs 2008;Dunlap et al. 2011;Gama Salgado and Zupanc 2011;Neeley et al. 2018).In addition, threshold-based algorithms (Bastian et al. 2001;Aumentado-Armstrong et al. 2015;Henninger et al. 2018;Allen and Marsat 2019;Field et al. 2019) and a method based on assumed chirp waveform (Eske et al. 2023) have been used for chirp detection.Whereas these approaches can be successfully employed for the identification of predefined chirp types, the definition of chirp categories is subject to the investigator's bias.Moreover, such approaches do not allow detection of possible additional chirp types that remained unnoticed previously.
To address these deficiencies, we have, in the present study, developed a supervised learning algorithm.Supervised learning is a machine learning paradigm (Bishop 2006) used across many disciplines.Its goal is to learn, from a "ground truth" (GT) data set, a function that assigns proper outputs (in the present study: time instances of chirps and associated chirp types) to inputs (in the present study: timeseries frequency and amplitude data).While we demonstrate the suitability of this machine learning paradigm for the unbiased analysis of chirps produced by A. leptorhynchus, we propose that similar approaches can be successfully applied to signal analysis in a variety of other ethological and neuroethological systems.

EOD recording
For the present investigation, time-voltage recordings of the EOD containing chirps generated spontaneously or evoked pharmacologically were analyzed.These data had been collected as part of a previous study examining the effect of urethane anesthesia on EOD frequency and chirping behavior in A. leptorhynchus (Eske et al. 2023).
Eight fish (total lengths: median, 116 mm; range 107-143 mm; body weights: median, 2.9 g; range 2.5-4.8g) were used.Their EOD baseline frequencies varied between 683 Hz and 868 Hz (normalized to frequency values expected at 26 • C, using a Q 10 of 1.56).The morphological data and EOD frequencies indicate that the fish were approximately 1 year old and included both males and females (Ilieş et al. 2014;Zupanc et al. 2014).
Details of the experiments and the recording technique are given in Eske et al. (2023).Briefly, each fish was kept in an isolation tank in which a cylindrical plastic tube provided shelter.Differential recording of the fish's EOD was done through a pair of stainless-steel electrodes mounted on the inside of the tube.During recording, the two open ends of the tube were closed with a coarse plastic mesh netting to ensure that the fish did not leave the tube.
The EOD of each fish was recorded for 30 min before, and 180 min immediately after, general anesthesia.State of anesthesia was induced by transferring the fish into a glass beaker containing 2.5% urethane dissolved in water from the fish's isolation tank.During the pre-anesthesia session, spontaneous chirps occurred but at very low rates of approximately 1 chirp/30 min.Anesthesia induced a tremendous increase in chirping behavior, resulting, on average, in 1500 chirps during the 30 min immediately following anesthesia.
For the present analysis, the 30-min-pre-anesthesia recordings, and the 180-min-post-anesthesia recordings, of the 8 fish were combined, yielding a total of 1680 min of EOD recording.Employing the supervised learning algorithm, a total of 30,734 chirps were detected in these combined recordings.

Calculation of EOD frequency and amplitude
The sampled voltage data t i , v i , i = 1, … , M v , were exported from Spike 2 and processed in MATLAB version R2021b.These data were filtered in 3-s windows with 2-s overlap using a bandpass filter with frequency band [0.5, 1.5] × f 0 , where the fundamental frequency f 0 in each 3-s window was determined based on the power spectrum of the signal using fast Fourier transform and the "findpeaks" function of MATLAB.
Based on the zero-crossings of the filtered signal, we then computed the time, frequency, and amplitude values T k , f k , A k associated with each k = 1, … , M, oscillation interval (for details, see Appendix A).An example of computed time-series data of frequency and amplitude is shown in Fig. 1.

Data collection
Tuples of equal-time-length time-series data segments were collected from each recording r = 1, … , n r , where n r is the total number of EOD recordings, and superscript ◻ (r)  indicates association with recording r.The time length of segments was determined as ΔT = T end − T start ∕n s .The values of parameters T start , T end , n s , n r , used for the genera- tion of time-series data segments are provided in Table 1.
Using the MATLAB tool shown in Fig. 2, a person previously trained to identify chirps collected all chirp instances from each segment S i for all indices i ∈ i GT , where the elements of subset 1), were randomly chosen, without replacement.
Although for each data point only time and frequency values were displayed during data collection (see Fig. 2), the associated amplitude values were also stored in the GT set of chirps where T i,j , f i,j , A i,j is the j-th data point of the i-th GT chirp sample, l i denotes the number of data points in the i-th sample, and n is the total number of samples.

Data processing
The person who collected chirp samples was instructed to include, in each sample, data points prior to and after chirping, associated with the non-modulated, instantaneous "base" frequency of the fish.Hence, we assumed that each sample includes both pre and post-chirp data points and estimated the "base" frequency and amplitude of each sample i as where n med < min i (l i ∕2) is an arbitrarily chosen positive integer which we set to n med = 10 .We normalized each sample i = 1, … , n with respect to the maximum frequency rise according to (1) and with respect to the base amplitude as Then, we centered the time values of each sample according to (6) where rectifier with was applied for the elimination of noise and to highlight "meaningful" parts of the frequency sample.Here sd(⋅) denotes the standard deviation, φi is the cutoff value of normalized frequency associated with sample i and = 50 is an arbitrarily chosen smoothing parameter.
Using the empirical cumulative distribution H i,⋅ of recti- fied frequency values h i,⋅ , we trimmed each sample, such that only the data points j within interval Ti,j ∈ −3Δ Ti , 3Δ Ti were kept, with Note that here Δ Ti is the difference between the 90% and 10% percentile estimates of the empirical cumulative distribution H i,⋅ .The above described data processing method is illustrated in Fig. 3.

Grouping and resampling
Because our supervised learning method requires uniform size among GT samples, we grouped and resampled all GT samples according to the number of data points that formed the individual GT samples.
After trimming, the size of each GT sample was roughly commensurate with the length of the associated chirp.To distinguish between chirps whose duration have different time scales, we divided GT samples into three groups and resampled the members of each r group such that associated samples contained 10 r + 1 number of points: Here we utilized the fact that all data points inside any GT sample can be located within the associated recording's time-frequency-amplitude data.For example, if we know that T i,1 and T q are from the same recording and that T i,1 = T q , then we can find any other point j associated with sample i: Note that chirps typically have a duration shorter than 0.5 s, and the highest EOD frequency in A. leptorhynchus is approximately 1000 Hz, therefore GT sample groups G r , r = 1, 2, 3, are able to capture the full length of all chirps.

Principal component analysis
After resampling, we recomputed, according to Eqs. 3-6, t h e n o r m a l i z e d f re qu e n c i e s a n d a mp l i t u d e s i,j cen,i +j , a i,j cen,i +j , j = −10 r ∕2, … , 10 r ∕2 , of each chirp sam- ple i in each GT group G r .For ease of notation, in the fol- lowing, we drop the shift j cen,i in the second subscript index.
For each r, we collected from G r the normalized fre- quency and amplitude values (13) Fig. 1 EOD frequency f (a) and amplitude A (b) with respect to time T in a recording involving urethane anesthesia (for details of computation see Sect."Calculation of EOD frequency and amplitude").After baseline recording, the tube with the fish was transferred from the home tank to a glass beaker containing 2.5% urethane solution dissolved in aquarium water.As soon as the fish stopped undulating its anal fin and moving its opercula, it was returned to the home tank (arbitrarily defined as time point T = 0 ).The gray bar indicates the time during which the fish was exposed to the anesthetic.Changes in the orientation and position of the fish relative to the recording electrodes result in noisy amplitude signals (pre-anesthesia, and T >∼ 2000 s as shown in b).The reduction of noise immediately after anesthesia is related to the ceased movement of the fish.Note onset of type 2 chirping at higher rates immediately after anesthesia (a/A1, b/B1) that persists to approximately T = 4600 s after exposure to the anesthetic (a/A2, b/B2 where m r is the total number of samples in G r associated with the training set.For the further ease of notation, in the following, we drop index r, as well. We determined the principal components (PCs) p 1 , … , p 2(10 r +1) , of X by performing the spectral ( 15) , decomposition of X T X .Then we projected the training data set onto the space of the first N PCs, i.e., we computed where

Gaussian mixture model fitting
We modeled the projected data Y T = y (1) , … , y (m) using the Gaussian mixture model (GMM) where N c , c is the multivariate normal distribution of the c-th mixture component with mean c ∈ ℝ N×1 and covar- iance c ∈ ℝ N×N , while M C p 1 , … , p C is a multinomial distribution with C number of categories and mixing proportions p 1 , … , p C .We estimated the unknown parameters

Elimination of outliers
After fitting the GMM, we assigned each data sample i to the cluster with maximum posterior probability, i.e., we computed the cluster of sample i according to for each i = 1, … , m , where P(c|i) is the probability that sample i belongs to cluster c, given the observation y (i) .Then, we computed the coefficient of determination (CoD) of the frequency component of each sample with respect to its assigned cluster mean as ( 20) Here ‖⋅‖ denotes the L2 norm and with 1 being a vector of 1-s.
We eliminated each cluster c for which the 5% percentile of associated CoD values j=1 , i = 1, … , M − 10 r in a moving time window containing 10 r + 1 samples (see Fig. 5a).At each instance i, we computed normalized frequency and amplitude values a c c o r d i n g t o f o r m u l a s E q s .3 -6 w i t h T i,j , f i,j , A i,j = T i+j−1 , f i+j−1 , A i+j−1 and l i = 10 r + 1.

Mahalanobis-distance-based detection
At each instance i, our Mahalanobis-distance-based (MDB) detection method first projects the normalized frequency and amplitude data onto the PCs according to  then it determines the kept cluster which is most likely to generate y (i) : Afterward, our method computes the Mahalanobis distance For any point generated by kept cluster c i , realizations d 2 i follow a chi-squared distribution with N degrees of freedom: The MDB method collects all i instances, where the squared Mahalanobis distance is below threshold d 2 and the maximum frequency rise is above threshold f , into the tuple Each contiguous segment in c MDB corresponds to an identified chirp.In each contiguous segment, we associate the identified chirp with the instance i that has lowest distance d i .Threshold d 2 is determined based on a chosen level of significance such that P D 2 i <  d 2 = 1 −  .The MDB method is illustrated in Fig. 5b.

Coefficient-of-determination-based detection
At each instance i, our coefficient-of-determination-based (CDB) detection method computes the CoD of the frequency component with respect to each kept cluster mean according to using formulae Eqs.22-23, and assigns instance i to the cluster with highest CoD value: Afterward, the CDB method collects all instances the tuple c CDB where the CoD value and the maximum frequency rise are both above thresholds R 2 and f , respectively: ( 27) Similarly to the MDB method, identified chirps are associated with contiguous segments in c CDB .In each contiguous segment, the identified chirp is assigned to the instance i that has the highest R 2 i,c i value.The CDB method is illustrated in Fig. 5c.

Chirp detection based on assumed chirp waveform
In order to assess the performance of the two algorithms detailed above, we chose, as a reference, the time-frequencyshape-based (TFSB) chirp detection algorithm described in (Eske et al. 2023).This algorithm is based on the chirp waveform function which is assumed to characterize, during chirps, the normalized frequency with respect to time T .This function is parameterized by a single parameter α that controls chirp duration (see Fig. 6).
The TFSB algorithm has 7 hyper-parameters, out of which we fixed 5 (see Table 2), and the remaining 2 we determined via cross-validation (see Sect. "Cross-validation").

Cross-validation
To determine the optimal hyper-parameter values h opt of detection algorithms, we used k-fold cross-validation.In particular, we randomized indices i ∈ i GT associated with time-series data segments S i and split them onto k number of equal-size folds: i GT,q ⊂ i GT , q = 1, … , k .For each iteration step q = 1, … , k, of cross validation, a single fold i GT,q was used as a test set for determining the performance of the algorithm, while the rest of the folds were used as a training set.Note that only the two supervised algorithms were trained (for details, see Sect."Training"), while the TFSB algorithm did not involve any training (Eske et al. 2023).The performance of each algorithm was determined by computing the false positive and false negative rates for each iteration step q = 1, … , k , as where 1(⋅) is the indicator function, T(s) j denotes the j-th time instance of chirps detected by the algorithm in time-series data segment S s , while T (s)  i,1 and T (s)   i,l i correspond to the first and last data point of the i-th chirp sample in G r collected from data segment S s .Parameters m A,s and m GT,s denote the total number of chirps detected by the algorithm in S s , and collected manually from S s , respectively.The overall performance of the algorithm was determined by averaging over all folds: (37) Note that false positive and false negative rates depend on hyper-parameters h .We tuned the hyper-parameters such that for a given maximum tolerated average false positive rate r FP , the average false negative rate is minimized, i.e., where is the search domain of hyper-parameters.At the maximum tolerated average false positive rate r FP , the lowest achievable average false negative rate is The implemented search domains of hyper-parameters are summarized in Table 3.

Performance of detection algorithms
For the GT group G 2 , we computed the lowest achiev- able average false negative rate r FN of each algorithm at given average false positive rate tolerances r FP (see Fig. 7) according to Eq. 39, using the search domains in Table 3.These results show that the performance of the MDB method is inferior to the CDB and TFSB methods.The CDB method performs better than the MDB and TFSB methods, although, the r FN r FP curves of the CDB and TFSB methods are nearly identical (Fig. 7). (38)

Principal components and explained variance
To illustrate waveform components that dominate GT group G 2 , we computed its PCs (Fig. 8a, b) and the explained vari- ance in terms of the number of its retained PCs (Fig. 8c).The first PC explains 90% of the variation in G 2 (Fig. 8c).The frequency shape of the first PC (PC1 in Fig. 8a, b) is similar to the chirp waveform of the TFSB method (cf.Fig. 6).This, together with the high percentage of explained variance associated with the first PC, result in a similar performance of the TFSB method and the CDB method (Fig. 7).

Chirp detection
After cross-validation, we trained a model according to Sect."Training" based on the entire GT data set G 2 .We used optimal hyper-parameters h opt r FP = 5% determined via 4-fold cross-validation (see Sect. "Cross-validation").The cluster means of the model, computed according to Eq. 22, are shown in Fig. 9.
After training, we employed the CDB method (under hyper-parameters h opt r FP = 5% ) to detect chirps in all 1680 min of EOD recordings.A total of 30,734 chirps were detected.We further investigated all detected chirps assigned to the cluster mean with the smallest proportion (6.73%, see Fig. 9).To find sub-clusters, we fitted a new GMM on these chirps according to Sect."Training" using N = 4 and C = 8.This analysis revealed a new chirp type (see Fig. 10) characterized by short, 20-30 ms duration, and two peaks in frequency rise and amplitude drop.These latter characteristics are distinct from all previously identified chirps of similar duration (c.f.Engler et al. 2000).It is important to note that here we focused on the cluster mean with the smallest proportion.The sub-clustering of chirps assigned to other cluster means may reveal further chirp types.
The distinct feature of this novel type, compared to the previously described six chirp types (Engler et al. 2000;Zupanc et al. 2006), is the existence of two frequency peaks (instead of just one peak); and the occurrence of two amplitude drops-the first, rather modest amplitude decrease is followed by a second, more pronounced reduction.Double frequency peaks have also been found in other apteronotid species, most notably in the A. bonapartii group (Turner et al. 2007).However, unlike the duplet frequency modulation characterizing the novel type in A. leptorhynchus, in A. bonapartii the first frequency increase is followed by a second, less pronounced increase.
Fig. 5 Illustration of the chirp detection methods described in Sect."Detection".Different rows correspond to different time instants ( t 1 < t 2 < t 3 < t 4 ) of the "sliding" time window indicated by vertical green lines in a.At each time instant, the Mahalanobis-distancebased detection algorithm (b) normalizes the data set inside the time window (green crosses in a) and projects it to the space spanned by the principal components of the training set (green cross in b).If the squared Mahalanobis distance value d 2 associated with this projected point (indicated at the top of each row in b) is below the limit of the cluster with highest posterior probability (corresponding to the colorcoded ellipse in b), then the Mahalanobis-distance-based algorithm may detect a chirp (2nd and 3rd row).At each time instant, the coefficient-of-determination-based algorithm (c) normalizes the data set inside the time window and computes its coefficient of determination with respect to each cluster mean.The highest coefficient-of-determination value R 2 among all cluster means is indicated at the top of each row in c, and the related cluster mean is plotted (color-coded line in c).If this value is above a threshold, then the coefficient-of-determination-based algorithm may detect a chirp

Advantages of the supervised-learning method
The results presented in this paper demonstrate the superiority of our supervised-learning algorithm over traditional methods for analysis of chirps produced by A. leptorhynchus.
The first advantage of our method lies in its versatility, compared to traditional approaches.As shown in Sect."Principal components and explained variance", the TFSB method performs well for the herein analyzed signal segments because a single time-frequency waveform (associated with type 2 chirps) dominates the collected GT chirp data set, and this waveform matches well the assumed time-frequency shape.If multiple dominant waveforms are present in the GT chirp data set, or if the assumed time-frequency shape does not match the dominant chirp waveform, the performance of the TFSB method would be significantly worse.Furthermore, the design of a shape function representative of the dominant chirp waveform is rather cumbersome and impacted by the researcher's bias.In contrast, the supervised-learning algorithm autonomously trains chirp waveform models by fitting them to the collected GT chirp data.Given that the GT data set is representative of chirps in the analyzed signal, this algorithm provides an unbiased way for the automatic identification of dominant chirp waveforms in the signal.
The second advantage of our supervised-learning method is its ability to identify, in an unbiased way, possible subtypes of a signal.In the case of chirping behavior in A.   Engler et al. 2000;Zupanc et al. 2006).Although, in the present study, the analyzed recordings contained predominantly a single chirp subtype (type 2), our method suggested that further differentiation of this subtype is possible (see Sect. "Chirp detection").
The third advantage of our method is that, compared to traditional approaches, it extracts more information from the samples used for the validation of the algorithm.Note that only a few traditional approaches validate their algorithm (e.g., Eske et al. 2023) by signals with known chirp types and locations.However, these approaches use the collected set of chirps only to test efficiency, and thus the algorithm itself is not informed by the known chirp content.By contrast, our supervised learning method takes full advantage of known chirps and utilizes them for both training the algorithm and testing its efficiency.

Limitations of the method
Although our algorithm trains itself and identifies chirp clusters automatically, it still relies on the collection of GT samples.Consequently, results are still impacted by the bias of the individual who collects the chirp samples of the GT set.This bias can be reduced if multiple individuals carry out chirp collection using the same signal, and if the GT set When chirps appear in the signal at a low frequency, the time needed for an individual to collect a sufficiently large GT set increases.While the validation of any algorithm requires the collection of all chirps from a test signal, the number of samples needed by our supervisedlearning method is higher than the number of samples needed for validation only.Nevertheless, our method can still be advantageous compared to traditional approaches when already detected chirp types are expected in future experiments.In such cases, the cluster shapes from already collected GT sets can be reused.Furthermore, one can even build libraries of cluster shapes which can then be employed to "scan" signals for all formerly identified chirp shapes.
As input, our supervised learning method uses the time-frequency-amplitude signal (T k , f k , A k ) , k = 1, 2, … .While the method for the computation of this signal, described in Sect."Calculation of EOD frequency and amplitude", works only for time-voltage data that were generated by a single EOD source, for the analysis of multiple (either synthetic or recorded from fish) simultaneously recorded EOD signals, one can employ a different method (e.g., Raab et al. 2022) to extract individual time-frequency-amplitude signals.

Perspectives
The presented supervised learning algorithm provides a valuable tool for further examining the function of chirps.In the present study, it has not only enabled us to validate the previous classification of chirps into different subtypes, but also suggested that further differentiation of these subtypes is possible.Whether these sub-subtypes of chirps subserve any behavioral function remains to be examined.
It is likely that other algorithms based on supervised machine learning will exhibit advantages similar to our approach.Thus, the present study might serve as proofof-principle of the suitability of the supervised-machinelearning paradigm for a broad range of signals analyzed in neuroethology.It is likely that, in future investigations, algorithms based on machine learning paradigms like the one implemented in the present study will increasingly become standard tools for signal analysis in neuroethological research.

Fig. 3
Fig. 3 Processing of "ground truth" samples (see Sect. ""Ground Truth" data set").Data points T i,j , f i,j l i j=1 of the i-th sample are plotted in a as black dots.The frequency values f i,j l i j=1 are normalized according to Eq. 5 and passed through the rectifier function (red curve) displayed in b.The green dashed lines in b and c display the cutoff value φi of the rectifier function.The centered and normalized data points Ti,j ,  i,j l i j=1 of the i-th sample (see Eqs. 5-11) are dis-

Figure 4
illustrates the projected training data Y from G 2 , with parameters N = 2 and C = 5 ; note the eliminated cluster.Detection Training yields PCs P N and GMM where C * ≤ C is the number of kept clusters, with pc = pc ∕ ∑ C * q=1 pq , and pc , ̂ c , ̂ c , being the estimated parameters of kept clusters c = 1, … , C * .To detect chirps in recordings, we analyzed data points T , f i+j−1 , A i+j−1 10 r +1

Fig. 4
Fig. 4 Training data set projected to the space spanned by the first two principal components (PC1 and PC2).Circles with different colors correspond to clusters identified by the algorithm.Gray crosses correspond to samples in an eliminated cluster.The percentage-wise size of kept (circles) and eliminated (crosses) clusters is indicated at the top left corner, relative to the size of training set

Fig. 6
Fig. 6 Time-frequency shape function used for chirp detection in Eske et al. (2023).The time course of normalized frequency (see Eq. 5) during chirping is modeled by a single-parameter function  T; α .Different colors correspond to different shape parameter values α

Fig. 8 Fig. 9
Fig. 8 Normalized frequency (a) and amplitude (b) in the first two principal components (PC1 and PC2) of the "ground truth" data set G 2 .Explained variance as a function of retained principal components (gray line in c).The black cross in c corresponds to optimal hyper-parameter settings h opt r FP = 5% determined by 4-fold crossvalidation (see Sect. "Cross-validation")

Fig. 10
Fig.10Cluster mean (red) and detected chirp samples (gray) in a sub-cluster (containing 264 samples) related to the cluster with 6.73% proportion in Fig.9a(see Sect."Chirp detection").The black curve displays the median of detected chirp samples across feature dimensions Normalized frequency

Table 1
Parameter values used for generating time-series data segments S i , i ∈ i GT , from which "ground truth" chirp samples G

Table 3
Search domains of hyper-parameters for the Mahalanobisdistance-based (MDB), coefficient-of-determination-based (CDB), and time-frequency-shape-based (TFSB) chirp detection algorithms leptorhynchus, visual inspection of time-frequency plots and time-voltage plots has suggested six subtypes of this signal (