## Abstract

The distance between a pair of spike trains, quantifying the differences between them, can be measured using various metrics. Here we introduce a new class of spike train metrics, inspired by the Pompeiu-Hausdorff distance, and compare them with existing metrics. Some of our new metrics (the modulus-metric and the max-metric) have characteristics that are qualitatively different from those of classical metrics like the van Rossum distance or the Victor and Purpura distance. The modulus-metric and the max-metric are particularly suitable for measuring distances between spike trains where information is encoded in bursts, but the number and the timing of spikes inside a burst do not carry information. The modulus-metric does not depend on any parameters and can be computed using a fast algorithm whose time depends linearly on the number of spikes in the two spike trains. We also introduce localized versions of the new metrics, which could have the biologically relevant interpretation of measuring the differences between spike trains as they are perceived at a particular moment in time by a neuron receiving these spike trains.

## 1. Introduction

In recent years, several spike train distances, some inspired by existing mathematical distances and others not, have been proposed and used to measure the variability of neural activity (Victor & Purpura, 1996, 1997; van Rossum, 2001; Schreiber, Fellous, Whitmer, Tiesinga, & Sejnowski, 2003; Victor, 2005; Schrauwen & Van Campenhout, 2007; Kreuz, Haas, Morelli, Abarbanel, & Politi, 2007; Kreuz, Chicharro, Andrzejak, Haas, & Abarbanel, 2009; Naud, Gerhard, Mensi, & Gerstner, 2011; Kreuz, Chicharro, Greschner, & Andrzejak, 2011; Kreuz, Chicharro, Houghton, Andrzejak, & Mormann, 2013). The distance between two spike trains reflects their similarity or dissimilarity. Because how information is represented in the spatiotemporal patterns of spike times exchanged by neurons is still a heavily debated topic in neuroscience, metrics based on different neural codes are available. Traditionally it was thought that the mean firing rate of neurons encapsulated all the relevant information exchanged by neurons. This idea dates back to the work of Adrian (1926), who showed that the firing rate of motor neurons is proportional to the force applied. More recently, scientists have revealed increasing evidence of the importance of precise spike timings to representing information in the brain (Bohte, 2004; VanRullen, Guyonneau, & Thorpe, 2005; Tiesinga, Fellous, & Sejnowski, 2008). For example, temporally structured multicell spiking patterns were observed in the hippocampus and cortex and were associated with memory traces (Nádasdy, Hirase, Czurkó, Csicsvari, & Buzsáki, 1999; Ji & Wilson, 2007), while the coding of information in the phases of spikes relative to a background oscillation has been observed in many brain regions (Lee, Simpson, Logothetis, & Rainer, 2005; Jacobs, Kahana, Ekstrom, & Fried, 2007; Fries, Nikolić, & Singer, 2007; Montemurro, Rasch, Murayama, Logothetis, & Panzeri, 2008; Siegel, Warden, & Miller, 2009). This change in viewpoints from rate codes to spike time codes is also reflected in spike train metrics.

The most basic metrics are the ones that rely on counting the total number of spikes within a spike train. A major drawback of such an approach is that all the temporal structure is lost. Although binning techniques were introduced as a way to overcome this loss by dividing the spike train into discrete bins, the temporally encoded information within a bin was neglected (Geisler, Albrecht, Salvi, & Saunders, 1991). Other, more complex spike train metrics can be obtained by focusing on the precise spike timing instead of their total count. One example is the van Rossum (2001) distance, which is calculated by filtering the time series corresponding to the raw spike train with a smoothing kernel, typically an exponential one, and then using the standard Euclidean distance. Another metric is the Schreiber et al. (2003) correlation-based measure, which uses a symmetric (gaussian) filter. In both cases, the choice of the kernel's parameters is arbitrary and has a high influence on the properties of the metric.

Another metric was introduced by Victor and Purpura (1996, 1997). According to this metric, the distance between two spike trains is given by the minimum cost of basic operations needed to transform one spike train into the other. The basic operations are insertion or deletion of spikes, with a cost of 1, and the shifting of a spike, with a cost of , where *q* is a parameter and the shifting interval. The parameter *q* significantly influences the behavior of the metric: for *q* = 0, the metric counts the difference in the total number of spikes, while for large values of *q*, the metric returns the number of noncoincident spikes.

Kreuz et al. (2007, 2009, 2011, 2013) more recently introduced a series of parameter-free and timescale-independent measures of spike train synchrony.

Here we introduce a new class of spike train metrics inspired by the Pompeiu-Hausdorff distance between two nonempty compact sets (Pompeiu, 1905; Hausdorff, 1914). Preliminary results have been presented in abstract form in Rusu and Florian (2010).

Section 2 describes the new metrics. Section 3 introduces the localization of spike train metrics. Section 4 presents the application of the new metrics in several simulations that explore the features of the metrics and compare the new metrics with existing ones. After sections that discuss the results and present the conclusions, the letter ends with a series of appendixes that include detailed mathematical proofs that the introduced metrics are finite and obey the mathematical requirements for metrics, as well as computer algorithms that allow fast computation of the modulus-metric.

## 2. A New Class of Spike Train Metrics

*n*>1, then

*t*

^{(i−1)}<

*t*

^{(i)}, . We denote by

*a*and

*b*some bounds of the considered spike trains, , with , finite, and

*a*<

*b*. We denote by the set of all possible such spike trains bounded by

*a*and

*b*. We study metrics that compute the distances between two spike trains

*T*and from .

*h*returns the largest difference in absolute value between the timing of a spike in one train and the timing of the closest spike in the other spike train, or, equivalently, the minimal number such that the closed -neighborhood of

*T*includes and the closed -neighborhood of includes

*T*: Another equivalent form of the Pompeiu-Hausdorff distance is the following (Papadopoulos, 2005; Rockafellar & Wets, 2009; Deza & Deza, 2009):

*a*,

*b*], we also have The Pompeiu-Hausdorff metric has quite poor discriminating power; for many variations of the spike trains, the distances will be equal, and any spike train space endowed with this metric would be highly clustered. Our new metrics generalize the form of the Pompeiu-Hausdorff distance given in equation 2.8 by introducing features that are more sensitive to spike timings.

### 2.1. The Max-Metric.

*m*the upper bound of on the interval [0,

*b*−

*a*]: In typical applications, has a maximum for

*x*=0 and is a decreasing function of

*x*, for example, an exponential, or a gaussian, with a positive parameter.

*s*along the interval [

*a*,

*b*] that contains the two spike trains, the maximum of the difference in absolute value between the distances from a point

*x*in that interval to the two spike trains, weighted by the kernel , which focuses locally around

*s*. Figure 1 shows how the distance between two spike trains is computed using the max-metric.

The max-metric is a generalization of the Pompeiu-Hausdorff distance, since in the particular case that , we have .

In appendix A we show that *d _{m}* is finite and that it satisfies the properties of a metric. We also show that regardless of the kernel , all the max-metrics are topologically equivalent to each other (O'Searcoid, 2007) because they are equivalent to the Pompeiu-Hausdorff distance. Each metric will generate the same topology, and thus any topological property is invariant under a homeomorphism. This means that the metrics generate the same convergent sequences in the space of spike trains . Thus, learning rules derived from these metrics will converge in the same way regardless of the choice of .

### 2.2. The Modulus-Metric.

The modulus-metric does not depend on any kernels or parameters, and it also allows a fast computer implementation with linear complexity. This is because the graph of the function is made out of line segments that join or end in the following points: all timings of spikes in the two spike trains *T* and , the time moments that lie at the middle of the interval between two neighboring spikes from the same spike train, the time moments that lie at the middle of the interval between a pair of neighboring spikes where the two spikes belong to different spike trains, and the bounds *a* and *b*. This is exemplified in Figures 1D and 3D. We denote by the set of these points. In order to compute the integral of this function , it is sufficient to compute the function at the points from . Since between these points the function is linear, the integral can be then computed exactly.

Algorithm 1 presents an implementation of the *d _{o}* metric in pseudocode. (All algorithms are in appendix E.) In this algorithm, the function is computed in a set of points that includes but also other points. In Algorithm 2, the set as well as the value of in the points of is computed with a single pass through the spikes in the two spike trains. The algorithms’ duration depends linearly on the number of spikes in the two spike trains, . (Implementations in Python and C++ of the two algorithms are available at https://github.com/modulus-metric/.)

It can be shown that the distance *d _{o}* is finite and that it satisfies the properties of a metric by particularizing the proofs in appendix D with , .

### 2.3. The Convolution Max-Metric.

*x*<0 and strictly decreasing for

*x*>0, with finite and positive. We thus have . Typically is an exponential, with being a positive parameter. We convolve the two spike trains

*T*and with the filtering kernel to obtain We denote by the set of all possible filtered spike trains from .

We also consider a function that is strictly positive, that is derivable on (0, *b*−*a*), and has a bounded derivative.

## 3. Localized Metrics

*a*,

*b*], of the distance between the spike trains. These local perspectives were then integrated in the final distance. In this section, we introduce different metrics that also depend on a kernel , but for which the kernel has a different purpose. Here, the kernel may be regarded as a magnifying glass to be used to focus on one specific area of the spike trains. The kernel should be a continuous, positive function, . Similarly with , because is a continuous function with bounded support, it is bounded:

### 3.1. Localized Max-Metric.

*d*between two spike trains is computed. The differences between the spike trains that account the most for the distance are those that are close to

_{l}*b*. The shape of has a high impact on the behavior of the metric. In appendix C, we show that the distance

*d*is finite and that it satisfies the properties of a metric.

_{l}### 3.2. Localized Modulus-Metric.

*d*is finite and that it satisfies the properties of a metric.

_{n}### 3.3. Localizing the van Rossum Metric.

*H*is the Heaviside step function,

*H*(

*x*)=0 if

*x*<0 and

*H*(

*x*)=1 if , and is defined in equation 2.18. When localized with , the distance becomes Here, may be chosen to have the same qualitative properties as the kernels used in equations 3.2 to 3.4.

## 4. Simulation Results

We analyzed the behavior of the introduced metrics through computer simulations using simple setups. Across all simulations, was an exponential (see equation 2.13) with ms. For the localized metrics *d _{l}* and

*d*, also was an exponential (see equation 2.13) with ms. The convolution kernels for the

_{n}*d*and van Rossum distances were chosen as exponentials (see equation 2.18) with ms. The width of the gaussian filter for the Schreiber et al. distance was 10 ms. For the Victor and Purpura distance, we set

_{c}*q*=0.2 ms

^{−1}, except in Figures 7 to 9 where we also used

*q*=0.001 ms

^{−1}as in Dauwels, Vialatte, Weber, and Cichocki (2009). We set

*a*=0 ms and

*b*the maximum length of spike trains (either 200 or 500 ms, except in Figure 12, where the length was variable).

### 4.1. Inserting or Shifting One Spike.

*T*and a spike train obtained from it by either inserting or shifting one spike. In the insertion case, was generated by inserting a spike into

*T*at various timings. In the shifting case, was generated by shifting a particular spike of

*T*. The distance was plotted against the time of the inserted spike or of the shifted spike to see how the change is reflected by the metrics. To compute the distance, we used the introduced metrics, a simple spike count distance (

*c*), the van Rossum (2001) (

*d*), Victor and Purpura (1996, 1997) (

_{R}*d*), Schreiber et al. (2003) (

_{VP}*s*), and Pompeiu-Hausdorff (

*h*) distances, as well as the ISI distance (

*k*) and the improved SPIKE distance (

_{i}*k*) by Kreuz et al. (2007, 2013). The spike count distance is defined as where

_{s}*n*and are the number of spikes in each train. The spike trains were 200 ms long.

The results for the insertion case are presented in Figure 4. The Victor and Purpura distance was constant since the cost of adding and removing a spike is fixed at 1 regardless of its timing. Similarly, the van Rossum metric was insensitive to the time of the inserted spike, a result that can be also shown analytically (van Rossum, 2001). The spike count distance remained constant regardless of where the spike was inserted. The results were qualitatively different in the case of our newly introduced distances, with the exception of the convolution max-metric, and in the case of the Kreuz et al. and Schreiber et al. metrics. In the case of the Pompeiu-Hausdorff distance, max-metric, modulus-metric, of the localized variants of the max-metric and the modulus-metric, and of the Schreiber et al. and Kreuz et al. metrics, the insertion time of the spike had a significant impact on the outcome (see Figure 4). When the inserted spike overlapped an existing spike, the Schreiber et al. distance had a low value but remained nonzero, while our new metrics, with the exception of the convolution max-metric, as well as the Kreuz et al. metrics, returned a zero distance. It can also be seen that the localized distances were strongly influenced by the shape of the kernel.

The results for the shifting case are presented in Figure 5. When the spike at *t*^{(4)} was shifted, the Victor and Purpura and van Rossum distances were dependent only on the width of the shifting interval. These results are confirmed by analytical derivations (Victor & Purpura, 1996; van Rossum, 2001). As in the previous case, the spike count distance was insensitive to the shift operation and remained zero since the number of spikes did not change. In contrast, our newly introduced distances, with the exception of the convolution max-metric, and the Schreiber et al. and Kreuz et al. metrics, showed a dependence not only on the width of the shifting interval but also on the particular timing of the shifted spike. The results are similar to the ones in Figure 4 of Kreuz et al. (2011).

### 4.2. Bursts.

We generated a template spike train *T* containing three bursts and one isolated spike. We computed, in six setups, using various metrics, the distance between *T* and another spike train obtained from *T* by removing one spike from a burst, inserting one spike into a burst, or removing or inserting one spike not belonging to the bursts. After computing the distances for each of the setups, the distances for each metric were normalized to the maximum distance for that particular metric among the setups. The normalized distances are shown, for each setup, in Figure 6. When a spike is added to a burst or removed from a burst, the max-metric and modulus-metric distances, as well as the Kreuz et al. distances, are close to zero. Those distances become nonnegligible when a solitary spike, far from a burst, is removed or a new spike is added far from a burst. The normalized convolution max-metric and the van Rossum distances are close to 1 and the Victor and Purpura distance is exactly 1 in all setups. The Schreiber et al. distance exhibited an intermediate behavior, but it also remained nonnegligible in all setups.

### 4.3. Discriminating Timing Precision versus Event Reliability.

Timing precision and event reliability are distinct characteristics of the variation of a spike train (Tiesinga et al., 2008). In computational neuroscience, there is a need for spike train metrics to both characterize the overall variability and parse out the precision and reliability separately (Toups, Fellous, Thomas, Sejnowski, & Tiesinga, 2012). We investigated how our new metrics and existing metrics perform in discriminating precision versus event reliability (Dauwels et al., 2009). We generated a 200 ms template spike train *T* using a Poisson process with a rate of 100 Hz. We also generated various spike trains obtained from *T* by both applying to spikes from *T* a gaussian jitter with zero mean and variance in the range of 0 and ms, and removing spikes with a probability *p* ranging from 0 to *p _{m}*=80%. For each pair, we ran 100 trials, where in each trial we generated randomly a new . For each trial, we computed the distances between

*T*and using various metrics and then averaged the results over the trials. For each metric, average distances were then normalized to the maximum average distance across the parameters. The results are presented in Figures 7 to 10. Figure 7 represents the normalized average distances as a function of and

*p*. Figures 8 and 9 represent sections trough the graphs in Figure 7, for illustrating more clearly the dependencies of distances on reliability and precision.

*p*is dimensionless, while represents a time interval. In order to compare them, we take into consideration that the relevant intervals on which

*p*and vary are practically bounded. Choosing and

*p*is theoretically arbitrary, but in practice,

_{m}*p*is something slightly less than 1 and the relevant is constrained by the timescales of the considered spike trains and the distances that depend on timescale-like parameters. We use these practical bounds so that the variances with respect to the two parameters can be brought to the same dimension and compared. By dividing the intervals [0,

_{m}*p*] and into the same number of bins

_{m}*N*, we get two-dimensional pixels of size and on which we can consider that the variation of

*d*along the two axes can be compared. We computed where was replaced with the considered metrics. In areas of the

*p*, space where is positive, we may say that the metric is more sensitive to reliability, while in areas where it is negative, the metric is more sensitive to the precision of spikes. The interpretation of results should take into consideration the caveat that changes of the ratio may change the sign of .

As expected, the Victor and Purpura distance with *q*=0.001 ms^{−1} does not depend at all on the precision, just on reliability, since it basically counts the difference in the number of spikes between the spike trains. Our modulus-metric and max-metrics have a stronger dependence on reliability than on precision on most of the considered range, except for high reliability (very low *p*) where the dependence on precision is still dominant. For the van Rossum and Schreiber et al. distances, the dependence on reliability and precision is somehow balanced. The Kreuz et al. distances and the Victor and Purpura distance with *q*=0.2 ms^{−1} have a stronger dependence on precision than on reliability. For all distances, except for the Victor and Purpura distance with *q*=0.001 ms^{−1}, the sensitivity to reliability increases with the unreliability (with the probability *p* of spikes not being fired). These results may be different for a different choice of the ratio, of the timescales of the considered spike trains and of the parameters of the parameter-dependent distances. Our results are similar to those of Dauwels et al. (2009) for the Victor and Purpura distance *q*=0.001 ms^{−1}, but different for the Schreiber et al. distance, probably because Dauwels et al. (2009) used a different approach for modeling the unreliability of spikes.

### 4.4. Correlations.

We explored the correlation between the newly introduced metrics and the classical Victor and Purpura and van Rossum distances. We generated a 500 ms Poisson spike train with a firing rate of 20 Hz. From this spike train, we generated a new one by adding a gaussian jitter with zero mean and 20 ms variance. We considered only generated and jittered spike trains that contained 10 spikes. We then measured the distance between the original and the jittered spike train using various metrics. We repeated this in 1000 trials, where for each trial, the original spike train and the jitter were generated randomly. For each metric, distances were normalized to the mean value across samples. The results are displayed in Figure 11. Table 1 shows the correlation coefficients between the max-metric, the modulus-metric, the convolution max-metric, the Schreiber et al. distance, the Kreuz et al. distances, and, respectively, the van Rossum and Victor and Purpura distances.

Distance . | d Correlation Coefficient
. _{R} | d Correlation Coefficient
. _{VP} |
---|---|---|

d _{m} | 0.54 | 0.48 |

d _{o} | 0.54 | 0.47 |

d _{c} | 0.84 | 0.81 |

s | 0.87 | 0.88 |

k _{s} | 0.51 | 0.70 |

k _{i} | 0.43 | 0.44 |

d _{R} | 1.00 | 0.78 |

d _{VP} | 0.78 | 1.00 |

Distance . | d Correlation Coefficient
. _{R} | d Correlation Coefficient
. _{VP} |
---|---|---|

d _{m} | 0.54 | 0.48 |

d _{o} | 0.54 | 0.47 |

d _{c} | 0.84 | 0.81 |

s | 0.87 | 0.88 |

k _{s} | 0.51 | 0.70 |

k _{i} | 0.43 | 0.44 |

d _{R} | 1.00 | 0.78 |

d _{VP} | 0.78 | 1.00 |

Note: Computed from data presented in Figure 11.

### 4.5. Computation Speed.

We computed the distances between pairs of randomly generated spike trains, the spike trains within a pair having the same number of spikes *n*. We varied *n* from 5 to 500 while keeping constant the firing rate of the spike trains. The trains were generated by randomly choosing the *n* firing times from a uniform distribution between 0 and *n**T*, where *T* = 35 ms. We measured the average time needed to compute distances as a function of the number of spikes. Performance was measured using C++ implementations of the metrics, running on an Intel Core 2 processor. The Victor and Purpura metric was computed using the algorithm in Victor and Purpura (1996). The van Rossum metric was implemented using the exact, optimized algorithm presented in Houghton and Kreuz (2012) (A1) and a discrete-time integration with a time step of 1 ms (A2), which turned out to be slightly faster than the optimized one. The Schreiber et al. and the Kreuz et al. metrics have also been computed using a 1 ms integration time step. The modulus-metric was implemented using algorithms 1 and 2. (The code used for all metrics is available at https://github.com/modulus-metric/.) The results are presented in Figure 12. In Figure 12A, the results were averaged over 1000 trials; in the other panels, the results were averaged over 10,000 trials.

The simulations showed that the max-metric and the Schreiber et al. metric are relatively slow to compute. Those two metrics and the Victor and Purpura metric require a computation time that grows more than linearly with the number of spikes. The other metrics have an approximately linear dependence on the number of spikes; we fitted them with a line and computed the proportionality coefficients in Table 2. The fastest distances or algorithms were, in order, modulus-metric, algorithm 2; van Rossum, A2; Kreuz et al. ISI distance; van Rossum, A1; modulus-metric, algorithm 1; and Kreuz et al. improved SPIKE distance. It should be noted that while the modulus-metric algorithms and the van Rossum A1 algorithm compute the distances exactly (within machine numerical precision), the other linear-time algorithms compute numerical approximations of the distances through discrete time integration, with a precision that depends on the integration time step.

Distance (and Algorithm) . | Computing Time per Spike (ms) . |
---|---|

d A2 _{o} | 0.001570 |

d A2 _{R} | 0.001831 |

k _{i} | 0.001965 |

d A1 _{R} | 0.002437 |

d A1 _{o} | 0.003323 |

k _{s} | 0.010910 |

Distance (and Algorithm) . | Computing Time per Spike (ms) . |
---|---|

d A2 _{o} | 0.001570 |

d A2 _{R} | 0.001831 |

k _{i} | 0.001965 |

d A1 _{R} | 0.002437 |

d A1 _{o} | 0.003323 |

k _{s} | 0.010910 |

Note: Notation and data as in Figure 12.

## 5. Discussion

The max-metric and the modulus-metric behave in a qualitatively different way from the classical van Rossum and Victor and Purpura distances (see Figures 4 to 6), but similar to the Kreuz et al. distances. Within a set of spike trains that are considered by the van Rossum and Victor and Purpura metrics to be at equal distance from a reference spike train, the max-metric, the modulus-metric, and the Kreuz et al. metrics can distinguish a range of distances that reflect similarities in the structure of the compared spike trains (see Figures 4 and 5). When comparing spike trains that include bursts, the max-metric, the modulus-metric, and the Kreuz et al. metrics ignore differences in the number and position of spikes inside the bursts, while these kinds of differences are considered by the van Rossum and Victor and Purpura metrics as significant as in the case that differences exist outside the bursts (see Figure 6). This makes the max-metric, the modulus-metric, and the Kreuz et al. metrics particularly suitable for measuring distances in spike trains where information is encoded in the timing of bursts or solitary spikes, but not in the internal structure of bursts. This is the case in some experiments, such as Reinagel, Godwin, Sherwin, and Koch (1998), where bursts regarded as unitary events encoded more information per event than otherwise, or such as Kepecs and Lisman (2003), where the timing of the first burst spike carried 70% of the information and the spike count only 22% of the information. However, in other cases, the internal structure of bursts does carry information (Krahe & Gabbiani, 2004). The Schreiber et al. metric has a behavior that is intermediate between the one of the max-metric, the modulus-metric, and the Kreuz et al. metrics, on one side, and the van Rossum and Victor and Purpura metrics, on another side.

While the max-metric depends on a kernel that can be particularized to cause distinct behaviors and the van Rossum, Victor and Purpura, and Schreiber et al. distances also depend on parameters that must be chosen by their users, the modulus-metric does not depend on any parameters, similar to the Kreuz et al. (2009, 2011, 2013) metrics. The lack of parameters allows one to start analyzing data immediately, without the need to preprocess them in order to find the appropriate parameters. A parameter-free distance also gives a more objective measure that does not depend on any assumptions to be made by the experimenter. In some cases, when the timescales vary during an experiment, no single timescale may characterize the spike trains, and thus a timescale-independent measure may be preferable.

We have also shown that the modulus-metric can be computed faster than any of the other considered metrics through an algorithm that operates in a time that depends linearly on the number of spikes in the considered spike trains. This fast algorithm computes the distance exactly (within machine precision), not as a numerically approximated discrete time integration, as some algorithms for other metrics do.

The convolution-metric that we introduced, although analytically similar to the max-metric, is qualitatively similar to the van Rossum distance. A qualitative difference between the convolution-metric and the van Rossum distance appears when the differences between the spike trains are localized near the ends of the integration interval; this is a simple consequence of the difference between the bounded integration interval for the convolution-metric and the infinite integration interval for the van Rossum distance.

We have considered only spike trains having nonoverlapping spikes. If we relax this constraint, for our newly introduced distances, with the exception of the convolution max-metric, we get a zero distance between a spike train and a second one generated from the first by adding an extra spike to the first, overlapping an existing spike (see Figure 4). This is due to the distance *d* between an arbitrary timing and a spike train in equation 2.5 that does not distinguish between overlapping spikes in a train. Thus, if we relax the constraint of not allowing nonoverlapping spikes, these distances become pseudometrics because there might be a zero distance between two spike trains that differ through overlapping spikes. However, the case of overlapping spikes is biologically implausible if we consider spike trains fired by single neurons. If it is enough that the distances are pseudometrics, we may also relax some of the conditions of the kernels, such as the requirement for to be strictly positive on (0, *b*−*a*] or the conditions on .

For our metrics, when the integrating interval [*a*, *b*] extends beyond the interval covered by extremes of the spike trains, for example, for a pair of spike trains, the result of the integration in the area not covered by extremes of the spike trains adds to the distance without contributing information about the spike trains. Thus, the integrating interval should preferably be chosen as the interval covered by the extremes of the considered set of spike trains. Alternatively, one may artificially add to all considered spike trains two extra spikes at the extremities *a* and *b* of the integrating interval, a procedure that is also used by the Kreuz et al. metrics (Kreuz et al., 2013).

We have introduced localized versions of our metrics, which, depending on the localization kernel , could have a biologically relevant interpretation of measuring the differences between two spike trains as they are perceived at a particular moment in time by a neuron receiving these spike trains.

## 6. Conclusion

We have introduced here a new class of spike train metrics, inspired by the Pompeiu-Hausdorff distance. The max-metric and the modulus-metric behave in a qualitatively different way from classical metrics and are particularly suitable for measuring distances in spike trains where information is encoded in the identity of bursts as unitary events. The modulus-metric does not depend on any parameters and can be computed faster than other distances in a time that depends linearly on the number of spikes in the compared spike trains.

## Appendix A: Analysis of the Max-Metric

.

*is a metric*.

In order to show that is a metric, we need to prove that it is nonnegative, that for any , that it is symmetric, and that it satisfies the triangle inequality.

It is trivial to show that is nonnegative and symmetric, and that if .

*T*; in the case that it belongs to , the proof is analogous. Let

*u*be the timing of this spike, . Because , we have, , Because ,

*d*(

*u*,

*T*)=0. Thus, By integrating equation A.7, we obtain Because , . Also, considering equation 2.9, we have Thus, from equations A.8 and A.9, . Since we considered that , this cannot be true. Hence, . Likewise, one can show that , and so .

*f*and

*g*, it follows that

With this final equality, we have shown that the distance is indeed a metric, and the proof ends.

*The metric**is topologically equivalent to the Pompeiu-Hausdorff distance*.

In order to show that the metrics *d _{m}* and

*h*are topologically equivalent, it is sufficient to prove that the identity function , and its inverse are both continuous (O'Searcoid, 2007, p. 229; Deza & Deza, 2009).

## Appendix B: Analysis of the Convolution Max-Metric

*g*is bounded since it is continuous on a compact interval (Protter, 1998). We denote by

*M*the bound of the absolute value of

*g*: , . We denote by

*L*the bound of the absolute value of the derivative of

*h*: , . Let and . Then for all , From equations B.5 and B.7, Because , we have , it follows that Because , Applying supremum to equation B.10, we obtain It follows that Analogously, by switching

*s*and

*s*

_{0}, in equation B.3 and the ensuing equations, we get Thus, we have proved equation B.2, and the proof ends.

.

*is a metric*.

*q*is continuous. Because of the properties of , such that ; and because is strictly positive, it follows that

*q*is not zero everywhere, such that

*q*(

*x*)>0. Because

*q*is continuous, it follows that which contradicts the hypothesis that . Hence, .

The triangle inequality can be proven in a similar way to the proof in the max-metric case.

## Appendix C: Analysis of the Localized Max-Metric

.

*is a metric*.

It is trivial to show that is nonnegative and symmetric, and that if .

In order to prove that , we use a reductio ad absurdum argument. Assume that with . Then there must be at least one spike in one of the two spike trains that is not in the other. Consider that this spike belongs to *T*; in the case it belongs to , the proof is analogous. Let *u* be the timing of this spike: .

*u*>

*a*. We have, , Because ,

*d*(

*u*,

*T*)=0 and , thus, Multiplying by and integrating equation C.6, we obtain We also have

*b*−

*a*] and continuous, we have . Because we have , we get Since we have considered , it follows that equation C.10 cannot be true. Hence, .

*u*=

*a*. Let

*v*be the timing of the first spike in either

*T*or , other than

*u*. Since ,

*v*>

*u*. Because from equation 3.5, we have For all , we have

*d*(

*x*,

*T*)=

*x*−

*u*, , and because on this interval

*v*−

*x*>

*x*−

*u*, we have . Because is strictly positive on (0,

*b*−

*a*], we get and thus Since we have considered , it follows that equation C.15 cannot be true. Hence, .

Thus, we have shown that in both the case *u*>*a* and the case *u*=*a*, we have . Likewise, we can show that , and so if .

The triangle inequality can be proven in the same way as the proof in the max-metric case.

## Appendix D: Analysis of the Localized Modulus-Metric

.

*is a metric*.

*q*is continuous. Because such that ; because is strictly positive on (0,

*b*−

*a*], it follows that

*q*is not zero everywhere, such that

*q*(

*s*)>0. Because

*q*is continuous, it follows that which contradicts the hypothesis that . Hence, .

The triangle inequality can be proven in the same way as the proof in the max-metric case.

## Appendix E: Algorithms

**Algorithm 1:** An Algorithm for Computing the Modulus-Metric Distance *d _{o}*, between Two Spike Trains

**and**

*T*_{1}**.**

*T*_{2}**Algorithm 2:** Another Algorithm for Computing the Modulus-Metric Distance *d _{o}*, between Two Spike Trains

**and**

*T*_{1}**.**

*T*_{2}## Acknowledgments

We acknowledge the useful suggestions of Adriana Nicolae and Ovidiu Jurjuţ. This work was funded by the Sectorial Operational Programme Human Resources Development (POSDRU, contract 6/1.5/S/3, ”Doctoral Studies: Through Science towards Society”), a grant of the Romanian National Authority for Scientific Research (PNCDI II, Parteneriate, contract 11-039/2007), and the Max Planck–Coneural PartnerGroup.