Introduction
Comparative analysis of neural representations is an active topic of research in neuroscience ([27 ] ) and AI ([45 , 24 ] ). In neuroscience, initiatives such as BrainScore or the Algonauts competition apply similarity analyses to understand how computational models align with neural data ([40 , 9 ] ). In machine learning, similarity analysis plays an important role in model stitching ([1 ] ), and more generally in studying how different training and architectural decisions impact learned representations ([26 , 38 , 21 ] ).
Practitioners often quantify similarity via scalar scores such as centered kernel alignment (CKA; [26 ] ) and the closely related framework of representational similarity analysis (RSA; [28 ] )—see Williams [48 ] for a precise connection between the two.
In practice, representational similarity scores are estimated from limited data. Even in artificial network models, it is impossible to exhaustively sample most input spaces (e.g., natural images). In biological systems, we must additionally contend with sub-sampling neural dimensions since experimental recordings only capture a small fraction of neurons within a given brain region ([44 ] ). Furthermore, biological responses are noisy and variable from trial-to-trial. Prior work has separately analyzed the effect of subsampling stimulus inputs [37 , 46 ] and subsampling neurons [4 , 23 ] in representational similarity measures. However, to our knowledge, a non-asymptotic theory that simultaneously accounts for subsampling along both axes (stimuli and neurons) has not been outlined. Hence, application of similarity analysis to neural data is difficult, as the statistical theory thus far deals with asymptotic regimes that experimenters are unable to access. Given the difficulties of recording neural data, can we uncover which experimental parametrizations are amenable for similarity analysis?
Here, we define and analyze the Centered Kernel Distance (CKD) : a distance metric that is closely associated with the popular Centered Kernel Alignment (CKA; Kornblith et al., [26 ] ) similarity score. The metric itself is not new; CKD is distance on the inner product space defined by the Hilbert–Schmidt Independence Criterion (HSIC; Gretton et al. [12 ] ). Harvey et al. [17 ] also analyzed CKD (under a different name), and gave the metric operational meaning by showing that it equals the average distance between decoded signals over random tasks. We focus on CKD as its structure makes statistical analysis under double-subsampling tractable, revealing several favorable properties:
We show that the square of CKD admits an unbiased estimator, C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 , as a three-sample U-statistic where inputs as well as neurons are subsampled . Alternative measures including CKA and the squared Procrustes distance are not unbiasedly estimable (see Appendix § 13 .§ 1 ).
We derive non-asymptotic bounds on Var [ C K D ^ 2 ] \operatorname{Var}[\widehat{\mathrm{CKD}}^2] Var [ CKD 2 ] in terms of the number of sampled inputs M M M and neurons N X N_X N X and N Y N_Y N Y . Writing ϵ : = 1 / M + 1 / N X + 1 / N Y \epsilon:= 1/M + 1/N_X + 1/N_Y ϵ := 1/ M + 1/ N X + 1/ N Y , the variance scales as C K D 2 ⋅ ϵ + ϵ 2 \mathrm{CKD}^2 \cdot\epsilon+ \epsilon^2 CKD 2 ⋅ ϵ + ϵ 2 . The bound is signal-adaptive , tightening as the two representations converge. Interestingly, the dimension of the input space does not appear in this rate. Hence, there is no curse of dimensionality, and C K D 2 \mathrm{CKD}^2 CKD 2 can be accurately estimated over complex domains such as natural images even in experiments with limited trials and neuron counts.
We show that unbiased estimation of CKD with the same favorable variance decay is possible in the presence of trial-to-trial variability. If noise is correlated across neurons, an extension of the basic U-statistic estimator allows unbiased estimation from two trials per stimulus.
Metrics satisfying the triangle inequality enable rigorous comparison of multiple neural systems at once (e.g. three or more animal subjects or artificial network models; see Williams et al., [49 ] ). Recognizing that CKD is built from an inner product between kernels, we leverage classical results (see Dokmanic et al., [7 ] ) to perform closed-form metric repair and low-dimensional embedding.
Problem Setup and Background
Sampling model
We model neural responses as functions or “tuning curves” mapping inputs (e.g. images) onto activation level. Formally, let F \mathcal{F} F and G \mathcal{G} G denote two stochastic processes representing distributions over tuning curves, and let P P P denote a distribution over network inputs, which live in a space with some intrinsic dimension D D D . Intuitively, differences in the geometry of neural representations stem from underlying differences in F \mathcal{F} F and G \mathcal{G} G , measured according to the distribution of inputs specified by P P P . Throughout, we write
k ( u 1 , u 2 ) = E f ∼ F [ f ( u 1 ) f ( u 2 ) ] and h ( u 1 , u 2 ) = E g ∼ G [ g ( u 1 ) g ( u 2 ) ] (1) k(u_1,u_2) = \mathbb{E}_{f\sim\mathcal{F}}[f(u_1)f(u_2)] \qquad\text{and} \qquad h(u_1,u_2) = \mathbb{E}_{g\sim\mathcal{G}}[g(u_1)g(u_2)] \tag*{(1)} k ( u 1 , u 2 ) = E f ∼ F [ f ( u 1 ) f ( u 2 )] and h ( u 1 , u 2 ) = E g ∼ G [ g ( u 1 ) g ( u 2 )] (1)
for the covariance operators of F \mathcal{F} F and G \mathcal{G} G .
We analyze an experiment in which N X N_X N X and N Y N_Y N Y tuning curves are randomly sampled from each system, along with M M M inputs fed to both:
f 1 , … , f N X ∼ F , g 1 , … , g N Y ∼ G , and u 1 , … , u M ∼ P , (2) f_1,\ldots,f_{N_X} \sim\mathcal{F}, \qquad g_1,\ldots,g_{N_Y} \sim\mathcal{G}, \qquad\text{and} \qquad u_1,\ldots,u_M \sim P, \tag*{(2)} f 1 , … , f N X ∼ F , g 1 , … , g N Y ∼ G , and u 1 , … , u M ∼ P , (2)
independently. We thus observe M × N X M \times N_X M × N X and M × N Y M \times N_Y M × N Y random matrices X m n = f n ( u m ) X_{mn} = f_n(u_m) X mn = f n ( u m ) and Y m n = g n ( u m ) Y_{mn} = g_n(u_m) Y mn = g n ( u m ) . Crucially, we assume both axes—neurons and inputs—are randomly sampled , and our focus is to elucidate how these two sources of sampling error jointly impact estimates of representational similarity. Note that the M M M inputs are shared between the two systems, while the neurons are drawn independently. While i.i.d. sampling of biological neurons is not necessarily possible in practice, the data generating process in eq. (2) captures the essence of how neural sampling is treated when testing experimental hypotheses.
Centered Kernel Alignment and Centered Kernel Distance
Let K ^ ( X ) = 1 N X X X ⊤ \widehat{K}(X)=\frac{1}{N_X}XX^\top K ( X ) = N X 1 X X ⊤ and H ^ ( Y ) = 1 N Y Y Y ⊤ \widehat{H}(Y)=\frac{1}{N_Y}YY^\top H ( Y ) = N Y 1 Y Y ⊤ denote the empirical linear kernel matrices, normalized by the number of sampled neurons in each system. To prevent notational clutter, we treat these matrices as implicit functions, writing K ^ \widehat{K} K in place of K ^ ( X ) \widehat{K}(X) K ( X ) and H ^ \widehat{H} H in place of H ^ ( Y ) \widehat{H}(Y) H ( Y ) .
Centered Kernel Alignment (CKA; Cortes et al. [5 ] ) is a popular framework for quantifying similarity in hidden layer representations (Kornblith et al. [26 ] ). Writing C = I − 1 M 11 ⊤ C=I-\frac{1}{M}\mathbf{1}\mathbf{1}^{\top} C = I − M 1 1 1 ⊤ for the M × M M\times M M × M centering matrix, the plug-in linear CKA score is
CKA p i ( X , Y ) = S p i ( X , Y ) S p i ( X , X ) S p i ( Y , Y ) where S p i ( X , Y ) = 1 M 2 Tr [ K ^ C H ^ C ] . (3) \operatorname{CKA}_{\mathrm{pi}}(X,Y)=\frac{S_{\mathrm{pi}}(X,Y)}{\sqrt{S_{\mathrm{pi}}(X,X)S_{\mathrm{pi}}(Y,Y)}} \qquad\text{where} \qquad S_{\mathrm{pi}}(X,Y)=\frac{1}{M^2}\operatorname{Tr}\left[\widehat{K}C\widehat{H}C\right]. \tag*{(3)} CKA pi ( X , Y ) = S pi ( X , X ) S pi ( Y , Y ) S pi ( X , Y ) where S pi ( X , Y ) = M 2 1 Tr [ K C H C ] . (3)
Here S p i S_{\mathrm{pi}} S pi is the plug-in HSIC score, which targets the Hilbert–Schmidt inner product between the centered covariance functions
lim min ( M , N X , N Y ) → ∞ S p i ( X , Y ) = ⟨ k ˉ , h ˉ ⟩ H S = E u , u ′ ∼ P [ k ˉ ( u , u ′ ) h ˉ ( u , u ′ ) ] , (4) \lim_{\min(M,N_X,N_Y)\to\infty}S_{\mathrm{pi}}(X,Y)=\langle\bar{k},\bar{h}\rangle_{\mathrm{HS}}=\mathbb{E}_{u,u'\sim P}\left[\bar{k}(u,u')\bar{h}(u,u')\right], \tag*{(4)} m i n ( M , N X , N Y ) → ∞ lim S pi ( X , Y ) = ⟨ k ˉ , h ˉ ⟩ HS = E u , u ′ ∼ P [ k ˉ ( u , u ′ ) h ˉ ( u , u ′ ) ] , (4)
where k ˉ \bar{k} k ˉ and h ˉ \bar{h} h ˉ are the doubly centered kernel functions
k ˉ ( u 1 , u 2 ) = k ( u 1 , u 2 ) − E a ∼ P [ k ( a , u 2 ) ] − E b ∼ P [ k ( u 1 , b ) ] + E a , b ∼ P [ k ( a , b ) ] , (5) \bar{k}(u_1,u_2)=k(u_1,u_2)-\mathbb{E}_{a\sim P}[k(a,u_2)]-\mathbb{E}_{b\sim P}[k(u_1,b)]+\mathbb{E}_{a,b\sim P}[k(a,b)], \tag*{(5)} k ˉ ( u 1 , u 2 ) = k ( u 1 , u 2 ) − E a ∼ P [ k ( a , u 2 )] − E b ∼ P [ k ( u 1 , b )] + E a , b ∼ P [ k ( a , b )] , (5)
h ˉ ( u 1 , u 2 ) = h ( u 1 , u 2 ) − E a ∼ P [ h ( a , u 2 ) ] − E b ∼ P [ h ( u 1 , b ) ] + E a , b ∼ P [ h ( a , b ) ] . (6) \bar{h}(u_1,u_2)=h(u_1,u_2)-\mathbb{E}_{a\sim P}[h(a,u_2)]-\mathbb{E}_{b\sim P}[h(u_1,b)]+\mathbb{E}_{a,b\sim P}[h(a,b)]. \tag*{(6)} h ˉ ( u 1 , u 2 ) = h ( u 1 , u 2 ) − E a ∼ P [ h ( a , u 2 )] − E b ∼ P [ h ( u 1 , b )] + E a , b ∼ P [ h ( a , b )] . (6)
Here we focus on a related quantity, which we call the Centered Kernel Distance (CKD) . Whereas CKA normalizes the HSIC inner product, CKD is the distance that inner product induces:
CKD 2 : = ∥ k ˉ − h ˉ ∥ H S 2 = ⟨ k ˉ , k ˉ ⟩ H S + ⟨ h ˉ , h ˉ ⟩ H S − 2 ⟨ k ˉ , h ˉ ⟩ H S . (7) \operatorname{CKD}^2:=\lVert\bar{k}-\bar{h}\rVert_{\mathrm{HS}}^2=\langle\bar{k},\bar{k}\rangle_{\mathrm{HS}}+\langle\bar{h},\bar{h}\rangle_{\mathrm{HS}}-2\langle\bar{k},\bar{h}\rangle_{\mathrm{HS}}. \tag*{(7)} CKD 2 := ∥ k ˉ − h ˉ ∥ HS 2 = ⟨ k ˉ , k ˉ ⟩ HS + ⟨ h ˉ , h ˉ ⟩ HS − 2 ⟨ k ˉ , h ˉ ⟩ HS . (7)
We focus on estimating the squared distance throughout since it is unbiasedly estimable (see § 3 ). Substituting eq. (4) into eq. (7) , the natural plug-in estimator is
CKD p i 2 ( X , Y ) = S p i ( X , X ) + S p i ( Y , Y ) − 2 S p i ( X , Y ) , (8) \operatorname{CKD}_{\mathrm{pi}}^2(X,Y)=S_{\mathrm{pi}}(X,X)+S_{\mathrm{pi}}(Y,Y)-2S_{\mathrm{pi}}(X,Y), \tag*{(8)} CKD pi 2 ( X , Y ) = S pi ( X , X ) + S pi ( Y , Y ) − 2 S pi ( X , Y ) , (8)
which is consistent, since CKD p i 2 → CKD 2 \operatorname{CKD}_{\mathrm{pi}}^2\to\operatorname{CKD}^2 CKD pi 2 → CKD 2 as min ( M , N X , N Y ) → ∞ \min(M,N_X,N_Y)\to\infty min ( M , N X , N Y ) → ∞ by applying the large numbers along each sampling axis. Notably, the order of the limits does not matter for HSIC or CKD, but does in general matter for CKA; jointly taking M , N X , N Y → ∞ M,N_X,N_Y\to\infty M , N X , N Y → ∞ in CKA can produce different behavior than taking one axis to infinity first (see Appendix § 13 .§ 2 and Chun et al. [4 ] ). This already hints that CKD is a more nicely behaved quantity than CKA.
In Appendix C.§ 1 , we show that CKD can be viewed as a special case of a maximum mean discrepancy (MMD; Gretton et al. [13 ] ) with a quadratic kernel. This places CKD within a well-developed body of theory, which we expect to be useful beyond the results developed here. Harvey et al. [17 ] also previously studied the same quantity as CKD and showed that it can be interpreted as the average difference between linearly decoded signals. Finally, CKD is closely related to Representational Similarity Analysis (RSA; Kriegeskorte et al. [28 ] ). In particular, Proposition 1 in Williams [48 ] implies that the CKD between K ^ \widehat{K} K and H ^ \widehat{H} H is proportional to the distance between doubly centered representational dissimilarity matrices (RDMs) with a squared Euclidean base distance. Thus, all of our results on CKD immediately extend to an equivalent form of RSA.
The present paper is not interested in demonstrating a general preference for CKD over any other metric. Rather, we seek to precisely characterize how easy it is to estimate this metric with subsampled inputs as well as subsampled feature dimensions (i.e., subsampled neurons). We show that CKD is statistically well-behaved, motivating its use in datasets with limited samples.
Bias-Variance Decomposition and U-statistics
Our exposition relies on the classical bias–variance decomposition of point estimators. Given a target estimand of interest, θ \theta θ , and an estimator, θ ^ \widehat{\theta} θ , the decomposition of the mean squared error is
E [ ( θ − θ ^ ) 2 ] = ( θ − E [ θ ^ ] ) 2 + E [ ( θ ^ − E [ θ ^ ] ) 2 ] (9) \mathbb{E}\left[(\theta-\widehat{\theta})^2\right]=\left(\theta-\mathbb{E}[\widehat{\theta}]\right)^2+\mathbb{E}\left[\left(\widehat{\theta}-\mathbb{E}[\widehat{\theta}]\right)^2\right] \tag*{(9)} E [ ( θ − θ ) 2 ] = ( θ − E [ θ ] ) 2 + E [ ( θ − E [ θ ] ) 2 ] (9)
While the bias of several similarity metrics have been previously characterized ([37 , 4 ] ), their variances remain underexplored. We aim to resolve this issue in CKD2 ^{2} 2 .
A key step of our analysis is to show that CKD2 ^{2} 2 can be estimated as a U U U -statistic (see Lee, [30 ] , for a textbook reference). At a high level, the goal of a U U U -statistic is to estimate a parameter that can be written as θ = E [ ϕ ( z 1 , … , z k ) ] \theta= \mathbb{E}[\phi(z_1,\ldots,z_k)] θ = E [ ϕ ( z 1 , … , z k )] , where ϕ \phi ϕ is some nonlinear function that is symmetric in its inputs and z 1 , … , z k z_1,\ldots,z_k z 1 , … , z k are independent samples from some distribution P P P . Given n ≥ k n \ge k n ≥ k independent samples from P P P , a one-sample, order-k k k U U U -statistic estimator is
θ ^ = ( n k ) − 1 ∑ i ∈ I n , k ϕ ( z i 1 , … , z i k ) (10) \hat{\theta} = \binom{n}{k}^{-1} \sum_{i \in\mathcal{I}_{n,k}} \phi(z_{i_1},\ldots,z_{i_k}) \tag*{(10)} θ ^ = ( k n ) − 1 i ∈ I n , k ∑ ϕ ( z i 1 , … , z i k ) (10)
where I n , k \mathcal{I}_{n,k} I n , k is the set of all length k k k subsets of unique indices from { 1 , … , n } \{1,\ldots,n\} { 1 , … , n } . Since each multi-index, i ∈ I n , k i \in\mathcal{I}_{n,k} i ∈ I n , k , has no repeated elements, the expectation of each term in the sum is θ \theta θ . Hence, the U U U -statistic, being an average of these terms, is also unbiased E [ θ ^ ] = θ \mathbb{E}[\hat{\theta}] = \theta E [ θ ^ ] = θ . Moreover, among all unbiased estimators it is generally the optimal one—in the absence of additional assumptions about P P P , the Lehmann–Scheffé theorem implies that the U U U -statistic estimator has minimal variance. Song et al. [43 ] derived a U U U -statistic estimator for HSIC under the assumption of a fixed feature space. Chun et al. [4 ] extended this estimator to account for sampling feature dimensions (i.e. sampling neural axes). We leverage these constructions heavily in our analysis.
U U U -statistic theory was also leveraged in recent work by Soares et al. [42 ] , who proposed Triplet (TSI) and Quadruplet (QSI) Similarity Indices as new measures of neural representational similarity. Like most prior work, they considered only subsampling stimuli (i.e., subsampling M M M not N N N ). Here, we focus on CKD as an unnormalized counterpart to CKA and RSA, both which are currently more established and popular measures than TSI/QSI.
Useful properties of CKD
CKD admits an unbiased estimator
Many popular measures of representational similarity are incompatible with unbiased estimation. Indeed, in Appendix § 13 .§ 1 , we show that no unbiased estimators exist for the squared Procrustes distance or for CKA. In both cases, the bias can be mitigated (often at the cost of increased variance), but it cannot be entirely eliminated. See Pospisil et al. [37 ] for a discussion of bias in the Procrustes distance and Chun et al. [4 ] for a discussion of bias in CKA.
The plug-in estimator C K D p i \mathrm{CKD}_{\mathrm{pi}} CKD pi from Equation (8) is a linear combination of three HSIC estimators, each of which is biased. The bias arises from two sources. First, S p i S_{\mathrm{pi}} S pi averages over all pairs of inputs, including the coinciding pairs. Second, the self-terms S p i ( X , X ) S_{\mathrm{pi}}(\mathbf{X},\mathbf{X}) S pi ( X , X ) and S p i ( Y , Y ) S_{\mathrm{pi}}(\mathbf{Y},\mathbf{Y}) S pi ( Y , Y ) additionally average over pairs of coinciding neurons. In both cases, a pair of coinciding samples—the same input twice, or the same neuron twice—compares a quantity to itself, and so contributes a spuriously large value (upward bias). We propose an unbiased estimator of CKD by combining several existing approaches for bias-correction in HSIC.
To remove the first source, we use a stimulus-corrected HSIC estimator due to Song et al. [43 ] :
S s c ( X , Y ) = 1 M ( M − 3 ) [ Tr [ K ~ H ~ ] + ( 1 T K ~ 1 ) ( 1 T H ~ 1 ) ( M − 1 ) ( M − 2 ) − 2 M − 2 1 T K ~ H ~ 1 ] (11) S_{\mathrm{sc}}(\mathbf{X},\mathbf{Y}) = \frac{1}{M(M-3)}\left[\operatorname{Tr}\left[\widetilde{\mathbf{K}}\widetilde{\mathbf{H}}\right] + \frac{(\mathbf{1}^{\mathsf{T}}\widetilde{\mathbf{K}}\mathbf{1})(\mathbf{1}^{\mathsf{T}}\widetilde{\mathbf{H}}\mathbf{1})}{(M-1)(M-2)} - \frac{2}{M-2}\mathbf{1}^{\mathsf{T}}\widetilde{\mathbf{K}}\widetilde{\mathbf{H}}\mathbf{1}\right] \tag*{(11)} S sc ( X , Y ) = M ( M − 3 ) 1 [ Tr [ K H ] + ( M − 1 ) ( M − 2 ) ( 1 T K 1 ) ( 1 T H 1 ) − M − 2 2 1 T K H 1 ] (11)
where K ~ \widetilde{\mathbf{K}} K and H ~ \widetilde{\mathbf{H}} H are versions of K ^ \widehat{\mathbf{K}} K and H ^ \widehat{\mathbf{H}} H with their diagonals set to zero. This estimator is unbiased in the setting of fixed feature dimensions (i.e. sampling M M M inputs across fixed neural dimensions), but in our setting of interest the self-terms S s c ( X , X ) S_{\mathrm{sc}}(\mathbf{X},\mathbf{X}) S sc ( X , X ) and S s c ( Y , Y ) S_{\mathrm{sc}}(\mathbf{Y},\mathbf{Y}) S sc ( Y , Y ) incur a bias as described above, but the cross term S s c ( X , Y ) S_{\mathrm{sc}}(\mathbf{X},\mathbf{Y}) S sc ( X , Y ) remains unbiased.
To remove the source of bias in the self-terms, we use a stimulus-and-neuron-corrected HSIC estimator due to Chun et al. [4 ] . We can write this estimator as:
S s a n c ( X ) = 1 N X ( N X − 1 ) ∑ n ≠ n ′ S s c ( x n x n T , x n ′ x n ′ T ) (12) S_{\mathrm{sanc}}(\mathbf{X}) = \frac{1}{N_X(N_X-1)} \sum_{n \ne n'} S_{\mathrm{sc}}(\mathbf{x}_n\mathbf{x}_n^{\mathsf{T}},\mathbf{x}_{n'}\mathbf{x}_{n'}^{\mathsf{T}}) \tag*{(12)} S sanc ( X ) = N X ( N X − 1 ) 1 n = n ′ ∑ S sc ( x n x n T , x n ′ x n ′ T ) (12)
where x 1 , … , x N X ∈ R M x_1,\ldots,x_{N_X}\in\mathbb{R}^M x 1 , … , x N X ∈ R M are the columns of X X X . Intuitively, S s a n c S_{\mathrm{sanc}} S sanc skips all terms in S s c S_{\mathrm{sc}} S sc in which the same neuron appears twice in order to remove the upward bias. A direct calculation of S s a n c S_{\mathrm{sanc}} S sanc as written above requires O ( N X 2 ) O(N_X^2) O ( N X 2 ) calls to S s c S_{\mathrm{sc}} S sc , but in Appendix C we describe an approach that scales linearly with the number of neurons. Putting these components together, we arrive at our estimator:
C K D ^ 2 = S s a n c ( X ) + S s a n c ( Y ) − 2 S s c ( X , Y ) . (13) \widehat{\mathrm{CKD}}^2=S_{\mathrm{sanc}}(X)+S_{\mathrm{sanc}}(Y)-2S_{\mathrm{sc}}(X,Y). \tag*{(13)} CKD 2 = S sanc ( X ) + S sanc ( Y ) − 2 S sc ( X , Y ) . (13)
Constructing an unbiased estimator of similarity is important to answering key questions in the field. For example, the question of whether two distributions are distinct can be posed as a question of the statistical significance of the estimated similarity score (e.g. CKD, CKA, RSA, etc.). To evaluate statistical significance, we need a grasp on both the bias and variance of the given estimate. Prior work has focused on finding an empirical “zero-point” via bootstrapping to correct for estimators which are biased in the M M M and/or N N N axes. While this approach has been able to address overconfident claims about similarity [21 , 14 ] , it fails to account for fundamentally biased subsampling of stimuli or neural space. The construction of an unbiased estimator allows us to sidestep these issues entirely, allowing for more accurate and efficient null hypothesis testing. This is of particular importance in neuroscience experiments, which are heavily limited in both M M M and N N N directions, and for whom bootstrapping rather than test stimuli is necessary in evaluation.
The variance of CKD can be explicitly bounded with a favorable rate
Our main result assumes that neural responses have finite fourth moments for every u ∈ supp ( P ) u\in\operatorname{supp}(P) u ∈ supp ( P ) . This is guaranteed in vivo (a neuron cannot fire infinitely) and in silico (values overflow).
Theorem 3.1 (Variance Bound, Appendix C). For the estimator given in Equation (13),
Var ( C K D ^ 2 ) < C [ C K D 2 ( 1 M + 1 N X + 1 N Y ) + ( 1 M + 1 N X + 1 N Y ) 2 ] , (14) \operatorname{Var}\left(\widehat{\mathrm{CKD}}^2\right)<C\left[\mathrm{CKD}^2\left(\frac{1}{M}+\frac{1}{N_X}+\frac{1}{N_Y}\right)+\left(\frac{1}{M}+\frac{1}{N_X}+\frac{1}{N_Y}\right)^2\right], \tag*{(14)} Var ( CKD 2 ) < C [ CKD 2 ( M 1 + N X 1 + N Y 1 ) + ( M 1 + N X 1 + N Y 1 ) 2 ] , (14) where C = c max ( q , q 2 ) C=c\max(q,q^2) C = c max ( q , q 2 ) for c c c an absolute constant and
q = max { sup u E f [ ( f ( u ) − f ˉ ) 4 ] , sup u E g [ ( g ( u ) − g ˉ ) 4 ] } (15) q=\max\left\{\sup_u\mathbb{E}_f\left[(f(u)-\bar{f})^4\right],\sup_u\mathbb{E}_g\left[(g(u)-\bar{g})^4\right]\right\} \tag*{(15)} q = max { u sup E f [ ( f ( u ) − f ˉ ) 4 ] , u sup E g [ ( g ( u ) − g ˉ ) 4 ] } (15) the maximum fourth-moment of the neural tuning curves.
We provide the proof in Appendix C.4, and derive a similar scaling law for HSIC with slightly different constants (Appendix B. We show empirical results for HSIC and CKA in Section F.3). The proof follows from a construction of C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 as a 3-sample U-statistic, followed by standard strategies for decomposing and upper bounding the variance of a U-statistic.
Dimension-independence of Theorem 3.1. Let D D D denote the intrinsic dimension of the input space—e.g., the dimension of the manifold on which natural images are supported. Many analyses of neural population geometry are cursed by D D D . For example, estimating a single neural tuning curve, sampled as f n ∼ F f_n\sim\mathcal{F} f n ∼ F , is a nonparametric regression problem whose estimation error decays proportional to ( 1 / M ) 2 β / ( 2 β + D ) (1/M)^{2\beta/(2\beta+D)} ( 1/ M ) 2 β / ( 2 β + D ) where β \beta β is a smoothness parameter (see Györfi et al., [15 ] ; Tsybakov [47 ] ). Thus, the number of samples M M M must increase exponentially to compensate for an increase in D D D , which is the “curse of dimensionality.”
Theorem 3.1 shows that estimating the CKD between two representations is a fundamentally easier problem: The rate in eq. (14) does not degrade as the input dimension increases. Remarkably, the constant C C C in eq. (14) also has a dimension-independent upper bound under typical conditions. In particular, any dimension dependence enters through q q q , which can be bounded in at least three ways:
First, biological neurons have minimal and maximal firing rates. We can therefore rescale units so that neural responses are bounded—i.e., f ( u ) ∈ [ 0 , 1 ] f(u)\in[0,1] f ( u ) ∈ [ 0 , 1 ] and g ( u ) ∈ [ 0 , 1 ] g(u)\in[0,1] g ( u ) ∈ [ 0 , 1 ] for every u ∈ supp ( P ) u\in\operatorname{supp}(P) u ∈ supp ( P ) with probability one, yielding q ≤ 1 q\leq1 q ≤ 1 .
Second, even if neural activations are unbounded (e.g., ReLU activations in a deep network), we can bound firing rates by incorporating minimal smoothness assumptions. For example, if the support of P P P is a bounded set with diameter diam ( P ) \operatorname{diam}(P) diam ( P ) and neural tuning functions are L L L -Lipschitz with probability one, then ∣ f ( u ) − f ˉ ∣ ≤ L ⋅ diam ( P ) \lvert f(u)-\bar{f}\rvert\leq L\cdot\operatorname{diam}(P) ∣ f ( u ) − f ˉ ∣ ≤ L ⋅ diam ( P ) (and likewise for g g g ). Then, q ≤ L 4 ⋅ diam ( P ) 4 q\leq L^4\cdot\operatorname{diam}(P)^4 q ≤ L 4 ⋅ diam ( P ) 4 . If supp ( P ) \operatorname{supp}(P) supp ( P ) is a unit cube, then the diameter grows sublinearly, proportional to D \sqrt{D} D . If a normalization layer is included, then diam ( P ) \operatorname{diam}(P) diam ( P ) is fully independent of the dimension.
Third, if f f f and g g g are drawn from Gaussian processes with uniformly bounded covariance kernels, then q q q is bounded even if the support of P P P is not compact and even if the kernels are not smooth enough to ensure Lipschitzness of f f f and g g g . Concretely, suppose that f ∼ G P ( 0 , k ) f \sim\mathcal{GP}(0,k) f ∼ G P ( 0 , k ) with ∣ k ( u , u ′ ) ∣ ≤ κ \lvert k(u,u')\rvert\le\kappa ∣ k ( u , u ′ )∣ ≤ κ for all u , u ′ u,u' u , u ′ . Then, for any u u u , f ( u ) − f ˉ f(u)-\bar{f} f ( u ) − f ˉ is Gaussian with mean zero and variance at most 4 κ 4\kappa 4 κ (by the triangle inequality), so we have sup u E f [ ( f ( u ) − f ˉ ) 4 ] = 3 sup u E f [ ( f ( u ) − f ˉ ) 2 ] 2 ≤ 48 κ 2 \sup_u \mathbb{E}_f[(f(u)-\bar{f})^4] = 3\sup_u \mathbb{E}_f[(f(u)-\bar{f})^2]^2 \le48\kappa^2 sup u E f [( f ( u ) − f ˉ ) 4 ] = 3 sup u E f [( f ( u ) − f ˉ ) 2 ] 2 ≤ 48 κ 2 .
Estimating the variance in practice. We have not attempted to sharpen the absolute constant c c c appearing in Theorem 3.1; the primary focus of this paper is to characterize and interpret the rate. In practice, we recommend estimating the variance of C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 by bootstrapping simultaneously over sampled inputs and neurons. Bootstrap methods are well studied for U-statistics (see Lee, [30 ] , Ch. 5) and for data with multiple crossed sampling factors ([34 , 41 ] ). One exception is when CKD is at or near zero: the U-statistic is then degenerate and the bootstrap is unreliable, so testing CKD = 0 = 0 = 0 requires different approaches such as a permutation test or wild bootstrap resampling (Schrab et al., [39 ] ).
Estimating CKD in the presence of trial-to-trial noise
Neural responses are noisy in biological systems—spike counts can differ dramatically across nominally identical trials (see e.g. Goris et al. [10 ] ). Noise is also sometimes present in artificial networks (e.g. dropout layers), and past work has introduced specialized metrics to compare the geometry of noise across neural systems ([8 , 33 ] ). Here, we focus on comparing the geometry of the average response from limited measurements. In particular, how does the scale of noise impact our estimate of CKD?
To address this question, we modify the sampling model of § 2.1 to allow for multiple presentations of the same stimulus input. Let L ≥ 1 L \ge1 L ≥ 1 denote the number of repetitions, so that the response of neuron n n n to input i i i on repetition ℓ \ell ℓ is given by f n ( u i ) + ξ n i ℓ f_n(u_i) + \xi_{ni\ell} f n ( u i ) + ξ ni ℓ where f n ∼ F f_n \sim\mathcal{F} f n ∼ F is a sampled tuning curve, u i ∼ P u_i \sim P u i ∼ P is a sampled input, and ξ n i ℓ \xi_{ni\ell} ξ ni ℓ denotes mean zero random noise with finite fourth moments. In biological experiments, the number of repetitions, L L L , and the number of unique stimuli, M M M , are inversely coupled to each other due to constraints on the experiment’s duration. The ability to keep the repetition number L L L small therefore allows one to sample a greater number of inputs M M M .
If trial-to-trial noise is independent across neurons, the U-statistic estimator C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 turns out to remain unbiased even when L = 1 L = 1 L = 1 (see Proposition D.1 in Appendix § 11 ), and the variance bound in Theorem 3.1 applies essentially verbatim, with the constant C C C depending on the maximum of the fourth moments of the observed (noise-corrupted) responses rather than the fourth moments of the underlying tuning curves (see Appendix § 11 .§ 4 ). In fact, the constants appearing in the first-order expansion of the variance are completely insensitive to trial-to-trial noise (see Proposition D.2 in Appendix § 11 ). Thus, when accounting for independent noise, the asymptotic rate of convergence for Var [ C K D ^ 2 ] \operatorname{Var}[\widehat{\mathrm{CKD}}^2] Var [ CKD 2 ] only has an increased constant.
If trial-to-trial noise is correlated across neurons, as is often the case biologically ([25 , 36 ] ), then an extension of the U-statistic estimator leveraging L = 2 L = 2 L = 2 trials per condition is necessary and sufficient to fully debias estimates of HSIC and CKD (see Appendix § 12 ). The required modification is fairly intuitive and directly analogous to the modification provided in § 3.1 for the previous U-statistic estimator. In short, HSIC is formulated as a large sum over pairs of neurons, stimuli, and trials, and we remove bias by skipping any terms that involve coinciding pairs of neural responses from the same system, same stimulus, and same trial number. The resulting estimator is unbiased with respect to M M M , N X N_X N X , and N Y N_Y N Y , with a variance law that only differs by a constant factor on the 1 / M 1/M 1/ M term, with otherwise no change in rate or asymptotic behavior.
These results have experimental implications, because many large-scale neuroscience datasets use as little as a single presentation per image ([32 , 35 ] ). Our analysis shows that having L = 1 L = 1 L = 1 presentation per stimulus is likely to add some bias, although the magnitude may be negligible if one assumes that noise is nearly decorrelated across neurons. Practitioners who want a strict guarantee of unbiased estimation should use L = 2 L = 2 L = 2 presentations per stimulus and the associated estimator we describe in Appendix § 12 .
Closed form metric repair and embedding for multi-systems analysis
We have thus far considered estimating the distance between a single pair of neural systems. However, we are often interested in comparing across multiple systems—e.g. across several network architectures, layers, or subjects—in order to elucidate how variation in the structure of models induces variation in their function. When comparing a collection of T T T representations, the T × T T \times T T × T matrix of pairwise distance scores Δ \Delta Δ is the object of interest. When this matrix is constructed with respect to an underlying metric space , it contains rich information about the space of representations (e.g. whether systems are clustered into discrete groups or distributed uniformly; see Williams et al., [49 ] ). Taken one step further, one can measure geodesic paths and angles between systems to trace how factors such as network depth or data augmentation move a representation through this space ([29 , 18 ] ).
Formally, let k ˉ 1 , … , k ˉ T \bar{k}_1, \ldots, \bar{k}_T k ˉ 1 , … , k ˉ T denote the centered kernel functions of the T T T systems, and let G G G be the T × T T \times T T × T Gram matrix based on the HSIC inner product. Then,
G s t = ⟨ k ˉ s , k ˉ t ⟩ H S , Δ s t = G s s + G t t − 2 G s t , for all t , s ∈ { 1 , … , T } . (16) G_{st} = \langle\bar{k}_s, \bar{k}_t \rangle_{\mathrm{HS}}, \qquad\Delta_{st} = G_{ss} + G_{tt} - 2G_{st}, \qquad\text{for all } t,s \in\{1,\ldots,T\}. \tag*{(16)} G s t = ⟨ k ˉ s , k ˉ t ⟩ HS , Δ s t = G ss + G tt − 2 G s t , for all t , s ∈ { 1 , … , T } . (16)
Given observations X i ∈ R M × N t X_i \in\mathbb{R}^{M \times N_t} X i ∈ R M × N t for t ∈ { 1 , … , T } t \in\{1,\ldots,T\} t ∈ { 1 , … , T } , we can form an entrywise unbiased estimate G ^ \widehat{G} G of G G G using the techniques described in § 3.1 . Specifically, we take G ^ t t = S a n c ( X t , X t ) \widehat{G}_{tt} = S_{\mathrm{anc}}(X_t, X_t) G tt = S anc ( X t , X t ) and G ^ s t = S s c ( X s , X t ) \widehat{G}_{st} = S_{\mathrm{sc}}(X_s, X_t) G s t = S sc ( X s , X t ) for s ≠ t s \ne t s = t .
Since G G G is a Gram matrix, it is positive semidefinite. However, due to sampling noise, G ^ \widehat{G} G is generally not positive semidefinite. The corresponding estimate of CKD distances, given by Δ ^ s t = G ^ s s + G ^ t t − 2 G ^ s t \widehat{\Delta}_{st} = \widehat{G}_{ss} + \widehat{G}_{tt} - 2\widehat{G}_{st} Δ s t = G ss + G tt − 2 G s t , can have negative entries and triangle inequality violations. We can repair this by projecting G ^ \widehat{G} G onto the feasible cone S + T \mathcal{S}_{+}^{T} S + T of T × T T \times T T × T positive semidefinite matrices, which fortuitously can be done in closed form (Higham, [20 ] ):
G ⋆ = arg min G ∈ S + T ∥ G − G ^ ∥ F 2 = U max ( Λ , 0 ) U T , (17) G^{\star} = \underset{G \in\mathcal{S}_{+}^{T}}{\arg\min}\ \lVert G - \widehat{G} \rVert_{F}^{2} = U \max(\Lambda, 0) U^{\mathsf{T}}, \tag*{(17)} G ⋆ = G ∈ S + T arg min ∥ G − G ∥ F 2 = U max ( Λ , 0 ) U T , (17)
where U Λ U T U\Lambda U^{\mathsf{T}} U Λ U T denotes the eigendecomposition of G ^ \widehat{G} G and max ( Λ , 0 ) \max(\Lambda, 0) max ( Λ , 0 ) is applied elementwise to clip negative eigenvalues to zero. Projection onto a convex set containing the truth is non-expansive, so
∥ G ⋆ − G ∥ F ≤ ∥ G ^ − G ∥ F , (18) \lVert G^{\star} - G \rVert_{F} \le\lVert\widehat{G} - G \rVert_{F}, \tag*{(18)} ∥ G ⋆ − G ∥ F ≤ ∥ G − G ∥ F , (18)
for every realization of data. The price is that G ⋆ G^{\star} G ⋆ is no longer element-wise unbiased since the projection operation is nonlinear—thus, we accept a small amount of estimator bias in exchange for a larger reduction in variance. The improved estimate of the T × T T \times T T × T matrix of CKD values has elements Δ s t ⋆ = G s s ⋆ + G t t ⋆ − 2 G s t ⋆ \Delta^{\star}_{st} = G^{\star}_{ss} + G^{\star}_{tt} - 2G^{\star}_{st} Δ s t ⋆ = G ss ⋆ + G tt ⋆ − 2 G s t ⋆ .
The eigendecomposition that repairs G G G in eq. (17) also provides an embedding. Writing V = U max ( Λ , 0 ) 1 / 2 V = U\max(\Lambda, 0)^{1/2} V = U max ( Λ , 0 ) 1/2 , we have G ⋆ = V V T G^{\star} = VV^{\mathsf{T}} G ⋆ = V V T , so the rows v 1 , … , v T v_1,\ldots,v_T v 1 , … , v T of V V V are coordinates satisfying
∥ v s − v t ∥ 2 2 = Δ s t ⋆ for all s , t ∈ { 1 , … , T } . (19) \lVert v_s - v_t \rVert_{2}^{2} = \Delta^{\star}_{st} \qquad\text{for all } s,t \in\{1,\ldots,T\}. \tag*{(19)} ∥ v s − v t ∥ 2 2 = Δ s t ⋆ for all s , t ∈ { 1 , … , T } . (19)
This is the classical multidimensional scaling (MDS) construction (Gower [11 ] ; see Dokmanic et al. [7 ] for a modern review of Euclidean distance matrices).
It is worth emphasizing that eq. (19) is an exact embedding of Δ ⋆ \Delta^{\star} Δ ⋆ . Thus, the coordinates in V V V can be directly passed to essentially any method for clustering, dimensionality reduction, regression, or classification without any loss of information. Alternative metrics including the Procrustes distance and cos − 1 \cos^{-1} cos − 1 (CKA) satisfy the triangle inequality but do not admit an inner product. Analyses are then restricted either to approximate MDS embeddings or to methods operating on raw distances, such as hierarchical clustering and nearest-neighbor prediction (as discussed in Williams et al., [49 ] ). Closed form solutions for optimal metric repair, as in eq. (17) for CKD, are also not available for most alternative metrics.
Applications and Experiments
Validation on Random Neural Networks
We first confirm our theoretical predictions in one layer neural networks with random weights (see Appendix § 17 for details). For simplicity, we compare networks of equal width, N = N X = N Y N = N_X = N_Y N = N X = N Y , but comment on the case of N X ≠ N Y N_X \ne N_Y N X = N Y in Appendix § 14 . We report the normalized variance of the U-statistic estimator, Var [ C K D ^ 2 ] / C K D 2 \operatorname{Var}[\widehat{\mathrm{CKD}}^2]/\mathrm{CKD}^2 Var [ CKD 2 ] / CKD 2 , where the numerator is estimated across multiple simulations and the denominator is given in closed form based on prior work (Bietti & Bach [2 ] ). Equation (14) predicts that this quantity decays at a rate proportional O ( 1 M + 1 N ) \mathcal{O}\left(\frac{1}{M}+\frac{1}{N}\right) O ( M 1 + N 1 ) .
Figure 1 shows simulations varying the number of sampled inputs, M M M , and number of sampled neurons, N = N X = N Y N = N_X = N_Y N = N X = N Y . Counterintuitively, as D D D increases, the normalized variance decreases in the top right corner (when M , N M, N M , N are large). The reason for this is because of the signal adaptivity of the variance. When the network parameters are fixed, increasing D D D decreases CKD. Hence, larger D D D in this setting means that the estimator spends more time in the faster rate regime, which allows us to obtain more accurate estimates of CKD. This is most apparent when considering the difference in spacing between the contour lines for D = 10 D = 10 D = 10 and D = 1000 D = 1000 D = 1000 . One can also see the visible widening of the contour lines when D = 100 D = 100 D = 100 as M , N → 1000 M, N \to1000 M , N → 1000 . This is the signal adaptation occurring.
Figure 1. Heatmap of empirical relative variance in estimating CKD between random neural networks for D = 10 D = 10 D = 10 , 100 100 100 , 1000 1000 1000 . Level curves for variance are shown in white. Note that as sampling increases, the relative variance converges across D D D .
Furthermore, as D D D increases, Figure 1 also shows that the contour lines flatten out, transitioning from an apparent O ( 1 M + 1 N ) \mathcal{O}\left(\frac{1}{M}+\frac{1}{N}\right) O ( M 1 + N 1 ) scaling law to a O ( 1 M N ) \mathcal{O}\left(\frac{1}{MN}\right) O ( M N 1 ) scaling law. We have two comments on this. First, we propose that this effect is due to a ”zoomed-in” degree of sampling; the ”flatter” regions are simply a more local view, relative to the scale of the problem, of an order O ( 1 M + 1 N ) \mathcal{O}\left(\frac{1}{M}+\frac{1}{N}\right) O ( M 1 + N 1 ) contour lines. This is suggested by the slight bending of the contour lines near the edges of the heatmaps. Second, this still verifies that our upper bound holds, as O ( 1 M N ) \mathcal{O}\left(\frac{1}{MN}\right) O ( M N 1 ) scales faster than the upper bound of order O ( 1 M + 1 N ) \mathcal{O}\left(\frac{1}{M}+\frac{1}{N}\right) O ( M 1 + N 1 ) . Our proof in § 3 accounts for this: the reason for this “flatness” is because the coefficients of the leader order terms, which depend on the covariance statistics of the neural tuning curves (Appendix C), vanish, leaving second-order coefficients on the 1 M N \frac{1}{MN} M N 1 term to dominate.
Validation on Trained Deep Artificial Networks and Biological Data
We consider the error in estimating similarities in deep neural networks by training deep convolutional networks on the ImageNet dataset (Deng et al., [6 ] ) and evaluating the variance of their pairwise similarity estimates (see Appendix § 19 for details). In Figure 2 A, we verify that the O ( 1 M + 1 N ) \mathcal{O}\left(\frac{1}{M}+\frac{1}{N}\right) O ( M 1 + N 1 ) scaling law still holds. While we cannot explicitly modify the dimensionality of the input space, we can study this by proxy by presenting different distributions of test images. Evaluating the variance in similarity estimates on test images from the ImageNet dataset (i.e. in-distribution) versus images from the MacaqueITBench dataset (i.e. out-of-distribution; see Appendix § 18 for details) reveals similar scaling for CKD. Hence, in line with our theoretical results, the difficulty in estimating the similarity between two models is largely independent of the dataset over which evaluation occurs or changes in the underlying similarity estimate.
Figure 2. Variance of similarity estimates in deep networks and monkeys. (A ) Models presented in-distribution versus out-of-distribution test images. Variance scales independent of dataset choice. (B ) Variance of CKD across three brain regions of two monkeys scales independently from region identity. Multi-units are considered distinct “neurons.” (C ) Representative sample of signal-adaptivity of variance, with decreased rate of variance reduction when 1 M + 1 N \frac{1}{M} + \frac{1}{N} M 1 + N 1 small.
To validate our predictions on biological data, in Figure 2 (B) we measure Var ( C K D ) \operatorname{Var}(\mathrm{CKD}) Var ( CKD ) across regions between two monkeys in the THINGS Ventral Stream Dataset (Papale et al., [35 ] ); see Appendix § 19 .§ 3 for details). Again, Var ( C K D ) \operatorname{Var}(\mathrm{CKD}) Var ( CKD ) follows evenly-spaced L-shaped level curves. We use the different regions as a proxy for studying the effect of dimensionality, under the assumption that the effective dimensionality likely varies across the visual hierarchy. The scale of variance in all three region-to-region comparisons is consistent, as our theory predicts. This holds also for comparisons between regions (e.g. V4 to IT; see Appendix § 15 ), and for different image classes (Appendix § 18 ). Overall, our results suggest a central experimental prescription: the most efficient way to reduce error in CKD estimates (up to cost of recording) is to keep M ≈ N M \approx N M ≈ N . Conversely, increasing sampling in M M M but not N N N (and vice versa) will eventually fail to substantially reduce error.
Last, in Figure 2 C, we to verify the signal-adaptivity of our bound. We show close adherence of empirical behavior to the signal adaptation in our theory: when 1 M + 1 N \frac{1}{M} + \frac{1}{N} M 1 + N 1 is small, scaling decelerates.
Similarity Estimates across Multiple Systems
We simultaneously study the relationships between representations formed by 3 brain regions replicated across 2 monkey subjects ([35 ] ) and 4 trained neural networks from § 4.2 . We might expect brain regions V1, V4, and IT to have distinct representations because they fall along different parts of the visual hierarchy. However, poorly parametrized sampling regimes may make evaluating this hypothesis impossible. Furthermore, we don’t know the exact variability that different neural regions and models exhibit. Our theory suggest that M ≈ N M \approx N M ≈ N most efficiently reduces pairwise estimation error. Do this hold when comparing multiple systems simultaneously?
In Figure 3 A we produce low-dimensional Euclidean embeddings using multidimensional scaling to visualize the effect of subsampling on the estimated distances among systems (see procedure in Appendix § 20 ). Overlaps in ellipsoids indicate probable scenarios where false equivalences may be drawn between two neural systems, while highly elongated ellipsoids indicate probable circumstances where differences between systems would be falsely overstated.
Figure 3. Comparisons between monkeys and similarity analysis between multiple neural systems simultaneously. (A) CKD between 4 deep models and 6 neural recordings from 3 different brain areas. MDS is performed with 10 embedding dimensions, then points are projected into the same PC space across the panels. Each ellipse denotes an estimated region in PC space of a single neural system’s random subsampling at certain values of M M M and N N N . (B) Estimates of Kendall’s Tau on different degrees of subsampling, measuring the error in rankings of similarity between all subjects.
When M M M and N N N are small, estimates of distance are noisy and the estimated relationships between neural systems are variable depending on the subsample. Sampling more images and neurons significantly reduces this uncertainty. Remarkably, however, we can attain even better estimates of relationships even when significantly undersampling the number of stimuli (M = 100 M = 100 M = 100 ) by simply mildly increasing the number of recorded neurons (N = 100 N = 100 N = 100 ). This is in line with our prior prescription that the most efficient way to reduce error in estimating similarity is to keep M ≈ N M \approx N M ≈ N (up to costs of additional recording in either axis), and that oversampling only M M M but not N N N (and vice versa) does not significantly improve one’s estimate.
This result holds in pre-projection space as well. In Figure 3 B, we analyze Kendall’s τ \tau τ measured when subsampling across multiple models. This measures the divergence between the estimated rankings of similarity between multiple models with the true rankings of similarity between models in the pre-projection distance estimates. A larger Kendall’s τ \tau τ indicates greater alignment of similarity ranking between subsampled and true measurements, and thus a more accurate read on the pairwise relationships between models. Similar to our previous results, a large Kendall’s τ \tau τ is attained when M ≈ N M \approx N M ≈ N , achieving approximately equal or better performance than when only either M M M or N N N has a degree of magnitude more samples for marginal trade-off along the other axis.
Discussion
We show that the CKD exhibits a range of favorable statistical properties with respect to sampling of neurons and stimuli: it can be estimated without bias, its variance decays with a dimension-independent rate, and it enables principled metric repair and embedding. To our knowledge, no such theory exists to account for the simultaneously subsampling of both stimuli M M M and neurons N N N . Our work represents a first step towards resolving this gap in the literature, as we also show that more common measures such as CKA lack such utile properties (see Appendix § 13 ).
Our goal is not to advocate for CKD as a novel or “better” similarity measure than others. We agree with Klabunde et al. [24 ] that practitioners should ideally utilize multiple measures in conjunction with one another. Our focus on CKD estimators is a reflection of their mathematical tractability, which enabled a detailed account of its statistical properties. We currently do not have a similarly comprehensive analysis of alternative metrics such as CKA and the Procrustes distance, but it would be highly valuable to pursue this in future work.
Our results have important implications for experimental design. Crucially, our theory demonstrates that one’s ability to estimate CKD from limited samples does not rapidly degrade as a function of task complexity. That is, estimation does not suffer from a curse of dimensionality, unlike related estimation problems in high-dimensional geometry, thus underwriting confidence in similarity estimates for complex stimuli spaces.
Limitations. While CKD’s lack of normalization provides it powerful properties for analysis, its sensitivity to the scale of a neural representation may be argued to be an undesirable property (see e.g. Kornblith et al., 2019). Incorporating normalization into analyses of CKD and related measures is an important direction of future research. Simultaneously, more work is required to characterize and improve estimation of metrics like CKA that cannot be formulated as U-statistics.
ACKNOWLEDGMENTS
We would also like to thank Ansh Soni for useful conversations in assistance of this work. SX was supported by the NSF Graduate Research Fellowship Program and the NYU MacCracken Fellowship. SH was supported by the Flatiron Institute. JAZ-V was supported by the Office of the Director of the NIH under Award Number DP5OD037354, and by a Junior Fellowship from the Harvard Society of Fellows. AW was supported by NIH NIDA R01DA066648 and the McKnight Foundation.
AI Disclosure
In this work, we used generative AI tools (LLMs; Claude Opus 5.5, GPT 5.6 Sol, GPT 6 Astra) substantially in developing the mathematical results and providing feedback on research methodology. The authors derived an initial bound on the same order for HSIC without the assistance of LLMs, and the inspiration to formulate our claims via U-statistics was also done without LLMs. LLMs were used to assist in learning the deeper mathematical properties of U-statistics as an accompanying guide to Lee [30 ] . Afterwards, LLMs assisted in formulating precise statements of technical claims for generalization after the authors had specified the quantity to be analyzed and the kind of result sought (a bound on the same order as the initial approach) and in drafting and revising the written proofs. The authors heavily revised and edited all mathematical proofs and extended the LLM-generated output to cover background material and broader context.
The conceptual framing of the work is due to the human authors. This includes the motivating problem of how similarity estimates depend jointly on the number of sampled neurons and stimuli, the choice to study the Centered Kernel Distance and its unbiased U-statistic estimator, and the decision of which properties to establish. The interpretation of all theoretical and empirical results, including their implications for experimental design in neuroscience and machine learning, is likewise due to the human authors. We did not use generative AI tools to propose hypotheses or design experiments, but LLMs were used to generate code for simulations and aid in formatting figures. Translation and qualitative data analysis are not applicable to this work.
We have reviewed all AI-assisted work. All AI-assisted derivations were checked line-by-line by all the authors. The resulting bounds were independently checked against numerical simulations in random networks, trained networks, and macaque recordings (§ 4 ); similarly, AI-generated code was checked against our manual implementations and validated by the numerical experiments in these simulations. We take responsibility for the final content of this work, including text, claims, and artifacts produced with the aid of generative AI.
Appendix Table of Contents
Here, we provide an overview of the appendix sections to orient the reader.
Appendix B constructs a U-statistic for HSIC and derives an upper bound on the variance. This section also outlines the core properties of U-statistics and how to apply known theory about the variance of U-statistics. For those unfamiliar with U-statistics, or hope to apply our approach elsewhere, we recommend this section, which is written with such readers in mind.
Appendix C constructs a U-statistic for CKD and proves theorem 3.1.
Appendices D and E provide theoretical analysis of the CKD estimator in the presence of noise, supporting the results outlined in § 3.3 . In Appendix D, we assume that noise is independent across neurons and trials. In Appendix E we partly relax this assumption by allowing for “noise correlations” across neurons. The take home message of these sections is that unbiased estimation of CKD is still possible and the dimension-free rate of ( 1 / M + 1 / N X + 1 / N Y ) (1/M+1/N_X+1/N_Y) ( 1/ M + 1/ N X + 1/ N Y ) proved in theorem 3.1 carries over in the presence of noise.
In Appendix F, we present auxiliary results on CKA and the squared Procrustes distances to highlight points of contrast with CKD. In particular, we show that CKA and Procrustes do not admit unbiased estimators, and that the consistency of the plug-in estimator of CKA depends on the order that one takes the limits of M M M and N N N to infinity. We also provide some experiments to document the empirical behavior of HSIC and CKA in estimators in Section F.3.
In Appendix G, we document the empirical behavior of CKD when the number of neurons is mismatched across systems, N X ≠ N Y N_X \ne N_Y N X = N Y . Our theory accounts for this case, but the experiments shown in the main paper assume N X = N Y N_X=N_Y N X = N Y to simplify the exposition.
To show generality of our results regardless of region identity in pairwise CKD estimates, we plot the variance of our CKD estimate for all possible pairs of regions within and between monkeys in Appendix H
Last, to show that our results work across biology and architecture, in section appendix I we plot the variance of CKD between the trained deep networks and macaque visual cortex data. Whe show that our theoretical predictions still hold.
Appendix J details how we constructed the random neural network experiments in § 4.1 .
Appendix K details the image datasets we used in § 4.2 , and the differences in their structure. We also present results showing that our scaling law holds even when conditioning on specific image categories.
Appendix L details the model architecture and training of the models we evaluate in § 4.2 .
Appendix M details the clustering procedure we apply in fig. 3.
U-statistic estimators of HSIC
We begin with a formalization of HSIC as a U-statistic. Following the construction of such an estimator, we then follow standard arguments on the variance of U-statistics ([30 ] ) to derive a dimension-free upper bound. In Appendix C, the techniques applied for HSIC will be re-applied, albeit in a more complex fashion, for the CKD estimator. For those unfamiliar with the theory of U-statistics, this is a useful primer.
A finite-sample estimator
Recall the definition of the inner product between two symmetric functions k k k and h h h as
⟨ k , h ⟩ H S = E [ k ( u , u ′ ) h ( u , u ′ ) ] \langle k,h\rangle_{\mathrm{HS}}=\mathbb{E}[k(u,u')h(u,u')] ⟨ k , h ⟩ HS = E [ k ( u , u ′ ) h ( u , u ′ )]
where the expectation is over two independent samples u u u and u ′ u' u ′ from a distribution P P P (which, in our case, is the distribution over inputs to the network). Plugging in k ˉ \bar{k} k ˉ and h ˉ \bar{h} h ˉ as defined in eqs. (5) and (6) and expanding leads to a sixteen term expression with many cancellations. Ultimately, the expression simplifies to
⟨ k ˉ , h ˉ ⟩ H S = E u 1 , u 2 , u 3 , u 4 [ k ( u 1 , u 2 ) h ( u 1 , u 2 ) + k ( u 1 , u 2 ) h ( u 3 , u 4 ) − 2 k ( u 1 , u 2 ) h ( u 1 , u 3 ) ] (20) \langle\bar{k},\bar{h}\rangle_{\mathrm{HS}} = \mathbb{E}_{u_1,u_2,u_3,u_4}\left[k(u_1,u_2)h(u_1,u_2) + k(u_1,u_2)h(u_3,u_4) - 2k(u_1,u_2)h(u_1,u_3)\right] \tag*{(20)} ⟨ k ˉ , h ˉ ⟩ HS = E u 1 , u 2 , u 3 , u 4 [ k ( u 1 , u 2 ) h ( u 1 , u 2 ) + k ( u 1 , u 2 ) h ( u 3 , u 4 ) − 2 k ( u 1 , u 2 ) h ( u 1 , u 3 ) ] (20)
which is equivalent to Equation 3 in Song et al. [43 ] . Thus, the HSIC estimand can be represented as an expectation over four independent samples, u 1 , u 2 , u 3 , u 4 ∼ P u_1, u_2, u_3, u_4 \sim P u 1 , u 2 , u 3 , u 4 ∼ P , of an expression based on the uncentered kernel functions.
Here, we are interested in comparing kernels that are defined by neural tuning curve distributions, F \mathcal{F} F and G \mathcal{G} G , over the space of functions mapping U ↦ R \mathcal{U} \mapsto\mathbb{R} U ↦ R . Specifically, we define
k ( u 1 , u 2 ) = E f ∼ F [ f ( u 1 ) f ( u 2 ) ] (21) k(u_1,u_2) = \mathbb{E}_{f\sim\mathcal{F}}[f(u_1)f(u_2)] \tag*{(21)} k ( u 1 , u 2 ) = E f ∼ F [ f ( u 1 ) f ( u 2 )] (21)
h ( u 1 , u 2 ) = E g ∼ G [ g ( u 1 ) g ( u 2 ) ] (22) h(u_1,u_2) = \mathbb{E}_{g\sim\mathcal{G}}[g(u_1)g(u_2)] \tag*{(22)} h ( u 1 , u 2 ) = E g ∼ G [ g ( u 1 ) g ( u 2 )] (22)
Now plugging these equations into eq. (20) , we obtain
⟨ k ˉ , h ˉ ⟩ H S = E f , g , u 1 , u 2 , u 3 , u 4 [ f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 2 ) + f ( u 1 ) f ( u 2 ) g ( u 3 ) g ( u 4 ) − 2 f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 3 ) ] (23) \langle\bar{k},\bar{h}\rangle_{\mathrm{HS}} = \mathbb{E}_{f,g,u_1,u_2,u_3,u_4}\left[
\begin{aligned}
&f(u_1)f(u_2)g(u_1)g(u_2)\\
&+ f(u_1)f(u_2)g(u_3)g(u_4)\\
&- 2f(u_1)f(u_2)g(u_1)g(u_3)
\end{aligned}
\right] \tag*{(23)} ⟨ k ˉ , h ˉ ⟩ HS = E f , g , u 1 , u 2 , u 3 , u 4 f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 2 ) + f ( u 1 ) f ( u 2 ) g ( u 3 ) g ( u 4 ) − 2 f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 3 ) (23)
Let Π \Pi Π denote the set of all 4 ! 4! 4 ! permutations of ( 1 , 2 , 3 , 4 ) (1,2,3,4) ( 1 , 2 , 3 , 4 ) , and define
ϕ ( f , g , u 1 , u 2 , u 3 , u 4 ) = 1 4 ! ∑ ( i , j , ℓ , p ) ∈ Π [ f ( u i ) f ( u j ) g ( u i ) g ( u j ) + f ( u i ) f ( u j ) g ( u ℓ ) g ( u p ) − 2 f ( u i ) f ( u j ) g ( u i ) g ( u ℓ ) ] (24) \phi(f,g,u_1,u_2,u_3,u_4) = \frac{1}{4!}\sum_{(i,j,\ell,p)\in\Pi}\left[
\begin{aligned}
&f(u_i)f(u_j)g(u_i)g(u_j)\\
&+ f(u_i)f(u_j)g(u_\ell)g(u_p)\\
&- 2f(u_i)f(u_j)g(u_i)g(u_\ell)
\end{aligned}
\right] \tag*{(24)} ϕ ( f , g , u 1 , u 2 , u 3 , u 4 ) = 4 ! 1 ( i , j , ℓ , p ) ∈ Π ∑ f ( u i ) f ( u j ) g ( u i ) g ( u j ) + f ( u i ) f ( u j ) g ( u ℓ ) g ( u p ) − 2 f ( u i ) f ( u j ) g ( u i ) g ( u ℓ ) (24)
Note that ϕ \phi ϕ is symmetric in its final four arguments (i.e. invariant to permuting the order of u 1 , u 2 , u 3 u_1, u_2, u_3 u 1 , u 2 , u 3 , and u 4 u_4 u 4 ). It is additionally symmetric in its first two arguments, ϕ ( f , g ; ⋅ ) = ϕ ( g , f ; ⋅ ) \phi(f,g;\cdot)=\phi(g,f;\cdot) ϕ ( f , g ; ⋅ ) = ϕ ( g , f ; ⋅ ) , since swapping f f f and g g g induces a permutation over the input indices which is averaged out.
We assume that we have access to N N N independently sampled neural tuning curves from each system, f 1 , … , f N X ∼ F f_1,\ldots,f_{N_X}\sim\mathcal{F} f 1 , … , f N X ∼ F and g 1 , … , g N Y ∼ G g_1,\ldots,g_{N_Y}\sim\mathcal{G} g 1 , … , g N Y ∼ G , alongside M M M independently sampled inputs, u 1 , … , u M ∼ P U u_1,\ldots,u_M\sim P_{\mathcal{U}} u 1 , … , u M ∼ P U . Then,
S s c = 1 N X N Y ( M 4 ) − 1 ∑ n = 1 N X ∑ n ′ = 1 N Y ∑ i < j < ℓ < p ϕ ( f n , g n ′ , u i , u j , u ℓ , u p ) (25) S_{\mathrm{sc}} = \frac{1}{N_XN_Y}\binom{M}{4}^{-1}\sum_{n=1}^{N_X}\sum_{n'=1}^{N_Y}\sum_{i<j<\ell<p}\phi(f_n,g_{n'},u_i,u_j,u_\ell,u_p) \tag*{(25)} S sc = N X N Y 1 ( 4 M ) − 1 n = 1 ∑ N X n ′ = 1 ∑ N Y i < j < ℓ < p ∑ ϕ ( f n , g n ′ , u i , u j , u ℓ , u p ) (25)
is an unbiased estimator of H S I C ∞ \mathrm{HSIC}_{\infty} HSIC ∞ . Indeed, it is a three-sample U-statistic of degree ( 1 , 1 , 4 ) (1,1,4) ( 1 , 1 , 4 ) : order one in each of the F \mathcal{F} F and G \mathcal{G} G samples, and order four in the inputs. Note that here we investigate specifically the stimulus-corrected estimator S s c S_{\mathrm{sc}} S sc . Neuron-corrections for bias is necessary when the underlying distributions F , G \mathcal{F},\mathcal{G} F , G are identical (e.g. comparing data from two sessions in the same animal-region). Fortunately, our approach in this section can be similarly applied to a U-statistic for S s a n c S_{\mathrm{sanc}} S sanc .
The variance as a sum over collisions
The properties of U-statistics have been extensively characterized (Lee, [30 ] ). In particular, we can write down an explicit expression for the variance of the estimator. To do this it is convenient to package a set of inputs into a single symbol:
σ = { f n , g n ′ , u i , u j , u ℓ , u p } (26) \sigma= \{f_n,g_{n'},u_i,u_j,u_\ell,u_p\} \tag*{(26)} σ = { f n , g n ′ , u i , u j , u ℓ , u p } (26)
Then eq. (25) becomes
S s c = 1 N X N Y ( M 4 ) − 1 ∑ ϕ ( σ ) (27) S_{\mathrm{sc}} = \frac{1}{N_XN_Y}\binom{M}{4}^{-1}\sum\phi(\sigma) \tag*{(27)} S sc = N X N Y 1 ( 4 M ) − 1 ∑ ϕ ( σ ) (27)
where the sum is understood to range over all unique tuples. Thus, we can write the variance of the estimator as
Var [ S s c ] = Var [ 1 N X N Y ( M 4 ) − 1 ∑ ϕ ( σ ) ] = 1 N X 2 N Y 2 ( M 4 ) − 2 ∑ σ , σ ′ Cov ( ϕ ( σ ) , ϕ ( σ ′ ) ) (28) \operatorname{Var}[S_{\mathrm{sc}}] = \operatorname{Var}\left[\frac{1}{N_XN_Y}\binom{M}{4}^{-1}\sum\phi(\sigma)\right] = \frac{1}{N_X^2N_Y^2}\binom{M}{4}^{-2}\sum_{\sigma,\sigma'}\operatorname{Cov}(\phi(\sigma),\phi(\sigma')) \tag*{(28)} Var [ S sc ] = Var [ N X N Y 1 ( 4 M ) − 1 ∑ ϕ ( σ ) ] = N X 2 N Y 2 1 ( 4 M ) − 2 σ , σ ′ ∑ Cov ( ϕ ( σ ) , ϕ ( σ ′ )) (28)
where the sums over σ \sigma σ and σ ′ \sigma' σ ′ independently span over all unique tuples.
Next, we invoke a standard identity for U-statistic covariances (Section 1.4, Theorem 3, Lee, [30 ] ):
Cov ( ϕ ( σ ) , ϕ ( σ ′ ) ) = Var σ ∩ σ ′ [ E [ ϕ ( σ ) ∣ σ ∩ σ ′ ] ] (29) \operatorname{Cov}(\phi(\sigma),\phi(\sigma'))=\operatorname{Var}_{\sigma\cap\sigma'}\left[\mathbb{E}\left[\phi(\sigma)\mid\sigma\cap\sigma'\right]\right] \tag*{(29)} Cov ( ϕ ( σ ) , ϕ ( σ ′ )) = Var σ ∩ σ ′ [ E [ ϕ ( σ ) ∣ σ ∩ σ ′ ] ] (29)
Intuitively, this relation states that the covariance between ϕ ( σ ) \phi(\sigma) ϕ ( σ ) and ϕ ( σ ′ ) \phi(\sigma') ϕ ( σ ′ ) grows with the size of their overlapping elements σ ∩ σ ′ \sigma\cap\sigma' σ ∩ σ ′ . The inner expectation denotes partial averaging—all variables that are not overlapping are averaged out, and the variance is computed with to respect to the remaining terms. When σ ∩ σ ′ = ∅ \sigma\cap\sigma'=\varnothing σ ∩ σ ′ = ∅ (no overlap), the inner expectation is with respect to all variables in σ \sigma σ and evaluates to a constant; thus, we have:
σ ∩ σ ′ = ∅ ⇒ Cov ( ϕ ( σ ) , ϕ ( σ ′ ) ) = 0. (30) \sigma\cap\sigma'=\varnothing\quad\Rightarrow\quad\operatorname{Cov}(\phi(\sigma),\phi(\sigma'))=0. \tag*{(30)} σ ∩ σ ′ = ∅ ⇒ Cov ( ϕ ( σ ) , ϕ ( σ ′ )) = 0. (30)
In the other extreme, when S = S ′ S=S' S = S ′ (full overlap), nothing is averaged out in the inner expectation and we recover Cov ( ϕ ( σ ) , ϕ ( σ ′ ) ) = Var [ ϕ ( σ ) ] \operatorname{Cov}(\phi(\sigma),\phi(\sigma'))=\operatorname{Var}[\phi(\sigma)] Cov ( ϕ ( σ ) , ϕ ( σ ′ )) = Var [ ϕ ( σ )] .
To proceed, we enumerate all possible overlap patterns between σ \sigma σ and σ ′ \sigma' σ ′ in the sum appearing in eq. (28) . We use the term “collison” to denote the event that one of the variables is part of the overlap and we introduce three index variables to account for these collisions:
α ∈ { 0 , 1 } = # of collisions in F samples (31) \alpha\in\{0,1\}=\#\text{ of collisions in }\mathcal{F}\text{ samples} \tag*{(31)} α ∈ { 0 , 1 } = # of collisions in F samples (31)
β ∈ { 0 , 1 } = # of collisions in G samples (32) \beta\in\{0,1\}=\#\text{ of collisions in }\mathcal{G}\text{ samples} \tag*{(32)} β ∈ { 0 , 1 } = # of collisions in G samples (32)
γ ∈ { 0 , 1 , 2 , 3 , 4 } = # of collisions in input samples (33) \gamma\in\{0,1,2,3,4\}=\#\text{ of collisions in input samples} \tag*{(33)} γ ∈ { 0 , 1 , 2 , 3 , 4 } = # of collisions in input samples (33)
For example, σ = ( f 1 , g 1 , u 1 , u 2 , u 3 , u 4 ) \sigma=(f_1,g_1,u_1,u_2,u_3,u_4) σ = ( f 1 , g 1 , u 1 , u 2 , u 3 , u 4 ) and σ ′ = ( f 1 , g 2 , u 2 , u 3 , u 4 , u 5 ) \sigma'=(f_1,g_2,u_2,u_3,u_4,u_5) σ ′ = ( f 1 , g 2 , u 2 , u 3 , u 4 , u 5 ) corresponds to a overlap pattern of ( α , β , γ ) = ( 1 , 0 , 3 ) (\alpha,\beta,\gamma)=(1,0,3) ( α , β , γ ) = ( 1 , 0 , 3 ) ; one collision in the F \mathcal{F} F neural sample, no collisions in the G \mathcal{G} G neural sample, and three collisions in the input samples. Note that the position of the four input samples can be ignored since ϕ \phi ϕ is a symmetric function by our construction in eq. (24) .
Now let C α β γ C_{\alpha\beta\gamma} C α β γ denote the number of collisions of each type occurring in eq. (28) , and let
V α β γ = Cov ( ϕ ( σ ) , ϕ ( σ ′ ) ) = Var σ ∩ σ ′ [ E [ ϕ ( σ ) ∣ σ ∩ σ ′ ] ] , (34) V_{\alpha\beta\gamma}=\operatorname{Cov}(\phi(\sigma),\phi(\sigma'))=\operatorname{Var}_{\sigma\cap\sigma'}\left[\mathbb{E}\left[\phi(\sigma)\mid\sigma\cap\sigma'\right]\right], \tag*{(34)} V α β γ = Cov ( ϕ ( σ ) , ϕ ( σ ′ )) = Var σ ∩ σ ′ [ E [ ϕ ( σ ) ∣ σ ∩ σ ′ ] ] , (34)
denote the variance of each corresponding term. Note that the variance only depends on the number of collisions in each block of variables due to the i.i.d. assumption of samples and the blockwise symmetry of ϕ \phi ϕ . Thus, we can compactly re-express the variance of the estimator as:
Var [ S s c ] = 1 N X 2 N Y 2 ( M 4 ) − 2 ∑ α , β , γ C α β γ V α β γ (35) \operatorname{Var}[S_{\mathrm{sc}}]=\frac{1}{N_X^2N_Y^2}\binom{M}{4}^{-2}\sum_{\alpha,\beta,\gamma}C_{\alpha\beta\gamma}V_{\alpha\beta\gamma} \tag*{(35)} Var [ S sc ] = N X 2 N Y 2 1 ( 4 M ) − 2 α , β , γ ∑ C α β γ V α β γ (35)
where the sum ranges over all 2 × 2 × 5 = 20 2\times2\times5=20 2 × 2 × 5 = 20 possible collision patterns. Note that, for large N N N and M M M , the vast majority of terms will have no collisions, and these terms do not contribute to the variance since V 000 = 0 V_{000}=0 V 000 = 0 as already established in eq. (30) .
Counting collisions
We now derive an explicit expression for C α β γ C_{\alpha\beta\gamma} C α β γ using some basic combinatorial calculations. For each block of variables (F \mathcal{F} F neurons, G \mathcal{G} G neurons, and inputs), both σ \sigma σ and σ ′ \sigma' σ ′ draw a subset of fixed size ν \nu ν without replacement from a population of P P P elements (ν = 1 \nu=1 ν = 1 , P = N P=N P = N for each neuron sample; ν = 4 \nu=4 ν = 4 , P = M P=M P = M for the inputs). Conditioned on whichever ν \nu ν elements are drawn by σ \sigma σ , the overlap follows a hypergeometric distribution—i.e. the number of times one of the ν \nu ν elements in σ \sigma σ is drawn by σ ′ \sigma' σ ′ for its own ν \nu ν draws without replacement. The number of ordered pairs of subsets that overlap in exactly c c c elements is therefore
( P ν ) ( ν c ) ( P − ν ν − c ) , (36) \binom{P}{\nu}\binom{\nu}{c}\binom{P-\nu}{\nu-c}, \tag*{(36)} ( ν P ) ( c ν ) ( ν − c P − ν ) , (36)
where ( ν c ) \binom{\nu}{c} ( c ν ) counts the marked elements that σ ′ \sigma' σ ′ reuses and ( P − ν ν − c ) \binom{P-\nu}{\nu-c} ( ν − c P − ν ) the remaining ones it draws from the unmarked population; dividing through by ( P ν ) \binom{P}{\nu} ( ν P ) recovers the hypergeometric probability mass function. Multiplying eq. (36) across the three samples—with ( ν , P , c ) = ( 1 , N , α ) (\nu,\mathcal{P},c)=(1,N,\alpha) ( ν , P , c ) = ( 1 , N , α ) for F \mathcal{F} F , ( 1 , N , β ) (1,N,\beta) ( 1 , N , β ) for G \mathcal{G} G , and ( 4 , M , γ ) (4,M,\gamma) ( 4 , M , γ ) for the inputs—yields
C α β γ = ( N X 1 ) ( 1 α ) ( N X − 1 1 − α ) ( N Y 1 ) ( 1 β ) ( N Y − 1 1 − β ) ( M 4 ) ( 4 γ ) ( M − 4 4 − γ ) . (37) C_{\alpha\beta\gamma}=\binom{N_X}{1}\binom{1}{\alpha}\binom{N_X-1}{1-\alpha}\binom{N_Y}{1}\binom{1}{\beta}\binom{N_Y-1}{1-\beta}\binom{M}{4}\binom{4}{\gamma}\binom{M-4}{4-\gamma}. \tag*{(37)} C α β γ = ( 1 N X ) ( α 1 ) ( 1 − α N X − 1 ) ( 1 N Y ) ( β 1 ) ( 1 − β N Y − 1 ) ( 4 M ) ( γ 4 ) ( 4 − γ M − 4 ) . (37)
This simplifies simply to
C α β γ = N X ( N X − 1 ) 1 − α N Y ( N Y − 1 ) 1 − β ( M 4 ) ( 4 γ ) ( M − 4 4 − γ ) . (38) C_{\alpha\beta\gamma}=N_X(N_X-1)^{1-\alpha}N_Y(N_Y-1)^{1-\beta}\binom{M}{4}\binom{4}{\gamma}\binom{M-4}{4-\gamma}. \tag*{(38)} C α β γ = N X ( N X − 1 ) 1 − α N Y ( N Y − 1 ) 1 − β ( 4 M ) ( γ 4 ) ( 4 − γ M − 4 ) . (38)
It is helpful to normalize C α β γ C_{\alpha\beta\gamma} C α β γ by the number of terms in the sum. Thus, we have
Var [ S s c ] = ∑ α , β , γ C ~ α β γ V α β γ (39) \operatorname{Var}[S_{\mathrm{sc}}]=\sum_{\alpha,\beta,\gamma}\widetilde{C}_{\alpha\beta\gamma}V_{\alpha\beta\gamma} \tag*{(39)} Var [ S sc ] = α , β , γ ∑ C α β γ V α β γ (39)
where
C ~ α β γ = 1 N X 2 N Y 2 ( M 4 ) − 2 C α β γ = ( N X − 1 ) 1 − α N X ( N Y − 1 ) 1 − β N Y ( 4 γ ) ( M − 4 4 − γ ) ( M 4 ) . (40) \widetilde{C}_{\alpha\beta\gamma}=\frac{1}{N_X^2N_Y^2}\binom{M}{4}^{-2}C_{\alpha\beta\gamma}=\frac{(N_X-1)^{1-\alpha}}{N_X}\frac{(N_Y-1)^{1-\beta}}{N_Y}\frac{\binom{4}{\gamma}\binom{M-4}{4-\gamma}}{\binom{M}{4}}. \tag*{(40)} C α β γ = N X 2 N Y 2 1 ( 4 M ) − 2 C α β γ = N X ( N X − 1 ) 1 − α N Y ( N Y − 1 ) 1 − β ( 4 M ) ( γ 4 ) ( 4 − γ M − 4 ) . (40)
Each factor is the probability mass function of a hypergeometric distribution, so C ~ α β γ \widetilde{C}_{\alpha\beta\gamma} C α β γ is the probability that two independently drawn tuples collide in pattern ( α , β , γ ) (\alpha,\beta,\gamma) ( α , β , γ ) ; in particular ∑ α , β , γ C ~ α β γ = 1 \sum_{\alpha,\beta,\gamma}\widetilde{C}_{\alpha\beta\gamma}=1 ∑ α , β , γ C α β γ = 1 , and the variance is the expected collision covariance, Var [ S s c ] = E [ V α β γ ] \operatorname{Var}[S_{\mathrm{sc}}]=\mathbb{E}[V_{\alpha\beta\gamma}] Var [ S sc ] = E [ V α β γ ] .
Next, we assume that the random variables f ( u ) f(u) f ( u ) (over f ∼ F f\sim\mathcal{F} f ∼ F ) and g ( u ) g(u) g ( u ) (over g ∼ G g\sim\mathcal{G} g ∼ G ) are sub-Gaussian. This assumption is desired because it guarantees that their fourth moments are bounded, E f [ f ( u ) 4 ] ≤ C σ F 4 \mathbb{E}_f[f(u)^4]\le C\sigma_{\mathcal{F}}^4 E f [ f ( u ) 4 ] ≤ C σ F 4 and E g [ g ( u ) 4 ] ≤ C σ G 4 \mathbb{E}_g[g(u)^4]\le C\sigma_{\mathcal{G}}^4 E g [ g ( u ) 4 ] ≤ C σ G 4 , uniformly in u u u (overloading notation somewhat, and definition σ F 4 , σ G 4 \sigma_{\mathcal{F}}^4,\sigma_{\mathcal{G}}^4 σ F 4 , σ G 4 as the fourth moment of their respective distributions). Note that this is a looser restriction than bounded firing rates, which are guaranteed in both biological and computational networks, so we do not restrict ourselves of consideration in any practical settings. We show that the variance decreases at a rate proportional to 1 / M + 1 / N 1/M+1/N 1/ M + 1/ N with a multiplicative constant that is independent of the dimensionality of the inputs or smoothness of the tuning curves.
Variance bound on HSIC
First, we note that
V α β γ ≤ V 114 = Var [ ϕ ( σ ) ] , (41) V_{\alpha\beta\gamma}\le V_{114}=\operatorname{Var}[\phi(\sigma)], \tag*{(41)} V α β γ ≤ V 114 = Var [ ϕ ( σ )] , (41)
for all collision patterns indexed by ( α , β , γ ) (\alpha,\beta,\gamma) ( α , β , γ ) . This is because V α β γ = Var σ ∩ σ ′ [ E [ ϕ ( σ ) ∣ σ ∩ σ ′ ] ] V_{\alpha\beta\gamma}=\operatorname{Var}_{\sigma\cap\sigma'}[\mathbb{E}[\phi(\sigma)\mid\sigma\cap\sigma']] V α β γ = Var σ ∩ σ ′ [ E [ ϕ ( σ ) ∣ σ ∩ σ ′ ]] averages out non-shared arguments in the inner expectation, and such partial averaging can only decrease the variance.
The core idea is to bound V 114 = Var [ ϕ ( σ ) ] ≤ E [ ϕ ( σ ) 2 ] = ∥ ϕ ∥ 2 2 V_{114}=\operatorname{Var}[\phi(\sigma)]\le\mathbb{E}[\phi(\sigma)^2]=\|\phi\|_2^2 V 114 = Var [ ϕ ( σ )] ≤ E [ ϕ ( σ ) 2 ] = ∥ ϕ ∥ 2 2 , where ∥ X ∥ 2 : = E [ X 2 ] 1 / 2 \|X\|_2:=\mathbb{E}[X^2]^{1/2} ∥ X ∥ 2 := E [ X 2 ] 1/2 denotes the L 2 L^2 L 2 norm of a scalar random variable. Using the triangle inequality associated with this norm, on both the average over permutations in eq. (24) and the three terms with coefficients ( 1 , 1 , − 2 ) (1,1,-2) ( 1 , 1 , − 2 ) , we have
∥ ϕ ∥ 2 ≤ 4 max a ≠ b , c ≠ d ∥ f ( u a ) f ( u b ) g ( u c ) g ( u d ) ∥ 2 , (42) \|\phi\|_2\le4\max_{\substack{a\ne b,\ c\ne d}}\|f(u_a)f(u_b)g(u_c)g(u_d)\|_2, \tag*{(42)} ∥ ϕ ∥ 2 ≤ 4 a = b , c = d max ∥ f ( u a ) f ( u b ) g ( u c ) g ( u d ) ∥ 2 , (42)
where the maximum is over the finitely many index patterns appearing in ϕ \phi ϕ (the indices a , b a,b a , b need not be distinct from c , d c,d c , d ). Unlike a maximum over permutations inside the norm, this is a maximum of fixed numbers, so no worst-case permutation needs to be selected.
Now fix any such pattern and condition on the inputs. Due to independence of f ∼ F f\sim\mathcal{F} f ∼ F and g ∼ G g\sim\mathcal{G} g ∼ G , we have:
E f , g [ f ( u a ) 2 f ( u b ) 2 g ( u c ) 2 g ( u d ) 2 ] = E f [ f ( u a ) 2 f ( u b ) 2 ] ⋅ E g [ g ( u c ) 2 g ( u d ) 2 ] (43) \mathbb{E}_{f,g}[f(u_a)^2f(u_b)^2g(u_c)^2g(u_d)^2]=\mathbb{E}_f[f(u_a)^2f(u_b)^2]\cdot\mathbb{E}_g[g(u_c)^2g(u_d)^2] \tag*{(43)} E f , g [ f ( u a ) 2 f ( u b ) 2 g ( u c ) 2 g ( u d ) 2 ] = E f [ f ( u a ) 2 f ( u b ) 2 ] ⋅ E g [ g ( u c ) 2 g ( u d ) 2 ] (43)
Each term is bounded by Cauchy–Schwarz, which we can then bound due to the sub-Gaussian assumption on the tuning curves:
E f [ f ( u a ) 2 f ( u b ) 2 ] ≤ E f [ f ( u a ) 4 ] E f [ f ( u b ) 4 ] ≤ C σ F 4 . (44) \mathbb{E}_f[f(u_a)^2f(u_b)^2]\le\sqrt{\mathbb{E}_f[f(u_a)^4]\mathbb{E}_f[f(u_b)^4]}\le C\sigma_{\mathcal{F}}^4. \tag*{(44)} E f [ f ( u a ) 2 f ( u b ) 2 ] ≤ E f [ f ( u a ) 4 ] E f [ f ( u b ) 4 ] ≤ C σ F 4 . (44)
and likewise E [ g ( u c ) 2 g ( u d ) 2 ] ≤ C σ g 4 \mathbb{E}[g(u_c)^2g(u_d)^2] \le C\sigma_g^4 E [ g ( u c ) 2 g ( u d ) 2 ] ≤ C σ g 4 . As these bounds hold for every realization of the inputs, averaging over the inputs gives ∥ f ( u a ) f ( u b ) g ( u c ) g ( u d ) ∥ 2 ≤ C 2 σ f 4 σ g 4 \|f(u_a)f(u_b)g(u_c)g(u_d)\|^2 \le C^2\sigma_f^4\sigma_g^4 ∥ f ( u a ) f ( u b ) g ( u c ) g ( u d ) ∥ 2 ≤ C 2 σ f 4 σ g 4 , so we conclude that
V 114 = Var [ ϕ ( σ ) ] ≤ E [ ϕ ( σ ) 2 ] ≤ 16 C 2 σ f 4 σ g 4 = C ′ σ f 4 σ g 4 (45) V_{114}=\operatorname{Var}[\phi(\sigma)]\le\mathbb{E}[\phi(\sigma)^2]\le16C^2\sigma_f^4\sigma_g^4=C'\sigma_f^4\sigma_g^4 \tag*{(45)} V 114 = Var [ ϕ ( σ )] ≤ E [ ϕ ( σ ) 2 ] ≤ 16 C 2 σ f 4 σ g 4 = C ′ σ f 4 σ g 4 (45)
for a universal constant C C C (absorbing the numerical factors).
Now, starting from eq. (39) and the fact that V 000 = 0 V_{000}=0 V 000 = 0 , we have
Var [ S s c ] = ∑ ( α , β , γ ) ≠ 0 C ~ α β γ V α β γ (46) \operatorname{Var}[S_{\mathrm{sc}}]=\sum_{(\alpha,\beta,\gamma)\ne0}\widetilde{C}_{\alpha\beta\gamma}V_{\alpha\beta\gamma} \tag*{(46)} Var [ S sc ] = ( α , β , γ ) = 0 ∑ C α β γ V α β γ (46)
= 1 N X V 100 + 1 N Y V 010 + 16 M V 001 + O ( ( 1 N X + 1 N Y + 1 M ) 2 ) (47) =\frac{1}{N_X}V_{100}+\frac{1}{N_Y}V_{010}+\frac{16}{M}V_{001}+O\left(\left(\frac{1}{N_X}+\frac{1}{N_Y}+\frac{1}{M}\right)^2\right) \tag*{(47)} = N X 1 V 100 + N Y 1 V 010 + M 16 V 001 + O ( ( N X 1 + N Y 1 + M 1 ) 2 ) (47)
≲ ( 1 N X + 1 N Y + 16 M ) V 114 = C σ f 4 σ g 4 ( 1 N X + 1 N Y + 16 M ) (48) \lesssim\left(\frac{1}{N_X}+\frac{1}{N_Y}+\frac{16}{M}\right)V_{114}=C\sigma_f^4\sigma_g^4\left(\frac{1}{N_X}+\frac{1}{N_Y}+\frac{16}{M}\right) \tag*{(48)} ≲ ( N X 1 + N Y 1 + M 16 ) V 114 = C σ f 4 σ g 4 ( N X 1 + N Y 1 + M 16 ) (48)
Theoretical results on CKD
Maximum Mean Discrepancy
CKD is a special case of the maximum mean discrepancy (MMD; [13 ] ) with quadratic kernel κ ( f , g ) = ⟨ f ˉ , g ˉ ⟩ \kappa(f,g)=\langle\bar{f},\bar{g}\rangle κ ( f , g ) = ⟨ f ˉ , g ˉ ⟩ , where f ˉ , g ˉ \bar{f},\bar{g} f ˉ , g ˉ represent the mean-subtracted (i.e. centered) tuning curves and the inner product is L 2 ( P U ) L_2(P_U) L 2 ( P U ) . Given any kernel κ \kappa κ , its MMD is defined as
MMD 2 ( F , G ) = E [ κ ( f , f ′ ) ] + E [ κ ( g , g ′ ) ] − 2 E [ κ ( f , g ) ] \operatorname{MMD}^2(\mathcal{F},\mathcal{G})=\mathbb{E}\left[\kappa(f,f')\right]+\mathbb{E}\left[\kappa(g,g')\right]-2\mathbb{E}\left[\kappa(f,g)\right] MMD 2 ( F , G ) = E [ κ ( f , f ′ ) ] + E [ κ ( g , g ′ ) ] − 2 E [ κ ( f , g ) ]
with tuning curves f , f ′ ∼ F f,f'\sim\mathcal{F} f , f ′ ∼ F , g , g ′ ∼ G g,g'\sim\mathcal{G} g , g ′ ∼ G drawn independently from their respective distributions. Hence, we get ⟨ f ˉ ⊗ f ˉ , g ˉ ⊗ g ˉ ⟩ H S = ⟨ f ˉ , g ˉ ⟩ 2 = κ ( f , g ) \langle\bar{f}\otimes\bar{f},\bar{g}\otimes\bar{g}\rangle_{HS}=\langle\bar{f},\bar{g}\rangle^2=\kappa(f,g) ⟨ f ˉ ⊗ f ˉ , g ˉ ⊗ g ˉ ⟩ H S = ⟨ f ˉ , g ˉ ⟩ 2 = κ ( f , g ) and MMD 2 = CKD 2 \operatorname{MMD}^2=\operatorname{CKD}^2 MMD 2 = CKD 2 .
The CKD Estimator
The main difference with the CKD estimator is the two self-terms S s a n c S_{\mathrm{sanc}} S sanc involved. The self terms require a small modification: ⟨ k ˉ , k ˉ ⟩ \langle\bar{k},\bar{k}\rangle ⟨ k ˉ , k ˉ ⟩ is estimated by feeding ϕ \phi ϕ two independent neurons from the same system,
E f 1 , f 2 ∼ F , u 1 : 4 [ ϕ ( f 1 , f 2 , u 1 : 4 ) ] = ⟨ k ˉ , k ˉ ⟩ , (49) \mathbb{E}_{f_1,f_2\sim\mathcal{F},\,u_{1:4}}\left[\phi(f_1,f_2,u_{1:4})\right]=\langle\bar{k},\bar{k}\rangle, \tag*{(49)} E f 1 , f 2 ∼ F , u 1 : 4 [ ϕ ( f 1 , f 2 , u 1 : 4 ) ] = ⟨ k ˉ , k ˉ ⟩ , (49)
which holds because ϕ \phi ϕ is unbiased for ⟨ k ˉ , h ˉ ⟩ \langle\bar{k},\bar{h}\rangle ⟨ k ˉ , h ˉ ⟩ whenever its two neuron arguments are independent.
Collecting the three pieces, and symmetrizing the cross term over which neuron is drawn from each system, define the kernel
ψ ( f 1 , f 2 , g 1 , g 2 , u 1 : 4 ) = ϕ ( f 1 , f 2 , u 1 : 4 ) + ϕ ( g 1 , g 2 , u 1 : 4 ) − 1 2 ∑ a = 1 2 ∑ b = 1 2 ϕ ( f a , g b , u 1 : 4 ) , (50) \psi(f_1,f_2,g_1,g_2,u_{1:4})=\phi(f_1,f_2,u_{1:4})+\phi(g_1,g_2,u_{1:4})-\frac{1}{2}\sum_{a=1}^{2}\sum_{b=1}^{2}\phi(f_a,g_b,u_{1:4}), \tag*{(50)} ψ ( f 1 , f 2 , g 1 , g 2 , u 1 : 4 ) = ϕ ( f 1 , f 2 , u 1 : 4 ) + ϕ ( g 1 , g 2 , u 1 : 4 ) − 2 1 a = 1 ∑ 2 b = 1 ∑ 2 ϕ ( f a , g b , u 1 : 4 ) , (50)
which satisfies E [ ψ ] = ⟨ k ˉ , k ˉ ⟩ − 2 ⟨ k ˉ , h ˉ ⟩ + ⟨ h ˉ , h ˉ ⟩ = CKD 2 \mathbb{E}[\psi]=\langle\bar{k},\bar{k}\rangle-2\langle\bar{k},\bar{h}\rangle+\langle\bar{h},\bar{h}\rangle=\operatorname{CKD}^2 E [ ψ ] = ⟨ k ˉ , k ˉ ⟩ − 2 ⟨ k ˉ , h ˉ ⟩ + ⟨ h ˉ , h ˉ ⟩ = CKD 2 and is symmetric within each block of arguments (the two F F F -neurons, the two G G G -neurons, and the four inputs). Given N ≥ 2 N\ge2 N ≥ 2 neurons from each system and M M M inputs, the corresponding U-statistic is
CKD ^ 2 = ( N 2 ) − 1 ( M 4 ) − 1 ∑ n 1 < n 2 ∑ n 1 ′ < n 2 ′ ∑ i < j < ℓ < p ψ ( f n 1 , f n 2 , g n 1 ′ , g n 2 ′ , u i , u j , u ℓ , u p ) , (51) \widehat{\operatorname{CKD}}^2=\binom{N}{2}^{-1}\binom{M}{4}^{-1}\sum_{n_1<n_2}\sum_{n'_1<n'_2}\sum_{i<j<\ell<p}\psi(f_{n_1},f_{n_2},g_{n'_1},g_{n'_2},u_i,u_j,u_\ell,u_p), \tag*{(51)} CKD 2 = ( 2 N ) − 1 ( 4 M ) − 1 n 1 < n 2 ∑ n 1 ′ < n 2 ′ ∑ i < j < ℓ < p ∑ ψ ( f n 1 , f n 2 , g n 1 ′ , g n 2 ′ , u i , u j , u ℓ , u p ) , (51)
an unbiased estimator of CKD 2 \operatorname{CKD}^2 CKD 2 . It is a three-sample U-statistic of degree ( 2 , 2 , 4 ) (2,2,4) ( 2 , 2 , 4 ) : order two in each neuron sample—one higher than for HSIC, since each self term reuses its system—and order four in the inputs.
We can efficiently compute our estimator CKD ^ 2 \widehat{\operatorname{CKD}}^2 CKD 2 in practice by leveraging the expression of S s c S_{\mathrm{sc}} S sc in eq. (11) , due to Song et al. [43 ] . In particular, every term appearing on the right hand side of eq. (11) is separately linear in K ^ \widehat{K} K and H ^ \widehat{H} H . Thus, setting the two inputs to the estimator equal to K ^ = N X − 1 ∑ n x n x n T \widehat{K}=N_X^{-1}\sum_n x_nx_n^{\mathsf T} K = N X − 1 ∑ n x n x n T and rearranging, we get:
S s c ( X , X ) = 1 N X 2 ∑ n = 1 N X ∑ n ′ = 1 N X S s c ( x n x n T , x n ′ x n ′ T ) . (52) S_{\mathrm{sc}}(X,X)=\frac{1}{N_X^2}\sum_{n=1}^{N_X}\sum_{n'=1}^{N_X}S_{\mathrm{sc}}(x_nx_n^{\mathsf T},x_{n'}x_{n'}^{\mathsf T}). \tag*{(52)} S sc ( X , X ) = N X 2 1 n = 1 ∑ N X n ′ = 1 ∑ N X S sc ( x n x n T , x n ′ x n ′ T ) . (52)
We need to remove the diagonal terms where n = n ′ n=n' n = n ′ . Subtracting off these terms and rescaling to achieve the proper normalization we get
S s a n c ( X , X ) = 1 N X ( N X − 1 ) ( N X 2 S s c ( K ^ , K ^ ) − ∑ n S s c ( x n x n T , x n x n T ) ) . (53) S_{\mathrm{sanc}}(X,X)=\frac{1}{N_X(N_X-1)}\left(N_X^2S_{\mathrm{sc}}(\widehat{K},\widehat{K})-\sum_n S_{\mathrm{sc}}(x_nx_n^{\mathsf T},x_nx_n^{\mathsf T})\right). \tag*{(53)} S sanc ( X , X ) = N X ( N X − 1 ) 1 ( N X 2 S sc ( K , K ) − n ∑ S sc ( x n x n T , x n x n T ) ) . (53)
To efficiently calculate S s a n c S_{\mathrm{sanc}} S sanc between two rank one matrices, we do not form the M × M M\times M M × M matrices explicitly. Instead, one can verify that
S s a n c ( v v T , v v T ) = 1 M ( M − 3 ) [ ( z 2 2 − z 4 ) + ( z 1 2 − z 2 ) 2 ( M − 1 ) ( M − 2 ) − 2 ( z 1 2 z 2 + z 4 − 2 z 1 z 3 ) M − 2 ] , (54) S_{\mathrm{sanc}}(vv^{\mathsf T},vv^{\mathsf T})=\frac{1}{M(M-3)}\left[(z_2^2-z_4)+\frac{(z_1^2-z_2)^2}{(M-1)(M-2)}-\frac{2(z_1^2z_2+z_4-2z_1z_3)}{M-2}\right], \tag*{(54)} S sanc ( v v T , v v T ) = M ( M − 3 ) 1 [ ( z 2 2 − z 4 ) + ( M − 1 ) ( M − 2 ) ( z 1 2 − z 2 ) 2 − M − 2 2 ( z 1 2 z 2 + z 4 − 2 z 1 z 3 ) ] , (54)
for any vector v ∈ R M v\in\mathbb{R}^M v ∈ R M and z 1 = ∑ i v i z_1=\sum_i v_i z 1 = ∑ i v i , z 2 = ∑ i v i 2 z_2=\sum_i v_i^2 z 2 = ∑ i v i 2 , z 3 = ∑ i v i 3 z_3=\sum_i v_i^3 z 3 = ∑ i v i 3 , and z 4 = ∑ i v i 4 z_4=\sum_i v_i^4 z 4 = ∑ i v i 4 . Thus, computing S s a n c S_{\mathrm{sanc}} S sanc on two identical rank-one matrices requires only O ( M ) O(M) O ( M ) calculations. Repeating this calculation across all neurons in eq. (53) requires only O ( M N X ) O(MN_X) O ( M N X ) computation.
The variance as a sum over collisions
The variance decomposes exactly as in eqs. (28) to (40) , now for the degree-( 2 , 2 , 4 ) (2,2,4) ( 2 , 2 , 4 ) kernel ψ \psi ψ . The only change is that the two neuron samples now contribute degree two, so the collision indices run over
α , β ∈ { 0 , 1 , 2 } , γ ∈ { 0 , 1 , 2 , 3 , 4 } , (55) \alpha,\beta\in\{0,1,2\},\qquad\gamma\in\{0,1,2,3,4\}, \tag*{(55)} α , β ∈ { 0 , 1 , 2 } , γ ∈ { 0 , 1 , 2 , 3 , 4 } , (55)
giving a 3 × 3 × 5 3\times3\times5 3 × 3 × 5 table of patterns. Writing V α β γ V_{\alpha\beta\gamma} V α β γ for the projection variance of each pattern (with V 000 = 0 V_{000}=0 V 000 = 0 as before),
Var [ C K D ^ 2 ] = ∑ α , β , γ C ~ α β γ V α β γ , (56) \operatorname{Var}[\widehat{\mathrm{CKD}}^2]=\sum_{\alpha,\beta,\gamma}\widetilde{C}_{\alpha\beta\gamma}V_{\alpha\beta\gamma}, \tag*{(56)} Var [ CKD 2 ] = α , β , γ ∑ C α β γ V α β γ , (56)
where C ~ α β γ \widetilde{C}_{\alpha\beta\gamma} C α β γ is again a product of three hypergeometric probabilities, now with degree d = 2 d=2 d = 2 for each neuron sample,
C ~ α β γ = ( 2 α ) ( N X − 2 2 − α ) ( N X 2 ) ⋅ ( 2 β ) ( N Y − 2 2 − β ) ( N Y 2 ) ⋅ ( 4 γ ) ( M − 4 4 − γ ) ( M 4 ) . (57) \widetilde{C}_{\alpha\beta\gamma}=
\frac{\binom{2}{\alpha}\binom{N_X-2}{2-\alpha}}{\binom{N_X}{2}}
\cdot
\frac{\binom{2}{\beta}\binom{N_Y-2}{2-\beta}}{\binom{N_Y}{2}}
\cdot
\frac{\binom{4}{\gamma}\binom{M-4}{4-\gamma}}{\binom{M}{4}}. \tag*{(57)} C α β γ = ( 2 N X ) ( α 2 ) ( 2 − α N X − 2 ) ⋅ ( 2 N Y ) ( β 2 ) ( 2 − β N Y − 2 ) ⋅ ( 4 M ) ( γ 4 ) ( 4 − γ M − 4 ) . (57)
The leading single-collision probabilities again follow the hypergeometric mean overlap d 2 / P d^2/P d 2 / P of two degree-d d d draws from a population of size P P P : a single neuron collision occurs with probability C ~ 100 → 4 / N X \widetilde{C}_{100}\to4/N_X C 100 → 4/ N X , C ~ 010 → 4 / N Y \widetilde{C}_{010}\to4/N_Y C 010 → 4/ N Y (degree d = 2 d=2 d = 2 ), and a single input collision with C ~ 001 → 16 / M \widetilde{C}_{001}\to16/M C 001 → 16/ M (degree d = 4 ) . T h e n e u r o n r a t e i s t h u s r a i s e d f r o m t h e $ 1 / N d=4). The neuron rate is thus raised from the \$1/N d = 4 ) . T h e n e u r o n r a t e i s t h u sr ai se df r o m t h e $1/ N of the preceding section to 4 / N 4/N 4/ N (for both N X N_X N X and N Y N_Y N Y .
Proof of th:bound-CKD
For each neuron, write f ˉ = E u [ f ( u ) ] \bar{f}=\mathbb{E}_u[f(u)] f ˉ = E u [ f ( u )] and g ˉ = E u [ g ( u ) ] \bar{g}=\mathbb{E}_u[g(u)] g ˉ = E u [ g ( u )] for its stimulus-averaged response. Then consider the expansion of E u , u ′ [ ( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) h ( u , u ′ ) ] \mathbb{E}_{u,u'}[(f(u)-\bar{f})(f(u')-\bar{f})h(u,u')] E u , u ′ [( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) h ( u , u ′ )] , given by
E u , u ′ [ f ( u ) f ( u ′ ) h ( u , u ′ ) ] + f ˉ 2 E u , u ′ [ h ( u , u ′ ) ] − 2 f ˉ E u , u ′ [ f ( u ) h ( u , u ′ ) ] , \mathbb{E}_{u,u'}[f(u)f(u')h(u,u')]+\bar{f}^{\,2}\mathbb{E}_{u,u'}[h(u,u')]-2\bar{f}\mathbb{E}_{u,u'}[f(u)h(u,u')], E u , u ′ [ f ( u ) f ( u ′ ) h ( u , u ′ )] + f ˉ 2 E u , u ′ [ h ( u , u ′ )] − 2 f ˉ E u , u ′ [ f ( u ) h ( u , u ′ )] ,
where the cross terms combine by the symmetry of h h h . Substituting h ( u , u ′ ) = E g [ g ( u ) g ( u ′ ) ] h(u,u')=\mathbb{E}_g[g(u)g(u')] h ( u , u ′ ) = E g [ g ( u ) g ( u ′ )] and f ˉ = E u [ f ( u ) ] \bar{f}=\mathbb{E}_u[f(u)] f ˉ = E u [ f ( u )] into the right hand side and pulling out the expectation, we get:
E g , u 1 : 4 [ f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 2 ) + f ( u 1 ) f ( u 2 ) g ( u 3 ) g ( u 4 ) − 2 f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 3 ) ] = E [ ϕ ( σ ) ∣ f ] , \mathbb{E}_{g,\;u_{1:4}}\left[f(u_1)f(u_2)g(u_1)g(u_2)+f(u_1)f(u_2)g(u_3)g(u_4)-2f(u_1)f(u_2)g(u_1)g(u_3)\right]=\mathbb{E}[\phi(\sigma)\mid f], E g , u 1 : 4 [ f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 2 ) + f ( u 1 ) f ( u 2 ) g ( u 3 ) g ( u 4 ) − 2 f ( u 1 ) f ( u 2 ) g ( u 1 ) g ( u 3 ) ] = E [ ϕ ( σ ) ∣ f ] ,
where σ = ( f n , g n ′ , u i , u j , u ℓ , u p ) \sigma=(f_n,g_{n'},u_i,u_j,u_\ell,u_p) σ = ( f n , g n ′ , u i , u j , u ℓ , u p ) denotes a set of inputs to ϕ \phi ϕ , as in Appendix § 9 . The equality holds because the inputs are i.i.d., so the permutation average in eq. (24) does not change the expectation. Since f ( u ) − f ˉ f(u)-\bar{f} f ( u ) − f ˉ has zero mean over u u u , the centering terms of h ˉ \bar{h} h ˉ integrate against it to zero, so h h h may be replaced by h ˉ \bar{h} h ˉ :
E [ ϕ ( σ ) ∣ f ] = E u , u ′ [ ( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) h ˉ ( u , u ′ ) ] = ⟨ k ˉ f , h ˉ ⟩ , (58) \mathbb{E}[\phi(\sigma)\mid f]=\mathbb{E}_{u,u'}\left[(f(u)-\bar{f})(f(u')-\bar{f})\bar{h}(u,u')\right]=\langle\bar{k}_f,\bar{h}\rangle, \tag*{(58)} E [ ϕ ( σ ) ∣ f ] = E u , u ′ [ ( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) h ˉ ( u , u ′ ) ] = ⟨ k ˉ f , h ˉ ⟩ , (58)
where k ˉ f ( u , u ′ ) = ( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) \bar{k}_f(u,u')=(f(u)-\bar{f})(f(u')-\bar{f}) k ˉ f ( u , u ′ ) = ( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) is the rank-one centered kernel of the single neuron f f f . The same holds when the other neuron is drawn from any distribution, with h ˉ \bar{h} h ˉ replaced by that distribution’s centered kernel.
Turning to the CKD estimator, we use Σ = ( f n 1 , f n 2 , g n 1 ′ , g n 2 ′ , u i , u j , u ℓ , u p ) \Sigma=(f_{n_1},f_{n_2},g_{n'_1},g_{n'_2},u_i,u_j,u_\ell,u_p) Σ = ( f n 1 , f n 2 , g n 1 ′ , g n 2 ′ , u i , u j , u ℓ , u p ) to denote a set of inputs to the U-statistic kernel ψ \psi ψ , defined in eq. (50) . We write Σ \Sigma Σ and Σ ′ \Sigma' Σ ′ as a given pair of these inputs, analogous to how σ \sigma σ and σ ′ \sigma' σ ′ denote a pair of inputs to HSIC U-statistic kernel ϕ \phi ϕ .
Consider V 100 V_{100} V 100 , the covariance of ψ ( Σ ) \psi(\Sigma) ψ ( Σ ) and ψ ( Σ ′ ) \psi(\Sigma') ψ ( Σ ′ ) when they share exactly one F \mathcal{F} F -neuron f f f ; by eq. (34) , this equals Var f E [ ψ ( Σ ) ∣ f ] \operatorname{Var}_{f}\mathbb{E}[\psi(\Sigma)\mid f] Var f E [ ψ ( Σ ) ∣ f ] . We condition ψ \psi ψ on f f f and average over the remaining neurons and inputs, applying eq. (58) to each of the three terms of eq. (50) . The self-F \mathcal{F} F term projects onto k ˉ \bar{k} k ˉ (the population kernel of the second F \mathcal{F} F -neuron), the self-G \mathcal{G} G term does not involve f f f at all, and among the four cross terms only the two that contain f f f retain it:
E [ ψ ( Σ ) ∣ f ] = ⟨ k ˉ f , k ˉ ⟩ ⏟ ϕ ( f , f 2 ) + ⟨ h ˉ , h ˉ ⟩ ⏟ ϕ ( g 1 , g 2 ) − 1 2 ( 2 ⟨ k ˉ f , h ˉ ⟩ ⏟ f a = f + 2 ⟨ k ˉ , h ˉ ⟩ ⏟ f a = f 2 ) = ⟨ k ˉ f , k ˉ − h ˉ ⟩ + ⟨ h ˉ , h ˉ ⟩ − ⟨ k ˉ , h ˉ ⟩ = ⟨ k ˉ f , k ˉ − h ˉ ⟩ + const . (59) \begin{aligned}
\mathbb{E}[\psi(\Sigma)\mid f]
&=\underbrace{\langle\bar{k}_f,\bar{k}\rangle}_{\phi(f,f_2)}
+\underbrace{\langle\bar{h},\bar{h}\rangle}_{\phi(g_1,g_2)}
-\frac{1}{2}\left(2\underbrace{\langle\bar{k}_f,\bar{h}\rangle}_{f_a=f}+2\underbrace{\langle\bar{k},\bar{h}\rangle}_{f_a=f_2}\right) \\
&=\langle\bar{k}_f,\bar{k}-\bar{h}\rangle+\langle\bar{h},\bar{h}\rangle-\langle\bar{k},\bar{h}\rangle\\
&=\langle\bar{k}_f,\bar{k}-\bar{h}\rangle+\operatorname{const}. \tag*{(59)}
\end{aligned} E [ ψ ( Σ ) ∣ f ] = ϕ ( f , f 2 ) ⟨ k ˉ f , k ˉ ⟩ + ϕ ( g 1 , g 2 ) ⟨ h ˉ , h ˉ ⟩ − 2 1 2 f a = f ⟨ k ˉ f , h ˉ ⟩ + 2 f a = f 2 ⟨ k ˉ , h ˉ ⟩ = ⟨ k ˉ f , k ˉ − h ˉ ⟩ + ⟨ h ˉ , h ˉ ⟩ − ⟨ k ˉ , h ˉ ⟩ = ⟨ k ˉ f , k ˉ − h ˉ ⟩ + const . (59)
The terms constant in f f f do not affect the variance, leaving only the gap-dependent part. This projection is linear in k ˉ − h ˉ \bar{k}-\bar{h} k ˉ − h ˉ , so by Cauchy–Schwarz
V 100 = Var f [ ⟨ k ˉ f , k ˉ − h ˉ ⟩ ] ≤ E f [ ∥ k ˉ f ∥ 2 ] ∥ k ˉ − h ˉ ∥ 2 = E f [ ∥ k ˉ f ∥ 2 ] CKD 2 , (60) V_{100}=\operatorname{Var}_{f}\left[\langle\bar{k}_f,\bar{k}-\bar{h}\rangle\right]\leq\mathbb{E}_{f}\left[\|\bar{k}_f\|^2\right]\|\bar{k}-\bar{h}\|^2=\mathbb{E}_{f}\left[\|\bar{k}_f\|^2\right]\operatorname{CKD}^2, \tag*{(60)} V 100 = Var f [ ⟨ k ˉ f , k ˉ − h ˉ ⟩ ] ≤ E f [ ∥ k ˉ f ∥ 2 ] ∥ k ˉ − h ˉ ∥ 2 = E f [ ∥ k ˉ f ∥ 2 ] CKD 2 , (60)
and likewise for V 010 V_{010} V 010 with the roles of the F \mathcal{F} F - and G \mathcal{G} G -neurons exchanged. For a shared input, the three terms of ψ \psi ψ instead complete the square:
E [ ψ ( Σ ) ∣ u ] = 1 2 E u ′ [ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ] + const . (61) \mathbb{E}[\psi(\Sigma)\mid u]=\frac{1}{2}\mathbb{E}_{u'}\left[(\bar{k}-\bar{h})(u,u')^2\right]+\operatorname{const}. \tag*{(61)} E [ ψ ( Σ ) ∣ u ] = 2 1 E u ′ [ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ] + const . (61)
This is quadratic in k ˉ − h ˉ \bar{k}-\bar{h} k ˉ − h ˉ , so that V 001 = 1 4 Var u [ E u ′ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ] V_{001}=\frac{1}{4}\operatorname{Var}_{u}\left[\mathbb{E}_{u'}(\bar{k}-\bar{h})(u,u')^2\right] V 001 = 4 1 Var u [ E u ′ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ] .
We now bound each contribution explicitly in terms of the maximal fourth moment q q q of a neuron’s deviation from its own stimulus-averaged rate,
q = max { sup u E f [ ( f ( u ) − f ˉ ) 4 ] , sup u E g [ ( g ( u ) − g ˉ ) 4 ] } , (62) q=\max\left\{\sup_{u}\mathbb{E}_{f}\left[(f(u)-\bar{f})^4\right],\sup_{u}\mathbb{E}_{g}\left[(g(u)-\bar{g})^4\right]\right\}, \tag*{(62)} q = max { u sup E f [ ( f ( u ) − f ˉ ) 4 ] , u sup E g [ ( g ( u ) − g ˉ ) 4 ] } , (62)
where f ∼ F f\sim\mathcal{F} f ∼ F and g ∼ G g\sim\mathcal{G} g ∼ G . Note that these this is a moment about each neuron’s stimulus-averaged rate f ˉ \bar{f} f ˉ , not central moments across neurons. In the main text, we list several sufficient conditions under which q q q is finite. For example, bounded tuning functions or Lipschitz tuning functions and compactly-supported P P P suffice.
By eq. (60) , followed by Jensen’s inequality and the definition of q q q , we have
V 100 ≤ E f [ ( E u ( f ( u ) − f ˉ ) 2 ) 2 ] CKD 2 ≤ E u E f [ ( f ( u ) − f ˉ ) 4 ] CKD 2 ≤ q CKD 2 , V_{100}\leq\mathbb{E}_{f}\left[\left(\mathbb{E}_{u}(f(u)-\bar{f})^2\right)^2\right]\operatorname{CKD}^2\leq\mathbb{E}_{u}\mathbb{E}_{f}\left[(f(u)-\bar{f})^4\right]\operatorname{CKD}^2\leq q\operatorname{CKD}^2, V 100 ≤ E f [ ( E u ( f ( u ) − f ˉ ) 2 ) 2 ] CKD 2 ≤ E u E f [ ( f ( u ) − f ˉ ) 4 ] CKD 2 ≤ q CKD 2 ,
and likewise V 010 ≤ q CKD 2 V_{010}\leq q\operatorname{CKD}^2 V 010 ≤ q CKD 2 .
We next turn to the input collision term, V 001 V_{001} V 001 . Since k ˉ ( u , u ′ ) = E f [ ( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ ) ] \bar{k}(u,u')=\mathbb{E}_{f}[(f(u)-\bar{f})(f(u')-\bar{f})] k ˉ ( u , u ′ ) = E f [( f ( u ) − f ˉ ) ( f ( u ′ ) − f ˉ )] , Cauchy–Schwarz combined with the elementary inequality ( a − b ) 2 ≤ 2 a 2 + 2 b 2 (a-b)^2\leq2a^2+2b^2 ( a − b ) 2 ≤ 2 a 2 + 2 b 2 gives
( k ˉ − h ˉ ) ( u , u ′ ) 2 ≤ 2 k ˉ ( u , u ′ ) 2 + 2 h ˉ ( u , u ′ ) 2 ≤ 4 q (63) (\bar{k}-\bar{h})(u,u')^2\leq2\bar{k}(u,u')^2+2\bar{h}(u,u')^2\leq4q \tag*{(63)} ( k ˉ − h ˉ ) ( u , u ′ ) 2 ≤ 2 k ˉ ( u , u ′ ) 2 + 2 h ˉ ( u , u ′ ) 2 ≤ 4 q (63)
Therefore,
V 001 ≤ 1 4 E u [ ( E u ′ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ) 2 ] ≤ 1 4 ( sup u E u ′ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ) E u , u ′ [ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ] ≤ q CKD 2 . \begin{aligned}
V_{001}
&\leq\frac{1}{4}\mathbb{E}_{u}\left[\left(\mathbb{E}_{u'}(\bar{k}-\bar{h})(u,u')^2\right)^2\right] \\
&\leq\frac{1}{4}\left(\sup_{u}\mathbb{E}_{u'}(\bar{k}-\bar{h})(u,u')^2\right)\mathbb{E}_{u,u'}\left[(\bar{k}-\bar{h})(u,u')^2\right] \\
&\leq q\operatorname{CKD}^2.
\end{aligned} V 001 ≤ 4 1 E u [ ( E u ′ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ) 2 ] ≤ 4 1 ( u sup E u ′ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ) E u , u ′ [ ( k ˉ − h ˉ ) ( u , u ′ ) 2 ] ≤ q CKD 2 .
It remains to control the higher-order collision terms. As before, we use a crude bound. Recall that Var [ ψ ] = V 224 \operatorname{Var}[\psi]=V_{224} Var [ ψ ] = V 224 , the covariance of ψ ( Σ ) \psi(\Sigma) ψ ( Σ ) and ψ ( Σ ′ ) \psi(\Sigma') ψ ( Σ ′ ) when Σ = Σ ′ \Sigma=\Sigma' Σ = Σ ′ , is the maximal V α , β , γ V_{\alpha,\beta,\gamma} V α , β , γ term since conditioning on fewer shared arguments can only reduce the variance of the projection.
Here, we use a trick to evaluate the individual monomials of ϕ \phi ϕ using the stimulus-centered responses. To accomplish this, we provide the following lemma.
Lemma C.1 (shift invariance of ϕ \phi ϕ and ψ \psi ψ ). ϕ ( f + c , g ) = ϕ ( f , g ) \phi(f+c,g)=\phi(f,g) ϕ ( f + c , g ) = ϕ ( f , g ) , and by the symmetry of ϕ \phi ϕ the same holds for a shift of g g g . By definition of ψ \psi ψ , this holds for ψ \psi ψ as well.
Proof. To see the cancellation explicitly, replace f f f by f + c f+c f + c for a constant c c c . In each of the three monomials of eq. (24) , the f f f -pair expands as
( f ( u i ) + c ) ( f ( u j ) + c ) = f ( u i ) f ( u j ) + c f ( u i ) + c f ( u j ) + c 2 . (f(u_i)+c)(f(u_j)+c)=f(u_i)f(u_j)+cf(u_i)+cf(u_j)+c^2. ( f ( u i ) + c ) ( f ( u j ) + c ) = f ( u i ) f ( u j ) + c f ( u i ) + c f ( u j ) + c 2 .
The first piece reproduces ϕ ( f , g ) \phi(f,g) ϕ ( f , g ) that we know. We will show that the other three pieces vanish under the permutation average.
The c 2 c^2 c 2 terms. They are c 2 ( g ( u i ) g ( u j ) + g ( u ℓ ) g ( u p ) − 2 g ( u i ) g ( u ℓ ) ) c^2(g(u_i)g(u_j)+g(u_\ell)g(u_p)-2g(u_i)g(u_\ell)) c 2 ( g ( u i ) g ( u j ) + g ( u ℓ ) g ( u p ) − 2 g ( u i ) g ( u ℓ )) . Each of the three products is g g g evaluated at two distinct inputs. Cycling through all the possible pairs makes this argument vanish.
The terms linear in c c c . Each such product evaluates f f f at one input and g g g at two distinct inputs, and has one of two shapes. Either g g g takes two inputs different than f f f (e.g. g ( u p ) , g ( u q ) g(u_p),g(u_q) g ( u p ) , g ( u q ) ) or g g g shares one input with f f f . Write the first pattern as A A A , write the second pattern as B B B . The terms containing c f ( u i ) cf(u_i) c f ( u i ) are c ( f ( u i ) g ( u i ) g ( u j ) + f ( u i ) g ( u ℓ ) g ( u p ) − 2 f ( u i ) g ( u i ) g ( u ℓ ) ) c(f(u_i)g(u_i)g(u_j)+f(u_i)g(u_\ell)g(u_p)-2f(u_i)g(u_i)g(u_\ell)) c ( f ( u i ) g ( u i ) g ( u j ) + f ( u i ) g ( u ℓ ) g ( u p ) − 2 f ( u i ) g ( u i ) g ( u ℓ )) . This contributes a factor of c ( A + B − 2 A ) = c ( B − A ) c(A+B-2A)=c(B-A) c ( A + B − 2 A ) = c ( B − A ) . The terms containing c f ( u j ) cf(u_j) c f ( u j ) are c ( f ( u j ) g ( u i ) g ( u j ) + f ( u j ) g ( u ℓ ) g ( u p ) − 2 f ( u j ) g ( u i ) g ( u ℓ ) ) c(f(u_j)g(u_i)g(u_j)+f(u_j)g(u_\ell)g(u_p)-2f(u_j)g(u_i)g(u_\ell)) c ( f ( u j ) g ( u i ) g ( u j ) + f ( u j ) g ( u ℓ ) g ( u p ) − 2 f ( u j ) g ( u i ) g ( u ℓ )) . This contributes a factor of c ( A + B − 2 B ) = c ( A − B ) c(A+B-2B)=c(A-B) c ( A + B − 2 B ) = c ( A − B ) . Together, the two contributions cancel each other out, and the whole term vanishes.
We may therefore evaluate ψ \psi ψ on the stimulus-centered responses f − f ˉ f-\bar{f} f − f ˉ and g − g ˉ g-\bar{g} g − g ˉ . By abuse of notation, we denote these independent and centered neurons f , g f,g f , g as well. Thus, every summand of ϕ \phi ϕ in eq. (24) has the form f ( u i ) f ( u j ) g ( u ℓ ) g ( u p ) f(u_i)f(u_j)g(u_\ell)g(u_p) f ( u i ) f ( u j ) g ( u ℓ ) g ( u p ) for two independent and centered neurons f , g f,g f , g . This allows us to use the bound with respect to q q q .
Conditioning on the inputs, independence of f f f and g g g followed by Cauchy–Schwarz applied to each neuron separately gives
E [ f ( u i ) 2 f ( u j ) 2 g ( u ℓ ) 2 g ( u p ) 2 ] = E [ f ( u i ) 2 f ( u j ) 2 ] E [ g ( u ℓ ) 2 g ( u p ) 2 ] ≤ q ⋅ q = q 2 . (64) \mathbb{E}\left[f(u_i)^2f(u_j)^2g(u_\ell)^2g(u_p)^2\right]=\mathbb{E}\left[f(u_i)^2f(u_j)^2\right]\mathbb{E}\left[g(u_\ell)^2g(u_p)^2\right]\le q\cdot q=q^2. \tag*{(64)} E [ f ( u i ) 2 f ( u j ) 2 g ( u ℓ ) 2 g ( u p ) 2 ] = E [ f ( u i ) 2 f ( u j ) 2 ] E [ g ( u ℓ ) 2 g ( u p ) 2 ] ≤ q ⋅ q = q 2 . (64)
The triangle inequality over the permutation average and the coefficients ( 1 , 1 , − 2 ) (1,1,-2) ( 1 , 1 , − 2 ) then gives ∥ ϕ ( a , b , ⋅ ) ∥ 2 ≤ 4 q \|\phi(a,b,\cdot)\|_2\le4q ∥ ϕ ( a , b , ⋅ ) ∥ 2 ≤ 4 q . Hence, replacing the terms in eq. (50) ,
∥ ψ ∥ 2 ≤ 4 q + 4 q + 1 2 ⋅ 4 ⋅ 4 q = 16 q , \|\psi\|_2\le4q+4q+\frac{1}{2}\cdot4\cdot4q=16q, ∥ ψ ∥ 2 ≤ 4 q + 4 q + 2 1 ⋅ 4 ⋅ 4 q = 16 q ,
and thus V α β γ ≤ Var [ ψ ] ≤ 256 q 2 V_{\alpha\beta\gamma}\le\operatorname{Var}[\psi]\le256q^2 V α β γ ≤ Var [ ψ ] ≤ 256 q 2 .
We complete the bound by applying a counting argument on the higher order terms (i.e. Σ , Σ ′ \Sigma,\Sigma' Σ , Σ ′ pairs with at least two overlapping terms). For ease of notation, let ϵ : = 1 M + 1 N X + 1 N Y \epsilon:=\frac{1}{M}+\frac{1}{N_X}+\frac{1}{N_Y} ϵ := M 1 + N X 1 + N Y 1 . Next, let the number of overlapping terms be T ≥ 2 T\ge2 T ≥ 2 . Single-collision patterns occur with probability C ~ 100 ≤ 4 / N X \widetilde{C}_{100}\le4/N_X C 100 ≤ 4/ N X , C ~ 010 ≤ 4 / N Y \widetilde{C}_{010}\le4/N_Y C 010 ≤ 4/ N Y , and C ~ 001 ≤ 16 / M \widetilde{C}_{001}\le16/M C 001 ≤ 16/ M .
Next, note that a hypergeometric overlap of two size-δ \delta δ draws from P P P items has E [ X ( X − 1 ) ] = δ 2 ( δ − 1 ) 2 / ( P ( P − 1 ) ) ≤ 2 ( E X ) 2 \mathbb{E}[X(X-1)]=\delta^2(\delta-1)^2/(P(P-1))\le2(\mathbb{E}X)^2 E [ X ( X − 1 )] = δ 2 ( δ − 1 ) 2 / ( P ( P − 1 )) ≤ 2 ( E X ) 2 . In our case and 1 { T ≥ 2 } ≤ T ( T − 1 ) / 2 1\{T\ge2\}\le T(T-1)/2 1 { T ≥ 2 } ≤ T ( T − 1 ) /2 , this gives
Pr ( T ≥ 2 ) ≤ ( 4 N X + 4 N Y + 16 M ) 2 ≤ 256 ϵ 2 . \Pr(T\ge2)\le\left(\frac{4}{N_X}+\frac{4}{N_Y}+\frac{16}{M}\right)^2\le256\epsilon^2. Pr ( T ≥ 2 ) ≤ ( N X 4 + N Y 4 + M 16 ) 2 ≤ 256 ϵ 2 .
Combining these bounds,
Var [ C K D ^ 2 ] ≤ 4 N X V 100 + 4 N Y V 010 + 16 M V 001 + Pr ( T ≥ 2 ) Var [ ψ ] ≤ q C K D 2 ( 4 N X + 4 N Y + 16 M ) + 256 ϵ 2 ⋅ 256 q 2 \begin{aligned}
\operatorname{Var}[\widehat{\mathrm{CKD}}^2]\le\frac{4}{N_X}V_{100}+\frac{4}{N_Y}V_{010}+\frac{16}{M}V_{001}+\Pr(T\ge2)\operatorname{Var}[\psi] \\
&\le q\,\mathrm{CKD}^2\left(\frac{4}{N_X}+\frac{4}{N_Y}+\frac{16}{M}\right)+256\epsilon^2\cdot256q^2
\end{aligned} Var [ CKD 2 ] ≤ N X 4 V 100 + N Y 4 V 010 + M 16 V 001 + Pr ( T ≥ 2 ) Var [ ψ ] ≤ q CKD 2 ( N X 4 + N Y 4 + M 16 ) + 256 ϵ 2 ⋅ 256 q 2
≤ 16 q C K D 2 ϵ + 2 16 q 2 ϵ 2 . (65) \le16q\,\mathrm{CKD}^2\epsilon+2^{16}q^2\epsilon^2. \tag*{(65)} ≤ 16 q CKD 2 ϵ + 2 16 q 2 ϵ 2 . (65)
Each term is homogeneous of degree eight in the responses, since C K D 2 \mathrm{CKD}^2 CKD 2 scales as q q q . This implies eq. (14) with C = 2 16 max ( q , q 2 ) C=2^{16}\max(q,q^2) C = 2 16 max ( q , q 2 ) . The numerical constant 2 16 2^{16} 2 16 has not been optimized, and we expect the sharp constant to be considerably smaller.
Independent Trial-to-trial noise
In this section, we analyze how the U-statistic estimator of CKD2 ^2 2 behaves when neural responses are corrupted by trial-to-trial noise. Here, we assume that noise is independent across neurons and trials. In appendix E, we relax these assumptions to allow pairs of neurons to exhibit “noise correlations” from trial-to-trial.
In this appendix section, we show the following. First, we show that the estimator remains unbiased (Section D.2). Second, we show that the estimator’s variance is insensitive to first-order: the leading rate remains 1 / M + 1 / N X + 1 / N Y 1/M + 1/N_X + 1/N_Y 1/ M + 1/ N X + 1/ N Y and the constants V 001 V_{001} V 001 , V 010 V_{010} V 010 , and V 100 V_{100} V 100 that scale each term remain the same (Section D.3).
Sampling model with noise
We denote noise variables by ξ \xi ξ (system X) and ζ \zeta ζ (system Y). For a tuning curve f f f we write f ˉ : = E u [ f ( u ) ] \bar{f} := \mathbb{E}_u[f(u)] f ˉ := E u [ f ( u )] . Neurons and inputs are sampled as in § 2.1 : f 1 , … , f N X ∼ F f_1,\ldots,f_{N_X} \sim\mathcal{F} f 1 , … , f N X ∼ F , g 1 , … , g N Y ∼ G g_1,\ldots,g_{N_Y} \sim\mathcal{G} g 1 , … , g N Y ∼ G , and u 1 , … , u M ∼ P u_1,\ldots,u_M \sim\mathcal{P} u 1 , … , u M ∼ P , all independent. We collect these noiseless sampling variables into
D : = ( f 1 : N X , g 1 : N Y , u 1 : M ) . \mathcal{D} := (f_{1:N_X}, g_{1:N_Y}, u_{1:M}). D := ( f 1 : N X , g 1 : N Y , u 1 : M ) .
Each input is presented L ≥ 1 L \ge1 L ≥ 1 times. On repetition ℓ \ell ℓ we observe
X n i ℓ = f n ( u i ) + ξ n i ℓ , Y n i ℓ = g n ( u i ) + ζ n i ℓ . (66) X_{ni\ell} = f_n(u_i) + \xi_{ni\ell}, \qquad Y_{ni\ell} = g_n(u_i) + \zeta_{ni\ell}. \tag*{(66)} X ni ℓ = f n ( u i ) + ξ ni ℓ , Y ni ℓ = g n ( u i ) + ζ ni ℓ . (66)
We make the following assumptions.
(N1) Conditional mean zero noise. E [ ξ n i ℓ ∣ D ] = 0 \mathbb{E}[\xi_{ni\ell} \mid\mathcal{D}] = 0 E [ ξ ni ℓ ∣ D ] = 0 and E [ ζ n i ℓ ∣ D ] = 0 \mathbb{E}[\zeta_{ni\ell} \mid\mathcal{D}] = 0 E [ ζ ni ℓ ∣ D ] = 0 .
(N2) Noise has bounded fourth moments. We assume E [ ξ n i ℓ 4 ∣ D ] \mathbb{E}[\xi_{ni\ell}^{4} \mid\mathcal{D}] E [ ξ ni ℓ 4 ∣ D ] and E [ ζ n i ℓ 4 ∣ D ] \mathbb{E}[\zeta_{ni\ell}^{4} \mid\mathcal{D}] E [ ζ ni ℓ 4 ∣ D ] are uniformly upper bounded by a finite constant for all neurons and possible network inputs.
(N3) Conditional independence. Conditional on D \mathcal{D} D , all noise variables { ξ n i ℓ } \{\xi_{ni\ell}\} { ξ ni ℓ } and { ζ n i ℓ } \{\zeta_{ni\ell}\} { ζ ni ℓ } are mutually independent across neurons, inputs, repetitions, and systems. Moreover, the conditional law of ξ n i ℓ \xi_{ni\ell} ξ ni ℓ depends on D \mathcal{D} D only through ( f n , u i ) (f_n,u_i) ( f n , u i ) , and likewise for ζ n i ℓ \zeta_{ni\ell} ζ ni ℓ through ( g n , u i ) (g_n,u_i) ( g n , u i ) .
Heteroscedastic noise is allowed, so long as the fourth moments are uniformly bounded. The estimator is computed from trial-averaged responses
X ˉ n i : = 1 L ∑ ℓ = 1 L X n i ℓ = f n ( u i ) + ξ ˉ n i , Y ˉ n i : = 1 L ∑ ℓ = 1 L Y n i ℓ = g n ( u i ) + ζ ˉ n i . (67) \bar{X}_{ni} := \frac{1}{L}\sum_{\ell=1}^{L} X_{ni\ell} = f_n(u_i) + \bar{\xi}_{ni}, \qquad\bar{Y}_{ni} := \frac{1}{L}\sum_{\ell=1}^{L} Y_{ni\ell} = g_n(u_i) + \bar{\zeta}_{ni}. \tag*{(67)} X ˉ ni := L 1 ℓ = 1 ∑ L X ni ℓ = f n ( u i ) + ξ ˉ ni , Y ˉ ni := L 1 ℓ = 1 ∑ L Y ni ℓ = g n ( u i ) + ζ ˉ ni . (67)
The averaged noise terms ξ ˉ n i \bar{\xi}_{ni} ξ ˉ ni and ζ ˉ n i \bar{\zeta}_{ni} ζ ˉ ni satisfy (N1)–(N2) with the variance reduced by a multiplicative factor of 1 / L 1/L 1/ L .
The U-statistic estimator remains unbiased under independent noise
Recall from Appendix B and Appendix C that,
ϕ ( f , g ; u 1 : 4 ) = 1 4 ! ∑ π ∈ S 4 [ f ( u π 1 ) f ( u π 2 ) g ( u π 1 ) g ( u π 2 ) + f ( u π 1 ) f ( u π 2 ) g ( u π 3 ) g ( u π 4 ) − 2 f ( u π 1 ) f ( u π 2 ) g ( u π 1 ) g ( u π 3 ) ] . (68) \phi(f,g;u_{1:4}) = \frac{1}{4!}\sum_{\pi\in S_4}\left[
f(u_{\pi_1})f(u_{\pi_2})g(u_{\pi_1})g(u_{\pi_2})
+ f(u_{\pi_1})f(u_{\pi_2})g(u_{\pi_3})g(u_{\pi_4})
- 2f(u_{\pi_1})f(u_{\pi_2})g(u_{\pi_1})g(u_{\pi_3})
\right]. \tag*{(68)} ϕ ( f , g ; u 1 : 4 ) = 4 ! 1 π ∈ S 4 ∑ [ f ( u π 1 ) f ( u π 2 ) g ( u π 1 ) g ( u π 2 ) + f ( u π 1 ) f ( u π 2 ) g ( u π 3 ) g ( u π 4 ) − 2 f ( u π 1 ) f ( u π 2 ) g ( u π 1 ) g ( u π 3 ) ] . (68)
ψ ( f 1 , f 2 , g 1 , g 2 ; u 1 : 4 ) = ϕ ( f 1 , f 2 ; u 1 : 4 ) + ϕ ( g 1 , g 2 ; u 1 : 4 ) − 1 2 ∑ a = 1 2 ∑ b = 1 2 ϕ ( f a , g b ; u 1 : 4 ) . (69) \psi(f_1,f_2,g_1,g_2;u_{1:4}) = \phi(f_1,f_2;u_{1:4}) + \phi(g_1,g_2;u_{1:4}) - \frac{1}{2}\sum_{a=1}^{2}\sum_{b=1}^{2}\phi(f_a,g_b;u_{1:4}). \tag*{(69)} ψ ( f 1 , f 2 , g 1 , g 2 ; u 1 : 4 ) = ϕ ( f 1 , f 2 ; u 1 : 4 ) + ϕ ( g 1 , g 2 ; u 1 : 4 ) − 2 1 a = 1 ∑ 2 b = 1 ∑ 2 ϕ ( f a , g b ; u 1 : 4 ) . (69)
and C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 averages ψ \psi ψ over all index tuples
Σ = ( n 1 < n 2 ; n 1 ′ < n 2 ′ ; i 1 < i 2 < i 3 < i 4 ) . \Sigma= (n_1 < n_2;\ n'_1 < n'_2;\ i_1 < i_2 < i_3 < i_4). Σ = ( n 1 < n 2 ; n 1 ′ < n 2 ′ ; i 1 < i 2 < i 3 < i 4 ) .
With noisy data, ψ \psi ψ is evaluated on observed entries. That is, each f n ( u i ) f_n(u_i) f n ( u i ) is replaced by X ˉ n i \bar{X}_{ni} X ˉ ni and each g n ( u i ) g_n(u_i) g n ( u i ) by Y ˉ n i \bar{Y}_{ni} Y ˉ ni . In this appendix section, we write C K D ^ a v g 2 \widehat{\mathrm{CKD}}^2_{\mathrm{avg}} CKD avg 2 to denote this estimator. As before, we use C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 to denote the “noise-free” estimator that we previously analyzed in Appendix C and which is our primary focus in the main text. In the context of this appendix section, C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 can be viewed as idealized estimator that has direct access to the neural tuning functions.
Proposition D.1 (Unbiasedness under decorrelated noise). Assume (N1) and (N3) and the moment conditions of Theorem 3.1 . Then for every L ≥ 1 L \ge1 L ≥ 1 ,
E [ C K D ^ a v g 2 ∣ D ] = C K D ^ 2 , and hence E [ C K D ^ a v g 2 ] = C K D 2 . (70) \mathbb{E}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\mid\mathcal{D}\right]=\widehat{\mathrm{CKD}}^{2},\qquad\text{and hence}\qquad\mathbb{E}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\right]=\mathrm{CKD}^{2}. \tag*{(70)} E [ CKD avg 2 ∣ D ] = CKD 2 , and hence E [ CKD avg 2 ] = CKD 2 . (70) Proof. Applying iterated expectations, E [ C K D ^ a v g 2 ] = E D [ E ξ , ζ [ C K D ^ a v g 2 ∣ D ] ] \mathbb{E}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\right]=\mathbb{E}_{\mathcal{D}}\left[\mathbb{E}_{\xi,\zeta}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\mid\mathcal{D}\right]\right] E [ CKD avg 2 ] = E D [ E ξ , ζ [ CKD avg 2 ∣ D ] ] , with the inner expectation averaging over the noise terms.
Conditional on D \mathcal{D} D , the averaged noise terms are independent and mean zero by (N1)–(N2). Expanding each response into signal plus noise, every term that contains a noise variable contains it only once, and so has conditional mean zero. Hence, every term averages like:
E [ X ‾ n 1 i 1 X ‾ n 1 i 2 Y ‾ n 2 i 1 Y ‾ n 2 i 2 + X ‾ n 1 i 1 X ‾ n 1 i 2 Y ‾ n 2 i 3 Y ‾ n 2 i 4 − 2 X ‾ n 1 i 1 X ‾ n 1 i 2 Y ‾ n 2 i 1 Y ‾ n 2 i 3 | D ] = f n 1 ( u i 1 ) f n 1 ( u i 2 ) g n 2 ( u 1 ) g n 2 ( u 2 ) + f n 1 ( u 1 ) f n 1 ( u 2 ) g n 2 ( u 3 ) g n 2 ( u 4 ) − 2 f n 1 ( u 1 ) f n 1 ( u 2 ) g n 2 ( u 1 ) g n 2 ( u 3 ) . \mathbb{E}\left[
\begin{array}{l}
\overline{X}_{n_1i_1}\overline{X}_{n_1i_2}\overline{Y}_{n_2i_1}\overline{Y}_{n_2i_2}\\
+\overline{X}_{n_1i_1}\overline{X}_{n_1i_2}\overline{Y}_{n_2i_3}\overline{Y}_{n_2i_4}\\
-2\overline{X}_{n_1i_1}\overline{X}_{n_1i_2}\overline{Y}_{n_2i_1}\overline{Y}_{n_2i_3}
\end{array}
\middle|\mathcal{D}\right]
=
\begin{array}{l}
f_{n_1}(u_{i_1})f_{n_1}(u_{i_2})g_{n_2}(u_1)g_{n_2}(u_2)\\
+f_{n_1}(u_1)f_{n_1}(u_2)g_{n_2}(u_3)g_{n_2}(u_4)\\
-2f_{n_1}(u_1)f_{n_1}(u_2)g_{n_2}(u_1)g_{n_2}(u_3).
\end{array} E X n 1 i 1 X n 1 i 2 Y n 2 i 1 Y n 2 i 2 + X n 1 i 1 X n 1 i 2 Y n 2 i 3 Y n 2 i 4 − 2 X n 1 i 1 X n 1 i 2 Y n 2 i 1 Y n 2 i 3 D = f n 1 ( u i 1 ) f n 1 ( u i 2 ) g n 2 ( u 1 ) g n 2 ( u 2 ) + f n 1 ( u 1 ) f n 1 ( u 2 ) g n 2 ( u 3 ) g n 2 ( u 4 ) − 2 f n 1 ( u 1 ) f n 1 ( u 2 ) g n 2 ( u 1 ) g n 2 ( u 3 ) . including for the self-terms since the noise is assumed independent across neurons and the self-term estimator only touches distinct neuron pairs. Thus, the inner expectation evaluates to E ξ , ζ [ C K D ^ a v g 2 ∣ D ] = C K D ^ 2 \mathbb{E}_{\xi,\zeta}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\mid\mathcal{D}\right]=\widehat{\mathrm{CKD}}^{2} E ξ , ζ [ CKD avg 2 ∣ D ] = CKD 2 and the estimator is remains unbiased as claimed.
The variance of the U-statistic estimator is insensitive to noise to first-order Recall from Appendix C that two index tuples Σ \Sigma Σ and Σ ′ \Sigma' Σ ′ have collision pattern ( α , β , γ ) (\alpha,\beta,\gamma) ( α , β , γ ) when they share α \alpha α F F F -neurons, β \beta β G G G -neurons, and γ \gamma γ inputs. After incorporating noise, we need to additionally account for collisions over neuron-input pairs. For example, suppose Σ \Sigma Σ and Σ ′ \Sigma' Σ ′ both contain the F F F -neuron f 1 f_1 f 1 and both contain the input u 2 u_2 u 2 . Then the noisy response X ‾ 12 \overline{X}_{12} X 12 enters both ψ ( Σ ) \psi(\Sigma) ψ ( Σ ) and ψ ( Σ ′ ) \psi(\Sigma') ψ ( Σ ′ ) , and its noise is a source of covariance between them. If instead the two tuples share f 1 f_1 f 1 but no input, or share u 2 u_2 u 2 but no F F F -neuron, then the two kernels are evaluated on disjoint sets of noisy responses, so the noise contributes nothing.
Accordingly, we now read Σ \Sigma Σ as the full collection of random variables that ψ ( Σ ) \psi(\Sigma) ψ ( Σ ) depends on: its neurons, its inputs, and the averaged noise of its sixteen neuron-input pairs. Under this reading, Σ ∩ Σ ′ \Sigma\cap\Sigma' Σ ∩ Σ ′ consists of the shared neurons, the shared inputs, and the noise of the shared neuron-input pairs, and our prior bound holds verbatim. To distinguish the two, we write
V α β γ a v g : = Var ( E [ ψ ( Σ ) ∣ Σ ∩ Σ ′ ] ) , (71) V_{\alpha\beta\gamma}^{\mathrm{avg}}:=\operatorname{Var}\left(\mathbb{E}\left[\psi(\Sigma)\mid\Sigma\cap\Sigma'\right]\right), \tag*{(71)} V α β γ avg := Var ( E [ ψ ( Σ ) ∣ Σ ∩ Σ ′ ] ) , (71) to denote the variance terms for C K D ^ a v g 2 \widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2} CKD avg 2 .
Collision probabilities depend only on the index tuples, not on the noise. As before,
Var [ C K D ^ a v g 2 ] = ∑ α , β , γ C ~ α β γ V α β γ a v g , (72) \operatorname{Var}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\right]=\sum_{\alpha,\beta,\gamma}\widetilde{C}_{\alpha\beta\gamma}V_{\alpha\beta\gamma}^{\mathrm{avg}}, \tag*{(72)} Var [ CKD avg 2 ] = α , β , γ ∑ C α β γ V α β γ avg , (72) with the same hypergeometric weights C ~ α β γ \widetilde{C}_{\alpha\beta\gamma} C α β γ .
In Appendix § 9 and Appendix C, we previously saw that the constants V 001 V_{001} V 001 , V 010 V_{010} V 010 , and V 100 V_{100} V 100 describe the estimator’s variance to first-order, and that these terms asymptotically dominate in the large-sample limit. Here we show that these deterministic constants are insensitive to the trial-to-trial noise.
Proposition D.2 (Noise does not affect the first-order constants). Assume (N1)–(N3). If a collision pattern ( α , β , γ ) (\alpha,\beta,\gamma) ( α , β , γ ) has no shared neuron-input pairs, that is if α + β = 0 \alpha+\beta=0 α + β = 0 or γ = 0 \gamma=0 γ = 0 , then
V α β γ a v g = V α β γ . V_{\alpha\beta\gamma}^{\mathrm{avg}}=V_{\alpha\beta\gamma}. V α β γ avg = V α β γ . In particular, this holds for the three first-order patterns,
V 100 a v g = V 100 , V 010 a v g = V 010 , V 001 a v g = V 001 , V_{100}^{\mathrm{avg}}=V_{100},\qquad V_{010}^{\mathrm{avg}}=V_{010},\qquad V_{001}^{\mathrm{avg}}=V_{001}, V 100 avg = V 100 , V 010 avg = V 010 , V 001 avg = V 001 , as well as for V 000 a v g = V 000 = 0 V_{000}^{\mathrm{avg}}=V_{000}=0 V 000 avg = V 000 = 0 . For every other pattern, V α β γ a v g > V α β γ V_{\alpha\beta\gamma}^{\mathrm{avg}}>V_{\alpha\beta\gamma} V α β γ avg > V α β γ .
Proof. Write A A A for the index part of the overlap, namely the shared neurons and shared inputs, so that Σ ∩ Σ ′ \Sigma\cap\Sigma' Σ ∩ Σ ′ consists of A A A together with the noise of the shared neuron-input pairs. By the law of total variance,
V α β γ a v g = Var ( E [ ψ ( Σ ) ∣ A ] ) + E [ Var ( E [ ψ ( Σ ) ∣ Σ ∩ Σ ′ ] ∣ A ) ] . (73) V^{\mathrm{avg}}_{\alpha\beta\gamma}=\operatorname{Var}\left(\mathbb{E}\left[\psi(\Sigma)\mid A\right]\right)+\mathbb{E}\left[\operatorname{Var}\left(\mathbb{E}\left[\psi(\Sigma)\mid\Sigma\cap\Sigma'\right]\mid A\right)\right]. \tag*{(73)} V α β γ avg = Var ( E [ ψ ( Σ ) ∣ A ] ) + E [ Var ( E [ ψ ( Σ ) ∣ Σ ∩ Σ ′ ] ∣ A ) ] . (73)
Consider the first term. Since A A A contains no noise variables, the expectation conditioned on A A A averages over all of the noise. Hence, by Proposition D.1, E [ ψ ( Σ ) ∣ A ] \mathbb{E}[\psi(\Sigma)\mid A] E [ ψ ( Σ ) ∣ A ] returns the kernel evaluated on noiseless responses, and the variance of this quantity is precisely what we defined as V α β γ V_{\alpha\beta\gamma} V α β γ . The second term of eq. (73) is nonnegative, which gives the final claim.
Now suppose the pattern has no shared neuron-input pairs. Then Σ ∩ Σ ′ = A \Sigma\cap\Sigma'=A Σ ∩ Σ ′ = A , so the inner conditional expectation in the second term is a function of A A A alone. Conditioning on A A A leaves it constant, so its conditional variance is zero and the term vanishes. A neuron-input pair is shared only if its neuron and its input are both shared, so the number of shared pairs is α γ \alpha\gamma α γ in system X X X and β γ \beta\gamma β γ in system Y Y Y . Both vanish when α + β = 0 \alpha+\beta=0 α + β = 0 or γ = 0 \gamma=0 γ = 0 , which covers ( 1 , 0 , 0 ) (1,0,0) ( 1 , 0 , 0 ) , ( 0 , 1 , 0 ) (0,1,0) ( 0 , 1 , 0 ) , ( 0 , 0 , 1 ) (0,0,1) ( 0 , 0 , 1 ) , and ( 0 , 0 , 0 ) (0,0,0) ( 0 , 0 , 0 ) . □
The variance bound carries over under noise
Under (N1)–(N3), the proof of Theorem 3.1 carries over with minimal modifications. Proposition D.2 above already established this and showed that the first-order terms in the expansion Var [ C K D ^ 2 ] \operatorname{Var}[\widehat{\mathrm{CKD}}^{2}] Var [ CKD 2 ] are unaffected by decorrelated noise. Thus, the only step that changes is the bound on Var [ ψ ] \operatorname{Var}[\psi] Var [ ψ ] that controls the higher-order collisions. That argument uses only the offset invariance of ϕ \phi ϕ (lemma C.1), the conditional independence of the two neurons given the inputs (which (N3) preserves), and a bound on the fourth moments of the responses. Applying lemma C.1 with the noiseless offsets f ˉ \bar{f} f ˉ and g ˉ \bar{g} g ˉ , the relevant responses are f ( u ) − f ˉ + ξ ˉ f(u)-\bar{f}+\bar{\xi} f ( u ) − f ˉ + ξ ˉ and g ( u ) − g ˉ + ζ ˉ g(u)-\bar{g}+\bar{\zeta} g ( u ) − g ˉ + ζ ˉ , where ξ ˉ \bar{\xi} ξ ˉ and ζ ˉ \bar{\zeta} ζ ˉ denote the trial-averaged noise of a neuron at input u u u . We therefore replace q q q with
q ~ = max { sup u E [ ( f ( u ) − f ˉ + ξ ˉ ) 4 ∣ u ] , sup u E [ ( g ( u ) − g ˉ + ζ ˉ ) 4 ∣ u ] } . (74) \widetilde{q}=\max\left\{\sup_u\mathbb{E}\left[(f(u)-\bar{f}+\bar{\xi})^4\mid u\right],\sup_u\mathbb{E}\left[(g(u)-\bar{g}+\bar{\zeta})^4\mid u\right]\right\}. \tag*{(74)} q = max { u sup E [ ( f ( u ) − f ˉ + ξ ˉ ) 4 ∣ u ] , u sup E [ ( g ( u ) − g ˉ + ζ ˉ ) 4 ∣ u ] } . (74)
where the expectations are jointly taken over a randomly sampled neuron and its trial-averaged noise. Assumption (N2) and the elementary inequality ( a + b ) 4 ≤ 8 a 4 + 8 b 4 (a+b)^4\leq8a^4+8b^4 ( a + b ) 4 ≤ 8 a 4 + 8 b 4 are enough to establish that q ~ \widetilde{q} q is finite. Intuitively, q ~ \widetilde{q} q is controlled by the sum of the fourth moments of the centered tuning curve, f ( u ) − f ˉ f(u)-\bar{f} f ( u ) − f ˉ , and of the trial-averaged noise, ξ ˉ \bar{\xi} ξ ˉ , with the latter shrinking as the number of repetitions L L L grows.
Correlated trial-to-trial noise
Here, we further extend the analysis in Appendix D to cover cases where simultaneously measured neurons share fluctuations or “noise correlations” from trial-to-trial. In this section, we only assume that distinct repeated stimulus presentations have variability that is independent. We show the following.
The estimator C K D ^ a v g 2 \widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2} CKD avg 2 , that we introduced in Appendix D, produces a biased result when noise is correlated across neurons. For L L L trials per stimuli, this bias decays as 1 / L 1/L 1/ L in the number of repetitions L L L . Notably, this bias does not decay with the number of neurons or stimuli (Section E.2).
We construct an alternative estimator, C K D ^ s p l i t 2 \widehat{\mathrm{CKD}}_{\mathrm{split}}^{2} CKD split 2 , that requires only two trials per stimuli for full debiasing of correlated noise (Section E.3).
The variance of this new estimator still scales at the 1 / M + 1 / N X + 1 / N Y 1/M+1/N_X+1/N_Y 1/ M + 1/ N X + 1/ N Y rate, and the only constant that changes is the coefficient of the 1 / M 1/M 1/ M term (??).
Sampling model with correlated noise
We consider the same data generating process described in section D.1, but modify assumption (N3) to the following: (C3) Independent trials, arbitrary correlations within a trial. Conditional on D \mathcal{D} D , the vectors { ν i ℓ } i ≤ M , ℓ ≤ L \{\nu_{i\ell}\}_{i\le M,\ \ell\le L} { ν i ℓ } i ≤ M , ℓ ≤ L are independent. Within a trial, ν i ℓ \nu_{i\ell} ν i ℓ may have any dependence structure, across neurons of the same system and across the two systems.
Note that assumption (N3) of Appendix D is the special case of (C3) in which the coordinates of ν i ℓ \nu_{i\ell} ν i ℓ are themselves independent. Our relaxation in (C3) allows, for instance, shared gain fluctuations, shared additive fluctuations (e.g. arousal or brain state), and noise correlations whose structure depends on the neurons’ tuning. The relaxation also accounts for cases where neuronal response noise is correlated across systems (e.g. when two brain areas are simultaneously recorded in the same animal) and for input-dependent, heteroskedastic noise correlations. We exclude cases where noise correlations are dependent on the noise structure of previous trials as well as cases where neural tuning drifts between trials.
The standard estimator is biased under correlated noise
In Appendix D, unbiasedness followed from the fact that every noise variable enters each monomial of ϕ \phi ϕ at most once. With correlated noise this argument fails: when two neural responses are measured on the same trial, the product of their noise terms has nonzero mean. The following lemma quantifies the resulting bias in ϕ \phi ϕ :
Lemma E.1. Fix two distinct neurons with tuning curves f f f and g g g . Let f ( u i ) + ξ i f(u_i)+\xi_i f ( u i ) + ξ i and g ( u i ) + ζ i g(u_i)+\zeta_i g ( u i ) + ζ i be their responses on the same trial of input u i u_i u i . Then
E [ ϕ ( f + ξ , g + ζ ; u 1 : 4 ) ∣ f , g ] = ( Cov u ( f ( u ) , g ( u ) ) + E [ ξ i ζ i ∣ f , g ] ) 2 . \mathbb{E}\left[\phi(f+\xi,g+\zeta;u_{1:4})\mid f,g\right]
=\left(\operatorname{Cov}_{u}\left(f(u),g(u)\right)+\mathbb{E}\left[\xi_i\zeta_i\mid f,g\right]\right)^2. E [ ϕ ( f + ξ , g + ζ ; u 1 : 4 ) ∣ f , g ] = ( Cov u ( f ( u ) , g ( u ) ) + E [ ξ i ζ i ∣ f , g ] ) 2 . This holds regardless of whether neurons are recorded from the same system (e.g., f , g ∼ F f,g\sim\mathcal{F} f , g ∼ F ) or from different systems (f ∼ F , g ∼ G f\sim\mathcal{F}, g\sim\mathcal{G} f ∼ F , g ∼ G ).
Proof. Conditioning on f f f and g g g leaves u 1 : 4 u_{1:4} u 1 : 4 i.i.d. from P P P . Recall that every monomial of ϕ \phi ϕ has the form f ( u i ) f ( u j ) g ( u k ) g ( u l ) f(u_i)f(u_j)g(u_k)g(u_l) f ( u i ) f ( u j ) g ( u k ) g ( u l ) with i ≠ j i\ne j i = j and k ≠ l k\ne l k = l . Responses at distinct inputs lie on distinct trials, so by (C3) their noise terms are conditionally independent given D \mathcal{D} D , and by (N1) each has conditional mean zero. Expanding each response into signal plus noise, every term containing a noise factor that is not paired with a noise factor at the same input therefore vanishes. The only surviving noise terms are ξ i ζ i \xi_i\zeta_i ξ i ζ i , arising when f f f and g g g are evaluated at the same input u i u_i u i . Hence each such pair contributes f ( u i ) g ( u i ) + ξ i ζ i f(u_i)g(u_i)+\xi_i\zeta_i f ( u i ) g ( u i ) + ξ i ζ i . Since pairs at distinct inputs are independent and identically distributed given f f f and g g g , averaging over the inputs and the noise, the three monomial types of ϕ \phi ϕ give
f ( u i ) f ( u j ) g ( u i ) g ( u j ) ⟶ ( E u [ f ( u ) g ( u ) ] + E [ ξ i ζ i ∣ f , g ] ) 2 , f(u_i)f(u_j)g(u_i)g(u_j)\longrightarrow\left(\mathbb{E}_{u}[f(u)g(u)]+\mathbb{E}[\xi_i\zeta_i\mid f,g]\right)^2, f ( u i ) f ( u j ) g ( u i ) g ( u j ) ⟶ ( E u [ f ( u ) g ( u )] + E [ ξ i ζ i ∣ f , g ] ) 2 ,
f ( u i ) f ( u j ) g ( u l ) g ( u p ) ⟶ f ˉ 2 g ˉ 2 , f(u_i)f(u_j)g(u_l)g(u_p)\longrightarrow\bar{f}^{\,2}\bar{g}^{\,2}, f ( u i ) f ( u j ) g ( u l ) g ( u p ) ⟶ f ˉ 2 g ˉ 2 ,
f ( u i ) f ( u i ) g ( u i ) g ( u l ) ⟶ ( E u [ f ( u ) g ( u ) ] + E [ ξ i ζ i ∣ f , g ] ) f ˉ g ˉ . f(u_i)f(u_i)g(u_i)g(u_l)\longrightarrow\left(\mathbb{E}_{u}[f(u)g(u)]+\mathbb{E}[\xi_i\zeta_i\mid f,g]\right)\bar{f}\,\bar{g}. f ( u i ) f ( u i ) g ( u i ) g ( u l ) ⟶ ( E u [ f ( u ) g ( u )] + E [ ξ i ζ i ∣ f , g ] ) f ˉ g ˉ .
Combining these with coefficients ( 1 , 1 , − 2 ) (1,1,-2) ( 1 , 1 , − 2 ) gives
( E u [ f ( u ) g ( u ) ] + E [ ξ i ζ i ∣ f , g ] − f ˉ g ˉ ) 2 = ( Cov u ( f ( u ) , g ( u ) ) + E [ ξ i ζ i ∣ f , g ] ) 2 . \left(\mathbb{E}_{u}[f(u)g(u)]+\mathbb{E}[\xi_i\zeta_i\mid f,g]-\bar{f}\,\bar{g}\right)^2
=
\left(\operatorname{Cov}_{u}(f(u),g(u))+\mathbb{E}[\xi_i\zeta_i\mid f,g]\right)^2. ( E u [ f ( u ) g ( u )] + E [ ξ i ζ i ∣ f , g ] − f ˉ g ˉ ) 2 = ( Cov u ( f ( u ) , g ( u )) + E [ ξ i ζ i ∣ f , g ] ) 2 .
\hfill □ \square □
Now let C K D ^ a v g 2 \widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2} CKD avg 2 denote the standard estimator of eq. (13) computed on the trial-averaged responses X ˉ n i \bar{X}_{ni} X ˉ ni and Y ˉ n i \bar{Y}_{ni} Y ˉ ni . Trial-averaging reduces the effect of correlated noise by a factor of L L L : since distinct trials are independent with mean-zero noise, only the L L L pairs of noise terms on a common trial survive, so E [ ξ ˉ i ζ ˉ i ∣ f , g ] = E [ ξ i ζ i ∣ f , g ] / L \mathbb{E}[\bar{\xi}_i\bar{\zeta}_i\mid f,g]=\mathbb{E}[\xi_i\zeta_i\mid f,g]/L E [ ξ ˉ i ζ ˉ i ∣ f , g ] = E [ ξ i ζ i ∣ f , g ] / L . The kernel ψ \psi ψ of C K D ^ a v g 2 \widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2} CKD avg 2 is a combination of ϕ \phi ϕ terms, so applying lemma E.1 to the pairs ( f , f ′ ) (f,f') ( f , f ′ ) , ( g , g ′ ) (g,g') ( g , g ′ ) , and ( f , g ) (f,g) ( f , g ) appearing in ψ \psi ψ gives the following.
Corollary E.1. Under (N1)–(N2) and (C3),
E [ C K D ^ a v g 2 ] = C K D 2 + 2 L b 1 + 1 L 2 b 2 , \mathbb{E}\left[\widehat{\mathrm{CKD}}_{\mathrm{avg}}^{2}\right]
=\mathrm{CKD}^{2}+\frac{2}{L}b_1+\frac{1}{L^2}b_2, E [ CKD avg 2 ] = CKD 2 + L 2 b 1 + L 2 1 b 2 ,
where, with f , f ′ ∼ F f, f' \sim\mathcal{F} f , f ′ ∼ F and g , g ′ ∼ G g, g' \sim\mathcal{G} g , g ′ ∼ G independent and ξ , ξ ′ , ζ , ζ ′ \xi, \xi', \zeta, \zeta' ξ , ξ ′ , ζ , ζ ′ denoting their respective noise on a common trial,
b 1 = E [ Cov u ( f ( u ) , f ′ ( u ) ) E [ ξ i ξ i ′ ∣ f , f ′ ] ] + E [ Cov u ( g ( u ) , g ′ ( u ) ) E [ ζ i ζ i ′ ∣ g , g ′ ] ] − 2 E [ Cov u ( f ( u ) , g ( u ) ) E [ ξ i ζ i ∣ f , g ] ] , b_1 = \mathbb{E}\left[\operatorname{Cov}_u(f(u),f'(u))\mathbb{E}[\xi_i\xi'_i \mid f,f']\right] + \mathbb{E}\left[\operatorname{Cov}_u(g(u),g'(u))\mathbb{E}[\zeta_i\zeta'_i \mid g,g']\right] - 2\mathbb{E}\left[\operatorname{Cov}_u(f(u),g(u))\mathbb{E}[\xi_i\zeta_i \mid f,g]\right], b 1 = E [ Cov u ( f ( u ) , f ′ ( u )) E [ ξ i ξ i ′ ∣ f , f ′ ] ] + E [ Cov u ( g ( u ) , g ′ ( u )) E [ ζ i ζ i ′ ∣ g , g ′ ] ] − 2 E [ Cov u ( f ( u ) , g ( u )) E [ ξ i ζ i ∣ f , g ] ] ,
b 2 = E [ E [ ξ i ξ i ′ ∣ f , f ′ ] 2 ] + E [ E [ ζ i ζ i ′ ∣ g , g ′ ] 2 ] − 2 E [ E [ ξ i ζ i ∣ f , g ] 2 ] . b_2 = \mathbb{E}\left[\mathbb{E}[\xi_i\xi'_i \mid f,f']^2\right] + \mathbb{E}\left[\mathbb{E}[\zeta_i\zeta'_i \mid g,g']^2\right] - 2\mathbb{E}\left[\mathbb{E}[\xi_i\zeta_i \mid f,g]^2\right]. b 2 = E [ E [ ξ i ξ i ′ ∣ f , f ′ ] 2 ] + E [ E [ ζ i ζ i ′ ∣ g , g ′ ] 2 ] − 2 E [ E [ ξ i ζ i ∣ f , g ] 2 ] .
Proof. By eq. (69) , E [ ψ ] = E [ ϕ ( f , f ′ ) ] + E [ ϕ ( g , g ′ ) ] − 2 E [ ϕ ( f , g ) ] \mathbb{E}[\psi] = \mathbb{E}[\phi(f,f')] + \mathbb{E}[\phi(g,g')] - 2\mathbb{E}[\phi(f,g)] E [ ψ ] = E [ ϕ ( f , f ′ )] + E [ ϕ ( g , g ′ )] − 2 E [ ϕ ( f , g )] . Expanding the square in lemma E.1, with the noise covariance divided by L L L , and averaging over the neurons, the terms of order L 0 L^0 L 0 give E [ Cov u ( f ( u ) , f ′ ( u ) ) 2 ] + E [ Cov u ( g ( u ) , g ′ ( u ) ) 2 ] − 2 E [ Cov u ( f ( u ) , g ( u ) ) 2 ] = C K D 2 \mathbb{E}[\operatorname{Cov}_u(f(u),f'(u))^2]+\mathbb{E}[\operatorname{Cov}_u(g(u),g'(u))^2]-2\mathbb{E}[\operatorname{Cov}_u(f(u),g(u))^2] = \mathrm{CKD}^2 E [ Cov u ( f ( u ) , f ′ ( u ) ) 2 ] + E [ Cov u ( g ( u ) , g ′ ( u ) ) 2 ] − 2 E [ Cov u ( f ( u ) , g ( u ) ) 2 ] = CKD 2 , and the terms of order L − 1 L^{-1} L − 1 and L − 2 L^{-2} L − 2 give 2 b 1 2b_1 2 b 1 and b 2 b_2 b 2 .
Three features of corollary E.1 are worth noting. First, the bias does not depend on M M M , N X N_X N X , or N Y N_Y N Y , so it is not removed by recording more stimuli or more neurons. Second, because it is a difference of within-system and across-system noise correlations, the bias can be positive or negative: correlated noise can make two systems look either more or less similar than they are. Third, under (N3), same-trial noise is uncorrelated across distinct neurons, so b 1 = b 2 = 0 b_1=b_2=0 b 1 = b 2 = 0 and we recover proposition D.1. Increasing L L L reduces the bias at rate 1 / L 1/L 1/ L , but for any fixed L L L it remains.
Two trials suffice: the split-trial estimator
By lemma E.1, the bias arises only when two neurons are evaluated on a common trial. Here, we show that these same-trial products can be avoided entirely whenever each input is presented L ≥ 2 L \ge2 L ≥ 2 times. We focus on the case L = 2 L=2 L = 2 , both for simplicity and because two repetitions per input is the minimum needed to remove the bias. Under a fixed budget of trials, this leaves as many trials as possible for presenting distinct stimuli.
For two distinct neurons f f f and g g g , recorded either from the same system or from different systems, let ϕ ( 1 , 2 ) ( f , g ; u 1 : 4 ) \phi^{(1,2)}(f,g;u_{1:4}) ϕ ( 1 , 2 ) ( f , g ; u 1 : 4 ) denote ϕ \phi ϕ evaluated with every factor f ( u i ) f(u_i) f ( u i ) in eq. (24) replaced by the response of f f f on the first presentation of u i u_i u i , and every factor g ( u i ) g(u_i) g ( u i ) replaced by the response of g g g on the second presentation. Define ϕ ( 2 , 1 ) \phi^{(2,1)} ϕ ( 2 , 1 ) analogously with the trials swapped, and
ϕ s p l i t ( f , g ; u 1 : 4 ) : = 1 2 [ ϕ ( 1 , 2 ) ( f , g ; u 1 : 4 ) + ϕ ( 2 , 1 ) ( f , g ; u 1 : 4 ) ] . (75) \phi_{\mathrm{split}}(f,g;u_{1:4}) := \frac{1}{2}\left[\phi^{(1,2)}(f,g;u_{1:4})+\phi^{(2,1)}(f,g;u_{1:4})\right]. \tag*{(75)} ϕ split ( f , g ; u 1 : 4 ) := 2 1 [ ϕ ( 1 , 2 ) ( f , g ; u 1 : 4 ) + ϕ ( 2 , 1 ) ( f , g ; u 1 : 4 ) ] . (75)
Averaging over the two assignments makes ϕ s p l i t \phi_{\mathrm{split}} ϕ split symmetric in ( f , g ) (f,g) ( f , g ) ; it is also symmetric in the four inputs. Thus ϕ s p l i t \phi_{\mathrm{split}} ϕ split is a valid U-statistic kernel and defines a noise-correlation-debiased HSIC estimator. Intuitively, this treats the two repetitions as separate recording sessions and combines them so that the two neurons in each product are never read on the same trial.
The corresponding split-trial estimator of C K D 2 \mathrm{CKD}^2 CKD 2 uses the kernel
ψ s p l i t ( f 1 , f 2 , g 1 , g 2 ; u 1 : 4 ) = ϕ s p l i t ( f 1 , f 2 ; u 1 : 4 ) + ϕ s p l i t ( g 1 , g 2 ; u 1 : 4 ) − 1 2 ∑ a = 1 2 ∑ b = 1 2 ϕ s p l i t ( f a , g b ; u 1 : 4 ) . (76) \begin{aligned}
\psi_{\mathrm{split}}(f_1,f_2,g_1,g_2;u_{1:4}) ={}& \phi_{\mathrm{split}}(f_1,f_2;u_{1:4})+\phi_{\mathrm{split}}(g_1,g_2;u_{1:4}) \\
&- \frac{1}{2}\sum_{a=1}^{2}\sum_{b=1}^{2}\phi_{\mathrm{split}}(f_a,g_b;u_{1:4}). \tag*{(76)}
\end{aligned} ψ split ( f 1 , f 2 , g 1 , g 2 ; u 1 : 4 ) = ϕ split ( f 1 , f 2 ; u 1 : 4 ) + ϕ split ( g 1 , g 2 ; u 1 : 4 ) − 2 1 a = 1 ∑ 2 b = 1 ∑ 2 ϕ split ( f a , g b ; u 1 : 4 ) . (76)
and is given by
C K D ^ s p l i t 2 = ( N X 2 ) − 1 ( N Y 2 ) − 1 ( M 4 ) − 1 ∑ n 1 < n 2 ∑ n 1 ′ < n 2 ′ ∑ i 1 < i 2 < i 3 < i 4 ψ s p l i t ( f n 1 , f n 2 , g n 1 ′ , g n 2 ′ ; u i 1 , u i 2 , u i 3 , u i 4 ) . (77) \widehat{\mathrm{CKD}}^2_{\mathrm{split}} =
\binom{N_X}{2}^{-1}\binom{N_Y}{2}^{-1}\binom{M}{4}^{-1}
\sum_{n_1<n_2}\sum_{n'_1<n'_2}\sum_{i_1<i_2<i_3<i_4}
\psi_{\mathrm{split}}(f_{n_1},f_{n_2},g_{n'_1},g_{n'_2};u_{i_1},u_{i_2},u_{i_3},u_{i_4}). \tag*{(77)} CKD split 2 = ( 2 N X ) − 1 ( 2 N Y ) − 1 ( 4 M ) − 1 n 1 < n 2 ∑ n 1 ′ < n 2 ′ ∑ i 1 < i 2 < i 3 < i 4 ∑ ψ split ( f n 1 , f n 2 , g n 1 ′ , g n 2 ′ ; u i 1 , u i 2 , u i 3 , u i 4 ) . (77)
This is simply eq. (51) with ϕ \phi ϕ replaced by ϕ s p l i t \phi_{\mathrm{split}} ϕ split . Both the self terms (two distinct neurons of the same system) and the cross terms (one neuron from each system) are now split across trials, which, as we show next, is sufficient to debias the estimator.
Proposition E.1 (The split-trial estimator is unbiased). Assume ( N 1 ) (N1) ( N 1 ) , ( C 3 ) (C3) ( C 3 ) , and L = 2 L = 2 L = 2 trials per input. Then E [ C K D ^ s p l i t 2 ∣ D ] = C K D ^ 2 \mathbb{E}[\widehat{\mathrm{CKD}}_{\mathrm{split}}^2 \mid\mathcal{D}] = \widehat{\mathrm{CKD}}^2 E [ CKD split 2 ∣ D ] = CKD 2 , the estimator computed on noiseless responses, and hence E [ C K D ^ s p l i t 2 ] = C K D 2 \mathbb{E}[\widehat{\mathrm{CKD}}_{\mathrm{split}}^2] = \mathrm{CKD}^2 E [ CKD split 2 ] = CKD 2 .
Proof. Each monomial f ( u i ) f ( u j ) g ( u k ) g ( u l ) f(u_i) f(u_j) g(u_k) g(u_l) f ( u i ) f ( u j ) g ( u k ) g ( u l ) of ϕ ( 1 , 2 ) ( f , g ) \phi^{(1,2)}(f,g) ϕ ( 1 , 2 ) ( f , g ) evaluates its four factors on the distinct presentations ( i , 1 ) (i,1) ( i , 1 ) , ( j , 1 ) (j,1) ( j , 1 ) , ( k , 2 ) (k,2) ( k , 2 ) , ( l , 2 ) (l,2) ( l , 2 ) , so given D \mathcal{D} D their noise terms are independent with mean zero, and every noise-containing term vanishes in expectation. The same holds for ϕ ( 2 , 1 ) \phi^{(2,1)} ϕ ( 2 , 1 ) . The second claim follows from iterated expectations and the unbiasedness of C K D ^ 2 \widehat{\mathrm{CKD}}^2 CKD 2 .
Efficient computation. As for the standard estimator, C K D ^ s p l i t 2 \widehat{\mathrm{CKD}}_{\mathrm{split}}^2 CKD split 2 can be computed without enumerating index tuples. Let x n ( ℓ ) = ( X n 1 ℓ , … , X n M ℓ ) ∈ R M x_n^{(\ell)} = (X_{n1\ell}, \ldots, X_{nM\ell}) \in\mathbb{R}^M x n ( ℓ ) = ( X n 1 ℓ , … , X n M ℓ ) ∈ R M denote the responses of neuron n n n of system X X X on repetition ℓ \ell ℓ , let K ^ ( ℓ ) = N X − 1 ∑ n x n ( ℓ ) x n ( ℓ ) ⊤ \widehat{K}^{(\ell)} = N_X^{-1} \sum_n x_n^{(\ell)} x_n^{(\ell)\top} K ( ℓ ) = N X − 1 ∑ n x n ( ℓ ) x n ( ℓ ) ⊤ , and define y n ( ℓ ) y_n^{(\ell)} y n ( ℓ ) and H ^ ( ℓ ) \widehat{H}^{(\ell)} H ( ℓ ) analogously for system Y Y Y . Since S s c S_{\mathrm{sc}} S sc in eq. (11) is linear in each argument, the reasoning behind eq. (53) gives
C K D ^ s p l i t 2 = S s a n c ( 12 ) ( X ) + S s a n c ( 12 ) ( Y ) − S s c ( K ^ ( 1 ) , H ^ ( 2 ) ) − S s c ( K ^ ( 2 ) , H ^ ( 1 ) ) , (78) \widehat{\mathrm{CKD}}_{\mathrm{split}}^2 = S_{\mathrm{sanc}}^{(12)}(X) + S_{\mathrm{sanc}}^{(12)}(Y) - S_{\mathrm{sc}}\left(\widehat{K}^{(1)}, \widehat{H}^{(2)}\right) - S_{\mathrm{sc}}\left(\widehat{K}^{(2)}, \widehat{H}^{(1)}\right), \tag*{(78)} CKD split 2 = S sanc ( 12 ) ( X ) + S sanc ( 12 ) ( Y ) − S sc ( K ( 1 ) , H ( 2 ) ) − S sc ( K ( 2 ) , H ( 1 ) ) , (78)
where
S s a n c ( 12 ) ( X ) = 1 N X ( N X − 1 ) ( N X 2 S s c ( K ^ ( 1 ) , K ^ ( 2 ) ) − ∑ n S s c ( x n ( 1 ) x n ( 1 ) ⊤ , x n ( 2 ) x n ( 2 ) ⊤ ) ) , (79) S_{\mathrm{sanc}}^{(12)}(X) = \frac{1}{N_X(N_X-1)}\left(N_X^2 S_{\mathrm{sc}}\left(\widehat{K}^{(1)},\widehat{K}^{(2)}\right) - \sum_n S_{\mathrm{sc}}\left(x_n^{(1)}x_n^{(1)\top},x_n^{(2)}x_n^{(2)\top}\right)\right), \tag*{(79)} S sanc ( 12 ) ( X ) = N X ( N X − 1 ) 1 ( N X 2 S sc ( K ( 1 ) , K ( 2 ) ) − n ∑ S sc ( x n ( 1 ) x n ( 1 ) ⊤ , x n ( 2 ) x n ( 2 ) ⊤ ) ) , (79)
and S s a n c ( 12 ) ( Y ) S_{\mathrm{sanc}}^{(12)}(Y) S sanc ( 12 ) ( Y ) is defined analogously. The subtracted sum removes pairs in which a neuron is compared with itself across repetitions. Each of its terms pairs two different rank-one matrices, but can still be computed in O ( M ) O(M) O ( M ) time: writing ⊙ \odot ⊙ for the elementwise product, for v , w ∈ R M v,w \in\mathbb{R}^M v , w ∈ R M ,
S s c ( v v ⊤ , w w ⊤ ) = 1 M ( M − 3 ) [ ( v ⊤ w ) 2 − ∥ v ⊙ w ∥ 2 + ( ( 1 ⊤ v ) 2 − ∥ v ∥ 2 ) ( ( 1 ⊤ w ) 2 − ∥ w ∥ 2 ) ( M − 1 ) ( M − 2 ) − 2 M − 2 ( ( 1 ⊤ v ) ( 1 ⊤ w ) ( v ⊤ w ) − ( 1 ⊤ v ) v ⊤ ( w ⊙ w ) − ( 1 ⊤ w ) ( v ⊙ v ) ⊤ w + ∥ v ⊙ w ∥ 2 ) ] , (80) \begin{aligned}
S_{\mathrm{sc}}\left(vv^\top,ww^\top\right)
={}&\frac{1}{M(M-3)}\left[(v^\top w)^2-\lVert v\odot w\rVert^2\right.\\
&\left.+\frac{\left((\mathbf{1}^\top v)^2-\lVert v\rVert^2\right)\left((\mathbf{1}^\top w)^2-\lVert w\rVert^2\right)}{(M-1)(M-2)}\right.\\
&\left.-\frac{2}{M-2}\left((\mathbf{1}^\top v)(\mathbf{1}^\top w)(v^\top w)-(\mathbf{1}^\top v)v^\top(w\odot w)\right.\right.\\
&\left.\left.\qquad-(\mathbf{1}^\top w)(v\odot v)^\top w+\lVert v\odot w\rVert^2\right)\right], \tag*{(80)}
\end{aligned} S sc ( v v ⊤ , w w ⊤ ) = M ( M − 3 ) 1 [ ( v ⊤ w ) 2 − ∥ v ⊙ w ∥ 2 + ( M − 1 ) ( M − 2 ) ( ( 1 ⊤ v ) 2 − ∥ v ∥ 2 ) ( ( 1 ⊤ w ) 2 − ∥ w ∥ 2 ) − M − 2 2 ( ( 1 ⊤ v ) ( 1 ⊤ w ) ( v ⊤ w ) − ( 1 ⊤ v ) v ⊤ ( w ⊙ w ) − ( 1 ⊤ w ) ( v ⊙ v ) ⊤ w + ∥ v ⊙ w ∥ 2 ) ] , (80)
which reduces to the formula in Section C.2 when v = w v = w v = w . The cost is therefore of the same order as the standard estimator.
More than two trials. If L > 2 L > 2 L > 2 trials are available, the natural extension is to extend the definition of ϕ s p l i t \phi_{\mathrm{split}} ϕ split to average over all ordered pairs of trial indices, ℓ ≠ ℓ ′ \ell\ne\ell' ℓ = ℓ ′ . The proof of proposition E.1 applies verbatim to each pair. This preserves unbiasedness while reducing variance in the estimator that stems from response noise.
Systems recorded separately. If the two systems are not recorded simultaneously (e.g., in different animals or sessions), their noise is independent across systems, while noise within each system may still be correlated. By lemma E.1, only the self terms of ψ \psi ψ are then biased; the cross terms ϕ ( f , g ) \phi(f,g) ϕ ( f , g ) are unbiased even on trial-averaged responses. It therefore suffices to split the self terms across repetitions and to evaluate the cross terms on trial averages, which uses all available trials and reduces variance. In eq. (78) , this amounts to replacing the last two terms with − 2 S s c ( K ^ , H ^ ) -2S_{\mathrm{sc}}(\widehat{K},\widehat{H}) − 2 S sc ( K , H ) , where K ^ \widehat{K} K and H ^ \widehat{H} H are computed from the trial-averaged responses X ‾ n i \overline{X}_{ni} X ni and Y ‾ n i \overline{Y}_{ni} Y ni .
Variance of the split-trial estimator
The previous section showed that the split-trial estimator is unbiased. Here, we show that its variance decays at the same rate as in our main result, Theorem 3.1 , and that correlated noise changes only the coefficient of the 1 / M 1/M 1/ M term. We focus on the case of L = 2 L = 2 L = 2 trials or stimulus repetitions for simplicity. It is possible to extend the results to L > 2 L > 2 L > 2 by averaging ϕ ( ℓ , ℓ ′ ) \phi^{(\ell,\ell')} ϕ ( ℓ , ℓ ′ ) over pairs of distinct repetitions; we omit the details.
The core idea behind our analysis in this section is to attribute all noise correlations to latent variables. After conditioning on these latent variables, the remaining noise is independent across neurons and trials; as we discuss below, this representation is essentially without loss of generality. We use the law of total variance to capture contributions from the latent factors and the remaining, decorrelated noise (which is handled by our previous analysis in Appendix § 11 ).
Concretely, for each input u i u_i u i and repetition ℓ ∈ { 1 , 2 } \ell\in\{1,2\} ℓ ∈ { 1 , 2 } , let ω i ( ℓ ) \omega_i^{(\ell)} ω i ( ℓ ) be a latent trial state that captures all noise correlations on that trial. We assume the latent states are i.i.d. across inputs and repetitions and independent of the neurons and inputs. We then model the response of each neuron to input u i u_i u i on repetition ℓ \ell ℓ as
X n i ℓ = f n ( u i , ω i ( ℓ ) ) + ξ n i ℓ , Y n i ℓ = g n ( u i , ω i ( ℓ ) ) + ζ n i ℓ , (81) X_{ni\ell}=f_n(u_i,\omega_i^{(\ell)})+\xi_{ni\ell},\qquad Y_{ni\ell}=g_n(u_i,\omega_i^{(\ell)})+\zeta_{ni\ell}, \tag*{(81)} X ni ℓ = f n ( u i , ω i ( ℓ ) ) + ξ ni ℓ , Y ni ℓ = g n ( u i , ω i ( ℓ ) ) + ζ ni ℓ , (81)
where, conditional on the neurons, inputs, and trial states, the private noise variables ξ n i ℓ \xi_{ni\ell} ξ ni ℓ and ζ n i ℓ \zeta_{ni\ell} ζ ni ℓ are mutually independent and mean zero. Intuitively, each tuning curve now depends jointly on the input and the latent trial state, and the usual tuning curve is recovered by averaging over the trial state: f n ( u ) = E ω [ f n ( u , ω ) ] f_n(u)=\mathbb{E}_{\omega}[f_n(u,\omega)] f n ( u ) = E ω [ f n ( u , ω )] , and likewise for g n g_n g n .
To analyze the variance of C K D ^ s p l i t 2 \widehat{\mathrm{CKD}}_{\mathrm{split}}^2 CKD split 2 , we attach both trial states of each input to the input itself, defining augmented inputs
u i + : = ( u i , ω i ( 1 ) , ω i ( 2 ) ) , (82) u_i^+ := (u_i,\omega_i^{(1)},\omega_i^{(2)}), \tag*{(82)} u i + := ( u i , ω i ( 1 ) , ω i ( 2 ) ) , (82)
which are i.i.d. and independent of the neurons. For an index tuple ( n 1 < n 2 ; n 1 ′ < n 2 ′ ; i 1 < i 2 < i 3 < i 4 ) (n_1<n_2; n'_1<n'_2; i_1<i_2<i_3<i_4) ( n 1 < n 2 ; n 1 ′ < n 2 ′ ; i 1 < i 2 < i 3 < i 4 ) , let Σ \Sigma Σ denote the collection of random variables on which the corresponding term ψ s p l i t ( Σ ) \psi_{\mathrm{split}}(\Sigma) ψ split ( Σ ) depends: the neurons f n 1 , f n 2 , g n 1 ′ , g n 2 ′ f_{n_1},f_{n_2},g_{n'_1},g_{n'_2} f n 1 , f n 2 , g n 1 ′ , g n 2 ′ , the augmented inputs u i 1 + , … , u i 4 + u^+_{i_1},\ldots,u^+_{i_4} u i 1 + , … , u i 4 + , and the private noise of each of these neurons on each presentation of these inputs. Two such collections Σ \Sigma Σ and Σ ′ \Sigma' Σ ′ share a latent trial state only if they share the corresponding input, and share a private noise variable only if they share both the corresponding neuron and input. All of their remaining variables are distinct and mutually independent, so ψ s p l i t ( Σ ) \psi_{\mathrm{split}}(\Sigma) ψ split ( Σ ) and ψ s p l i t ( Σ ′ ) \psi_{\mathrm{split}}(\Sigma') ψ split ( Σ ′ ) are conditionally independent given Σ ∩ Σ ′ \Sigma\cap\Sigma' Σ ∩ Σ ′ .
The standard decomposition of variance for a U-statistic (see appendices § 9 and C) therefore gives
Var [ C K D ^ s p l i t 2 ] = ∑ α , β , γ C ~ α β γ V α β γ c o r r , V α β γ c o r r : = Var ( E [ ψ s p l i t ( Σ ) ∣ Σ ∩ Σ ′ ] ) , (83) \operatorname{Var}[\widehat{\mathrm{CKD}}_{\mathrm{split}}^2]
=\sum_{\alpha,\beta,\gamma}\widetilde{C}_{\alpha\beta\gamma}V_{\alpha\beta\gamma}^{\mathrm{corr}},
\qquad
V_{\alpha\beta\gamma}^{\mathrm{corr}}
:=\operatorname{Var}\left(\mathbb{E}[\psi_{\mathrm{split}}(\Sigma)\mid\Sigma\cap\Sigma']\right), \tag*{(83)} Var [ CKD split 2 ] = α , β , γ ∑ C α β γ V α β γ corr , V α β γ corr := Var ( E [ ψ split ( Σ ) ∣ Σ ∩ Σ ′ ] ) , (83)
where C ~ α β γ \widetilde{C}_{\alpha\beta\gamma} C α β γ is the probability that two independently chosen index tuples share α \alpha α neurons of system X X X , β \beta β neurons of system Y Y Y , and γ \gamma γ inputs. These weights are the same as in appendix C, because the block structure is unchanged.
As in section D.3, let A A A denote the shared neurons and shared inputs u u u , excluding latent trial states and private noise. By the law of total variance,
V α β γ c o r r = Var A ( E [ ψ s p l i t ( Σ ) ∣ A ] ) + E A [ Var ( Σ ∩ Σ ′ ) ∖ A ( E [ ψ s p l i t ( Σ ) ∣ Σ ∩ Σ ′ ∣ A ] ) ] . (84) V_{\alpha\beta\gamma}^{\mathrm{corr}}
=\operatorname{Var}_{A}\left(\mathbb{E}[\psi_{\mathrm{split}}(\Sigma)\mid A]\right)
+\mathbb{E}_{A}\left[\operatorname{Var}_{(\Sigma\cap\Sigma')\setminus A}\left(\mathbb{E}[\psi_{\mathrm{split}}(\Sigma)\mid\Sigma\cap\Sigma'\mid A]\right)\right]. \tag*{(84)} V α β γ corr = Var A ( E [ ψ split ( Σ ) ∣ A ] ) + E A [ Var ( Σ ∩ Σ ′ ) ∖ A ( E [ ψ split ( Σ ) ∣ Σ ∩ Σ ′ ∣ A ] ) ] . (84)
The first term of eq. (84) is the noiseless contribution, and the second is the contribution of the noise. The following proposition shows that the noise affects only collision patterns that share an input.
Proposition 2. V α β γ c o r r ≥ V α β γ V_{\alpha\beta\gamma}^{\mathrm{corr}}\ge V_{\alpha\beta\gamma} V α β γ corr ≥ V α β γ for every collision pattern, with equality whenever γ = 0 \gamma=0 γ = 0 . In particular, V 100 c o r r = V 100 V_{100}^{\mathrm{corr}}=V_{100} V 100 corr = V 100 and V 010 c o r r = V 010 V_{010}^{\mathrm{corr}}=V_{010} V 010 corr = V 010 , while
V 001 c o r r = V 001 + E u [ Var ω ( 1 ) , ω ( 2 ) ( E [ ψ s p l i t ∣ u + ] ∣ u ) ] . (85) V_{001}^{\mathrm{corr}}=V_{001}+\mathbb{E}_{u}\left[\operatorname{Var}_{\omega^{(1)},\omega^{(2)}}\left(\mathbb{E}[\psi_{\mathrm{split}}\mid u^+]\mid u\right)\right]. \tag*{(85)} V 001 corr = V 001 + E u [ Var ω ( 1 ) , ω ( 2 ) ( E [ ψ split ∣ u + ] ∣ u ) ] . (85) where u + = ( u , ω ( 1 ) , ω ( 2 ) ) u^+=(u,\omega^{(1)},\omega^{(2)}) u + = ( u , ω ( 1 ) , ω ( 2 ) ) is the shared augmented input.
Proof. Consider the two terms of eq. (84) . For the first, A A A is a function of D D D , so the tower property and Proposition E.1 give E [ ψ s p l i t ( Σ ) ∣ A ] = E [ ψ ( Σ ) ∣ A ] \mathbb{E}[\psi_{\mathrm{split}}(\Sigma)\mid A]=\mathbb{E}[\psi(\Sigma)\mid A] E [ ψ split ( Σ ) ∣ A ] = E [ ψ ( Σ ) ∣ A ] , with ψ \psi ψ evaluated on noiseless responses. Hence the first term equals V α β γ V_{\alpha\beta\gamma} V α β γ . The second term is nonnegative, which gives V α β γ c o r r ≥ V α β γ V_{\alpha\beta\gamma}^{\mathrm{corr}}\ge V_{\alpha\beta\gamma} V α β γ corr ≥ V α β γ . If the two tuples share no input (γ = 0 \gamma=0 γ = 0 ), they share no latent trial states and no private noise, so ( Σ ∩ Σ ′ ) ∖ A (\Sigma\cap\Sigma')\setminus A ( Σ ∩ Σ ′ ) ∖ A is empty and the second term vanishes. This covers the patterns ( 1 , 0 , 0 ) (1,0,0) ( 1 , 0 , 0 ) and ( 0 , 1 , 0 ) (0,1,0) ( 0 , 1 , 0 ) . For the pattern ( 0 , 0 , 1 ) (0,0,1) ( 0 , 0 , 1 ) , the two tuples share one augmented input u + u^+ u + and no neurons, and therefore no private noise. Thus A = { u } A=\{u\} A = { u } and ( Σ ∩ Σ ′ ) ∖ A = { ω ( 1 ) , ω ( 2 ) } (\Sigma\cap\Sigma')\setminus A=\{\omega^{(1)},\omega^{(2)}\} ( Σ ∩ Σ ′ ) ∖ A = { ω ( 1 ) , ω ( 2 ) } . Since ψ s p l i t \psi_{\mathrm{split}} ψ split is symmetric in its inputs, it does not matter which input is shared, and the second term of eq. (84) reduces to the second term of eq. (85) .
It remains to bound the extra noise term in eq. (85) , as well as the higher-order collision terms. Both are controlled by the second moment of ψ s p l i t \psi_{\mathrm{split}} ψ split , which in turn depends on the fourth moment of single-trial responses,
q ~ = max { sup u E [ ( X n i ℓ − f ˉ n ) 4 ∣ u i = u ] , sup u E [ ( Y n i ℓ − g ˉ n ) 4 ∣ u i = u ] } . \widetilde{q}=\max\left\{\sup_u\mathbb{E}\left[(X_{ni\ell}-\bar{f}_n)^4\mid u_i=u\right],\sup_u\mathbb{E}\left[(Y_{ni\ell}-\bar{g}_n)^4\mid u_i=u\right]\right\}. q = max { u sup E [ ( X ni ℓ − f ˉ n ) 4 ∣ u i = u ] , u sup E [ ( Y ni ℓ − g ˉ n ) 4 ∣ u i = u ] } .
where the expectations are jointly over a randomly sampled neuron, a latent trial state, and private noise. This is eq. (62) with each tuning value f n ( u i ) f_n(u_i) f n ( u i ) replaced by a single-trial response X n i ℓ X_{ni\ell} X ni ℓ , still centered at the noiseless stimulus average f ˉ n \bar{f}_n f ˉ n . Writing X n i ℓ − f ˉ n = ( f n ( u i ) − f ˉ n ) + ( X n i ℓ − f n ( u i ) ) X_{ni\ell}-\bar{f}_n=(f_n(u_i)-\bar{f}_n)+(X_{ni\ell}-f_n(u_i)) X ni ℓ − f ˉ n = ( f n ( u i ) − f ˉ n ) + ( X ni ℓ − f n ( u i )) and using ( a + b ) 4 ≤ 8 a 4 + 8 b 4 (a+b)^4\leq8a^4+8b^4 ( a + b ) 4 ≤ 8 a 4 + 8 b 4 shows that q ~ \widetilde{q} q is at most 8 q 8q 8 q plus eight times the largest fourth moment of the single-trial deviation X n i ℓ − f n ( u i ) X_{ni\ell}-f_n(u_i) X ni ℓ − f n ( u i ) , which combines shared and private noise.
Lemma E.2. Var [ ψ s p l i t ] ≤ 256 q ~ 2 \operatorname{Var}[\psi_{\mathrm{split}}]\leq256\widetilde{q}^{\,2} Var [ ψ split ] ≤ 256 q 2 .
Proof. The argument follows the corresponding bound in section C.4, with q q q replaced by q ~ \widetilde{q} q . By lemma C.1, we may center each neuron by its noiseless stimulus average, so assume f ˉ = g ˉ = 0 \bar{f}=\bar{g}=0 f ˉ = g ˉ = 0 . Each monomial of ϕ ( 1 , 2 ) ( f , g ) \phi^{(1,2)}(f,g) ϕ ( 1 , 2 ) ( f , g ) is then a product of two responses of f f f on repetition 1, at inputs u i u_i u i and u j u_j u j , and two responses of g g g on repetition 2, at inputs u k u_k u k and u l u_l u l . Given the inputs, the two responses of f f f depend only on f f f , the trial states ω i ( 1 ) , ω j ( 1 ) \omega_i^{(1)},\omega_j^{(1)} ω i ( 1 ) , ω j ( 1 ) , and the private noise of f f f , while the two responses of g g g depend only on g g g , the trial states ω k ( 2 ) , ω l ( 2 ) \omega_k^{(2)},\omega_l^{(2)} ω k ( 2 ) , ω l ( 2 ) , and the private noise of g g g . Since f ≠ g f\ne g f = g are independent and the two neurons are read on different repetitions, these are independent, even when i = k i=k i = k or j = l j=l j = l . (This is where the split-trial construction is needed: for the standard estimator, two neurons evaluated at the same input share its trial state.) Hence, applying Cauchy–Schwarz within each neuron,
E [ ( X n i 1 X n j 1 X n ′ k 2 X n ′ l 2 ) 2 ∣ u 1 : 4 ] = E [ X n i 1 2 X n j 1 2 ∣ u 1 : 4 ] E [ X n ′ k 2 2 X n ′ l 2 2 ∣ u 1 : 4 ] ≤ q ~ 2 . \mathbb{E}\left[\left(X_{ni1}X_{nj1}X_{n'k2}X_{n'l2}\right)^2\mid u_{1:4}\right]
=\mathbb{E}\left[X_{ni1}^2X_{nj1}^2\mid u_{1:4}\right]\mathbb{E}\left[X_{n'k2}^2X_{n'l2}^2\mid u_{1:4}\right]\leq\widetilde{q}^{\,2}. E [ ( X ni 1 X nj 1 X n ′ k 2 X n ′ l 2 ) 2 ∣ u 1 : 4 ] = E [ X ni 1 2 X nj 1 2 ∣ u 1 : 4 ] E [ X n ′ k 2 2 X n ′ l 2 2 ∣ u 1 : 4 ] ≤ q 2 .
with Y Y Y in place of X X X for neurons of system Y Y Y . Every monomial therefore has L 2 L^2 L 2 norm at most q ~ \widetilde{q} q . By the triangle inequality, ∥ ϕ ( 1 , 2 ) ( f , g ) ∥ 2 ≤ 4 q ~ \|\phi^{(1,2)}(f,g)\|_2\leq4\widetilde{q} ∥ ϕ ( 1 , 2 ) ( f , g ) ∥ 2 ≤ 4 q , and the same bound holds for ϕ ( 2 , 1 ) ( f , g ) \phi^{(2,1)}(f,g) ϕ ( 2 , 1 ) ( f , g ) and hence for ϕ s p l i t ( f , g ) \phi_{\mathrm{split}}(f,g) ϕ split ( f , g ) . Combining the two self terms and four cross terms of ψ s p l i t \psi_{\mathrm{split}} ψ split as in section C.4 gives ∥ ψ s p l i t ∥ 2 ≤ 16 q ~ \|\psi_{\mathrm{split}}\|_2\leq16\widetilde{q} ∥ ψ split ∥ 2 ≤ 16 q , and hence Var [ ψ s p l i t ] ≤ 256 q ~ 2 \operatorname{Var}[\psi_{\mathrm{split}}]\leq256\widetilde{q}^{\,2} Var [ ψ split ] ≤ 256 q 2 .
Since the variance of a conditional expectation is at most the variance of the original quantity, the extra term in eq. (85) is at most Var [ ψ s p l i t ] ≤ 256 q ~ 2 \operatorname{Var}[\psi_{\mathrm{split}}]\leq256\widetilde{q}^{\,2} Var [ ψ split ] ≤ 256 q 2 , and likewise V α β γ c o r r ≤ 256 q ~ 2 V_{\alpha\beta\gamma}^{\mathrm{corr}}\leq256\widetilde{q}^{\,2} V α β γ corr ≤ 256 q 2 for every pattern. Combining these bounds with proposition E.2 gives our final result.
Corollary E.2 (Variance bound for the split-trial estimator).
Var ^ [ C K D s p l i t 2 ] ≤ 16 q C K D 2 ( 1 M + 1 N X + 1 N Y ) + 2 12 q ~ 2 M + 2 16 q ~ 2 ( 1 M + 1 N X + 1 N Y ) 2 . \widehat{\operatorname{Var}}[\mathrm{CKD}_{\mathrm{split}}^2]\leq16q\,\mathrm{CKD}^2\left(\frac{1}{M}+\frac{1}{N_X}+\frac{1}{N_Y}\right)+\frac{2^{12}\widetilde{q}^{\,2}}{M}+2^{16}\widetilde{q}^{\,2}\left(\frac{1}{M}+\frac{1}{N_X}+\frac{1}{N_Y}\right)^2. Var [ CKD split 2 ] ≤ 16 q CKD 2 ( M 1 + N X 1 + N Y 1 ) + M 2 12 q 2 + 2 16 q 2 ( M 1 + N X 1 + N Y 1 ) 2 .
Proof. Group the terms of eq. (83) by the number of collisions, α + β + γ \alpha+\beta+\gamma α + β + γ . For single collisions, C ~ 100 ≤ 4 / N X \widetilde{C}_{100}\leq4/N_X C 100 ≤ 4/ N X , C ~ 010 ≤ 4 / N Y \widetilde{C}_{010}\leq4/N_Y C 010 ≤ 4/ N Y , and C ~ 001 ≤ 16 / M \widetilde{C}_{001}\leq16/M C 001 ≤ 16/ M (section C.4). By proposition E.2, these terms equal their noiseless counterparts, each at most q C K D 2 q\,\mathrm{CKD}^2 q CKD 2 , except for the extra term in V 001 c o r r V_{001}^{\mathrm{corr}} V 001 corr , which is at most 256 q ~ 2 256\widetilde{q}^{\,2} 256 q 2 . Together they contribute at most 16 q C K D 2 ( 1 / M + 1 / N X + 1 / N Y ) + 16 ⋅ 256 q ~ 2 / M 16q\,\mathrm{CKD}^2(1/M+1/N_X+1/N_Y)+16\cdot256\widetilde{q}^{\,2}/M 16 q CKD 2 ( 1/ M + 1/ N X + 1/ N Y ) + 16 ⋅ 256 q 2 / M . Patterns with two or more collisions have total weight at most 256 ( 1 / M + 1 / N X + 1 / N Y ) 2 256(1/M+1/N_X+1/N_Y)^2 256 ( 1/ M + 1/ N X + 1/ N Y ) 2 , as in section C.4, and each V α β γ c o r r ≤ 256 q ~ 2 V_{\alpha\beta\gamma}^{\mathrm{corr}}\leq256\widetilde{q}^{\,2} V α β γ corr ≤ 256 q 2 .
Correlated noise therefore leaves the rate unchanged and affects only the coefficient of 1 / M 1/M 1/ M . Unlike the other first-order terms, however, this additional contribution is not proportional to C K D 2 \mathrm{CKD}^2 CKD 2 , so it does not vanish when the two representations are identical. Intuitively, an input whose trial states happen to push the two systems in different directions adds variance to the estimator, even when the underlying tuning is the same.
Generality of the latent representation. The representation in eq. (81) is not restrictive. Suppose that, on each trial, the joint law of responses is unchanged by relabeling neurons within each system, as is implicit in modeling neurons as i.i.d. draws from a population. Then, by de Finetti’s theorem, the responses on that trial are conditionally i.i.d. given a latent variable. The latent variable supplied by de Finetti’s theorem may have a law that depends on the input u i u_i u i . However, it can always be written as a measurable function of u i u_i u i and an independent random variable uniformly distributed on [ 0 , 1 ] [0,1] [ 0 , 1 ] , essentially by the inverse-CDF construction [22 Lemma 4.22] . We take this uniform variable as ω i ( ℓ ) \omega_i^{(\ell)} ω i ( ℓ ) , absorbing the dependence on the input into the augmented tuning function, so that ω i ( ℓ ) \omega_i^{(\ell)} ω i ( ℓ ) is independent of the input. Letting f n ( u , ω ) f_n(u,\omega) f n ( u , ω ) denote the conditional mean of X n i ℓ X_{ni\ell} X ni ℓ given the tuning curve of neuron n n n , u i = u u_i=u u i = u , and ω i ( ℓ ) = ω \omega_i^{(\ell)}=\omega ω i ( ℓ ) = ω , and setting ξ n i ℓ : = X n i ℓ − f n ( u i , ω i ( ℓ ) ) \xi_{ni\ell}:=X_{ni\ell}-f_n(u_i,\omega_i^{(\ell)}) ξ ni ℓ := X ni ℓ − f n ( u i , ω i ( ℓ ) ) , then recovers the form above.
Empirical Results
In Figure 4 , we present empirical results supporting our theoretical predictions when noise is correlated. Below, we apply correlated Gaussian noise to L = 2 L=2 L = 2 trials, then estimate CKD using our split trial estimator C K D ^ s p l i t 2 \widehat{\mathrm{CKD}}_{\mathrm{split}}^2 CKD split 2 over the two trials. We reproduce qualitatively and numerically the same results that we presented in the main body of the paper. In Figure 4 B, we also present the noiseless results from § 4.2 for ease of viewing: results are near-identical when using the split-trial estimator. In Figure 4 D, we show the empirical bias of the standard estimator we presented in the paper, which increases as the strength of noise correlations increase. This bias follows our theory well. This bias vanishes when using our split-trial estimator with just L = 2 L=2 L = 2 trials, and debiases for all degrees of noise correlation.
Figure 4. Reproduction of core simulations for data with noise correlations. (A) Variance of estimating CKD between random neural networks as in § 4.1 . (B) Variance of estimating CKD between trained neural networks as in § 4.2 . On the left, we show the noiseless results we obtained in § 4.2 to demonstrate that the variance scales almost exactly. (C) Variance of estimating CKD between monkey regions as in § 4.3 . (D) Increasing strength of noise correlation induces bias in CKD estimates using the standard presented estimator. Results in this subfigure are in random neural network simulations.
What is different about CKA?
No Unbiased Estimators for CKA and Squared Procrustes Distance
We have seen that HSIC admits an unbiased U-statistic estimator, leading to an unbiased estimator of C K D 2 \mathrm{CKD}^2 CKD 2 . Here, we show that it is not possible to completely eliminate estimator bias in other popular representational similarity measures including CKA and the squared Procrustes distance.
CKA is a nonlinear combination of three HSIC terms, which are unbiasedly estimable. However, unbiasedness is not preserved under nonlinear transformations. The textbook example is that 1 / p 1/p 1/ p is not unbiasedly estimable from n n n Bernoulli trials for any n n n [see 31 example 1.2 in Chapter 2] . The proposition below constructs a similar argument for CKA, showing that it is not possible to achieve unbiased estimation across all problem instances.
Proposition F.1. Let U = [ 0 , 1 ] \mathcal{U}=[0,1] U = [ 0 , 1 ] with P U P_{\mathcal{U}} P U uniform, and fix M ≥ 1 M\ge1 M ≥ 1 and N X , N Y ≥ 1 N_X,N_Y\ge1 N X , N Y ≥ 1 . There is a one-parameter family of tuning-curve distributions such that no estimator T ^ \widehat{T} T of CKA computed from the observed response matrices, and having finite expectation at some interior parameter value, is unbiased on any subinterval of [ 0 , 1 ] [0,1] [ 0 , 1 ] .
Proof. Let φ 1 ( u ) = 2 cos ( 2 π u ) \varphi_1(u)=\sqrt{2}\cos(2\pi u) φ 1 ( u ) = 2 cos ( 2 π u ) and φ 2 ( u ) = 2 cos ( 4 π u ) \varphi_2(u)=\sqrt{2}\cos(4\pi u) φ 2 ( u ) = 2 cos ( 4 π u ) , which are centered, bounded, and orthonormal in L 2 ( P U ) L^2(P_{\mathcal{U}}) L 2 ( P U ) . Take F \mathcal{F} F to be the point mass at φ 1 \varphi_1 φ 1 , and let G \mathcal{G} G place mass p p p on φ 1 \varphi_1 φ 1 and 1 − p 1-p 1 − p on φ 2 \varphi_2 φ 2 . That is, for f ∼ F f\sim\mathcal{F} f ∼ F , we have f = φ 1 f=\varphi_1 f = φ 1 with probability one, while for g ∼ G g\sim\mathcal{G} g ∼ G we have g = φ 1 g=\varphi_1 g = φ 1 with probability p p p and g = φ 2 g=\varphi_2 g = φ 2 with probability 1 − p 1-p 1 − p .
Both curves are centered, so
k ˉ = φ 1 ⊗ φ 1 , h ˉ p = p φ 1 ⊗ φ 1 + ( 1 − p ) φ 2 ⊗ φ 2 , (86) \bar{k}=\varphi_1\otimes\varphi_1,\qquad\bar{h}_p=p\varphi_1\otimes\varphi_1+(1-p)\varphi_2\otimes\varphi_2, \tag*{(86)} k ˉ = φ 1 ⊗ φ 1 , h ˉ p = p φ 1 ⊗ φ 1 + ( 1 − p ) φ 2 ⊗ φ 2 , (86)
and it is easy to check that
⟨ k ˉ , h ˉ p ⟩ = p , ∥ k ˉ ∥ 2 = 1 , ∥ h ˉ p ∥ 2 = p 2 + ( 1 − p ) 2 = 2 p 2 − 2 p + 1. (87) \langle\bar{k},\bar{h}_p\rangle=p,\qquad\lVert\bar{k}\rVert^2=1,\qquad\lVert\bar{h}_p\rVert^2=p^2+(1-p)^2=2p^2-2p+1. \tag*{(87)} ⟨ k ˉ , h ˉ p ⟩ = p , ∥ k ˉ ∥ 2 = 1 , ∥ h ˉ p ∥ 2 = p 2 + ( 1 − p ) 2 = 2 p 2 − 2 p + 1. (87)
Thus we have constructed a family of problem instances where
C K A ∞ = p 2 p 2 − 2 p + 1 (88) \mathrm{CKA}_{\infty}=\frac{p}{\sqrt{2p^2-2p+1}} \tag*{(88)} CKA ∞ = 2 p 2 − 2 p + 1 p (88)
controlled by an arbitrary parameter p ∈ [ 0 , 1 ] p \in[0,1] p ∈ [ 0 , 1 ] .
Crucially, the right hand side of eq. (88) is not expressible as a polynomial in p p p . Below, we show that every estimator has an expected value that is a polynomial in p p p . The two can therefore never exactly agree over any subinterval p ∈ [ 0 , 1 ] p \in[0,1] p ∈ [ 0 , 1 ] , which is sufficient to conclude the proof.
Let ν \nu ν denote the number of tuning curves drawn from G \mathcal{G} G that are equal to φ 1 \varphi_1 φ 1 . Given our construction, ν \nu ν is a binomial random variable with N Y N_Y N Y trials and success probability p p p . Now let T ^ \widehat{T} T denote any estimator and let t ν = E [ T ^ ∣ ν ] t_\nu= \mathbb{E}[\widehat{T} \mid\nu] t ν = E [ T ∣ ν ] denote the conditional expectation of the estimator given ν \nu ν . Crucially, t ν t_\nu t ν is a constant with respect to p p p since the count variable ν \nu ν contains all information about p p p that is available to any estimator. By the law of total expectation followed by the expression for the expected value of a binomial random variable we have:
E [ T ^ ] = E ν [ t ν ] = ∑ ν = 0 N Y ( N Y ν ) p ν ( 1 − p ) N Y − ν t ν . (89) \mathbb{E}[\widehat{T}] = \mathbb{E}_{\nu}[t_\nu] = \sum_{\nu=0}^{N_Y} \binom{N_Y}{\nu}p^\nu(1-p)^{N_Y-\nu}t_\nu. \tag*{(89)} E [ T ] = E ν [ t ν ] = ν = 0 ∑ N Y ( ν N Y ) p ν ( 1 − p ) N Y − ν t ν . (89)
This is a polynomial in p p p of degree at most N Y N_Y N Y , thus concluding the proof.
The same construction shows that the squared Procrustes distance is also not unbiasedly estimable. Recall that, by the duality of Harvey et al. [16 ] , the squared Procrustes distance between normalized representations is the squared Bures distance between the centered kernel operators,
Proc ∞ 2 ( k ˉ , h ˉ ) = Tr k ˉ + Tr h ˉ − 2 Tr [ ( k ˉ 1 / 2 h ˉ k ˉ 1 / 2 ) 1 / 2 ] . (90) \operatorname{Proc}_{\infty}^{2}(\bar{k},\bar{h}) = \operatorname{Tr}\bar{k} + \operatorname{Tr}\bar{h} - 2\operatorname{Tr}\left[\left(\bar{k}^{1/2}\bar{h}\bar{k}^{1/2}\right)^{1/2}\right]. \tag*{(90)} Proc ∞ 2 ( k ˉ , h ˉ ) = Tr k ˉ + Tr h ˉ − 2 Tr [ ( k ˉ 1/2 h ˉ k ˉ 1/2 ) 1/2 ] . (90)
Proposition F.2. Under the hypotheses of Proposition F.1 , and on the same family of tuning-curve distributions, no estimator of P 2 P^2 P 2 with finite expectation at some interior parameter value is unbiased on any subinterval of [ 0 , 1 ] [0,1] [ 0 , 1 ] .
Proof. Take F \mathcal{F} F and G \mathcal{G} G exactly as in the proof of Proposition F.1 . Since φ 1 \varphi_1 φ 1 is a unit vector, k ˉ = k ˉ 1 / 2 = φ 1 ⊗ φ 1 \bar{k} = \bar{k}^{1/2} = \varphi_1 \otimes\varphi_1 k ˉ = k ˉ 1/2 = φ 1 ⊗ φ 1 . Orthogonality of φ 1 \varphi_1 φ 1 and φ 2 \varphi_2 φ 2 then gives
k ˉ 1 / 2 h ˉ p k ˉ 1 / 2 = p φ 1 ⊗ φ 1 , (91) \bar{k}^{1/2}\bar{h}_p\bar{k}^{1/2} = p\varphi_1 \otimes\varphi_1, \tag*{(91)} k ˉ 1/2 h ˉ p k ˉ 1/2 = p φ 1 ⊗ φ 1 , (91)
whose square root is p φ 1 ⊗ φ 1 \sqrt{p}\varphi_1 \otimes\varphi_1 p φ 1 ⊗ φ 1 . Thus, the Bures fidelity term is
Tr [ ( k ˉ 1 / 2 h ˉ p k ˉ 1 / 2 ) 1 / 2 ] = p , (92) \operatorname{Tr}\left[\left(\bar{k}^{1/2}\bar{h}_p\bar{k}^{1/2}\right)^{1/2}\right] = \sqrt{p}, \tag*{(92)} Tr [ ( k ˉ 1/2 h ˉ p k ˉ 1/2 ) 1/2 ] = p , (92)
while Tr k ˉ = 1 \operatorname{Tr}\bar{k} = 1 Tr k ˉ = 1 and Tr h ˉ p = p + ( 1 − p ) = 1 \operatorname{Tr}\bar{h}_p = p + (1-p) = 1 Tr h ˉ p = p + ( 1 − p ) = 1 , so that
Proc ∞ 2 = 2 − 2 p . (93) \operatorname{Proc}_{\infty}^{2} = 2 - 2\sqrt{p}. \tag*{(93)} Proc ∞ 2 = 2 − 2 p . (93)
The right-hand side of eq. (93) is not a polynomial in p p p . The rest of the proof carries over verbatim from Proposition F.1 : the expectation of any estimator is a polynomial in p p p , and therefore no estimator can be unbiased on this family of problem instances.
The inability of CKA or Procrustes to be estimated with an unbiased estimator has implications for their variance as well. Crucially, because no unbiased estimator exists for either CKA or Procrustes, then neither measure can be constructed as a U-statistic. Hence, the approaches we take in Appendix § 9 and Appendix C no longer apply. Indeed, empirical simulations in Section F.1 reveals that the variance of CKA behaves quite nonlinearly compared to the ordered theory we derive for HSIC and CKA.
The consistency of the plug-in estimator of CKA depends on the order of limits and the structure of the kernel functions
In the main text, we noted that
lim min ( M , N X , N Y ) → ∞ S p i ( X , Y ) = ⟨ k ˉ , h ˉ ⟩ H S , (94) \lim_{\min(M,N_X,N_Y)\to\infty} \operatorname{S}_{\mathrm{pi}}(X,Y) = \langle\bar{k},\bar{h}\rangle_{\mathrm{HS}}, \tag*{(94)} m i n ( M , N X , N Y ) → ∞ lim S pi ( X , Y ) = ⟨ k ˉ , h ˉ ⟩ HS , (94)
and that in this sense the plug-in estimators of both HSIC and CKD are consistent irrespective of how one takes M M M , N X N_X N X , N Y → ∞ N_Y \to\infty N Y → ∞ . Here, we show that CKA is not in general consistent if one takes a proportional high-dimensional limit in which we take M M M , N X N_X N X , N Y → ∞ N_Y \to\infty N Y → ∞ such that
M N X → q X ∈ ( 0 , ∞ ) and M N Y → q Y ∈ ( 0 , ∞ ) . (95) \frac{M}{N_X} \to q_X \in(0,\infty) \quad\text{and} \quad\frac{M}{N_Y} \to q_Y \in(0,\infty). \tag*{(95)} N X M → q X ∈ ( 0 , ∞ ) and N Y M → q Y ∈ ( 0 , ∞ ) . (95)
In particular, depending on the properties of the population kernel function, the limit of the plug-in estimator may deviate by an order-one amount from the desired limit. This result is known, for example, from Chun et al. [4 ] , but we give a self-contained though informal derivation here.
Consider, for simplicity, the case in which the tuning curves are Gaussian, such that the empirical kernel matrices K ^ \widehat{K} K and H ^ \widehat{H} H are Wishart. Expanding the definition, the plug-in estimator of the CKA is
C K A ^ p i ( X , Y ) = 1 M Tr ( C K ^ C H ^ ) 1 M Tr ( C K ^ C K ^ ) 1 M Tr ( C H ^ C H ^ ) . (96) \widehat{\mathrm{CKA}}_{\mathrm{pi}}(X,Y) = \frac{\frac{1}{M}\operatorname{Tr}(C\widehat{K}C\widehat{H})}{\sqrt{\frac{1}{M}\operatorname{Tr}(C\widehat{K}C\widehat{K})\frac{1}{M}\operatorname{Tr}(C\widehat{H}C\widehat{H})}}. \tag*{(96)} CKA pi ( X , Y ) = M 1 Tr ( C K C K ) M 1 Tr ( C H C H ) M 1 Tr ( C K C H ) . (96)
Now, using standard results on Wishart matrix moments, we have that the expectations of the three terms with respect to the Gaussian distribution of tuning curves are
E f , g 1 M Tr ( C K ^ C H ^ ) = 1 M Tr ( C K C H ) , (97) \mathbb{E}_{f,g}\frac{1}{M}\operatorname{Tr}(C\widehat{K}C\widehat{H}) = \frac{1}{M}\operatorname{Tr}(CKCH), \tag*{(97)} E f , g M 1 Tr ( C K C H ) = M 1 Tr ( C K C H ) , (97)
E f , g 1 M Tr ( C K ^ C K ^ ) = ( 1 + 1 N X ) 1 M Tr ( C K C K ) + M N X ( 1 M Tr ( C K ) ) 2 , (98) \mathbb{E}_{f,g}\frac{1}{M}\operatorname{Tr}(C\widehat{K}C\widehat{K}) = \left(1+\frac{1}{N_X}\right)\frac{1}{M}\operatorname{Tr}(CKCK) + \frac{M}{N_X}\left(\frac{1}{M}\operatorname{Tr}(CK)\right)^2, \tag*{(98)} E f , g M 1 Tr ( C K C K ) = ( 1 + N X 1 ) M 1 Tr ( C K C K ) + N X M ( M 1 Tr ( C K ) ) 2 , (98)
and analogously
E f , g 1 M Tr ( C H ^ C H ^ ) = ( 1 + 1 N Y ) 1 M Tr ( C H C H ) + M N Y ( 1 M Tr ( C H ) ) 2 . (99) \mathbb{E}_{f,g}\frac{1}{M}\operatorname{Tr}(C\widehat{H}C\widehat{H}) = \left(1+\frac{1}{N_Y}\right)\frac{1}{M}\operatorname{Tr}(CHCH) + \frac{M}{N_Y}\left(\frac{1}{M}\operatorname{Tr}(CH)\right)^2. \tag*{(99)} E f , g M 1 Tr ( C H C H ) = ( 1 + N Y 1 ) M 1 Tr ( C H C H ) + N Y M ( M 1 Tr ( C H ) ) 2 . (99)
Under standard regularity assumptions on the kernels k k k and h h h , the remaining traces are well-behaved, and moreover the three normalized traces concentrate to their expectations with respect to both neuron and stimulus sampling. This gives, somewhat schematically,
C K A ^ p i ( X , Y ) ∼ C K A ( K , H ) ( 1 + d X ) ( 1 + d Y ) . (100) \widehat{\mathrm{CKA}}_{\mathrm{pi}}(X,Y) \sim\frac{\mathrm{CKA}(K,H)}{\sqrt{(1+d_X)(1+d_Y)}}. \tag*{(100)} CKA pi ( X , Y ) ∼ ( 1 + d X ) ( 1 + d Y ) CKA ( K , H ) . (100)
where we have defined the normalized effective dimensionalities
d X = 1 N X ( Tr ( C K ) ) 2 Tr ( C K C K ) and d Y = 1 N Y ( Tr ( C H ) ) 2 Tr ( C H C H ) . (101) d_X = \frac{1}{N_X}\frac{(\operatorname{Tr}(CK))^2}{\operatorname{Tr}(CKCK)} \quad\text{and} \quad d_Y = \frac{1}{N_Y}\frac{(\operatorname{Tr}(CH))^2}{\operatorname{Tr}(CHCH)}. \tag*{(101)} d X = N X 1 Tr ( C K C K ) ( Tr ( C K ) ) 2 and d Y = N Y 1 Tr ( C H C H ) ( Tr ( C H ) ) 2 . (101)
This is the primary high-dimensional bias result of Chun et al. [4 ] . Here, we have been quite informal: we have not specified the notion of asymptotic equivalence in ∼ \sim ∼ , nor the required regularity on the kernels. But, all of this could be made precise, and the qualitative result stands: if we consider a limit such that d X d_X d X and d Y d_Y d Y do not tend to zero sufficiently rapidly, then the plug-in estimator of the CKA acquires an order-one multiplicative bias. This is, importantly, dependent on the spectral properties of the kernel: roughly speaking if k k k and h h h are trace-class then d X d_X d X and d Y d_Y d Y should tend to zero even if M M M is taken to infinity proportionally with N X N_X N X and N Y N_Y N Y , while if their traces scale with M M M then M M M must be taken to infinity strictly more slowly. The latter is the usual high-dimensional case, while in the former the data have non-extensive intrinsic dimension.
The most extreme, and most illustrative, high-dimensional example is if we considered two independent, isotropic Gaussian clouds, i.e., if K = H = I M K = H = I_M K = H = I M . This corresponds to an infinitely-sharp kernel that is one if two stimuli coincide and zero otherwise. In this case, we of course have that the CKA between K K K and H H H is
C K A ( K , H ) = 1 , (102) \mathrm{CKA}(K,H) = 1, \tag*{(102)} CKA ( K , H ) = 1 , (102)
as they are the same. However,
d X = M − 1 N X ∼ q X and d Y = M − 1 N Y ∼ q Y , (103) d_X = \frac{M-1}{N_X} \sim q_X \quad\text{and} \quad d_Y = \frac{M-1}{N_Y} \sim q_Y, \tag*{(103)} d X = N X M − 1 ∼ q X and d Y = N Y M − 1 ∼ q Y , (103)
so
C K A ^ p i ∼ 1 ( 1 + q X ) ( 1 + q Y ) , (104) \widehat{\mathrm{CKA}}_{\mathrm{pi}} \sim\frac{1}{\sqrt{(1+q_X)(1+q_Y)}}, \tag*{(104)} CKA pi ∼ ( 1 + q X ) ( 1 + q Y ) 1 , (104)
which may be substantially biased downward from one if q X q_X q X and q Y q_Y q Y are not small.
Figure 5. Reproduction of results for CKD in the context of HSIC. (A) Variance of estimating HSIC between random neural networks as in § 4.1 . (B) Variance of estimating HSIC between trained neural networks as in § 4.2 . (C) Variance of estimating HSIC between monkey regions as in § 4.3 . (D) Signal adaptivity of HSIC.
Experimental Results on HSIC and CKA
Here, we show the results for the behavior of Var ( HSIC ) \operatorname{Var}(\operatorname{HSIC}) Var ( HSIC ) in the context of the main experiments presented in the main body of the paper. The results presented here are for the unbiased S s c S_{\mathrm{sc}} S sc estimator, but are qualitatively replicated when using the standard plug-in estimator. Given that we derive a similar upper bound on variance scaling for HSIC as with CKD in Appendix § 9 , it is no surprise that we demonstrate similar qualitative and quantitative results for HSIC as in CKD.
Next, we present the results for the behavior of Var ( CKA ) \operatorname{Var}(\operatorname{CKA}) Var ( CKA ) in the context of the main experiments from the main body of the paper. CKA behaves markedly different in all these scenarios, where its dependence on changes in M M M and N N N vary wildly on both setting and magnitude.
Last, we plot the same trends but for CKA (Figure 7 A-B), which produces similar qualitative results. This is suprising because CKA admits no unbiased estimator, and can diverge qualitatively from the predicted O ( 1 M + 1 N ) O\left(\frac{1}{M}+\frac{1}{N}\right) O ( M 1 + N 1 ) scaling law when comparing one model to another. This suggests that while CKA admits no unbiased estimator, variance in similarity estimation in the top 2 principal components follows the established theoretical trend well, so our experimental prescriptions may hold for a larger class of similarity metrics.
Figure 7. Clustering experiments for CKA. (A) Projection of estimated CKA between 4 deep models and 6 neural recordings from 3 different brain areas. (B) Estimates of Kendall’s τ \tau τ on different degrees of subsampling. (C) Comparisons between Kendall’s τ \tau τ in CKD with CKA.
Figure 6. Reproduction of results for CKD in the context of CKA. Note scaling behavior differs wildly. (A) Variance of estimating CKA between random neural networks as in § 4.1 . (B) Variance of estimating CKA between trained neural networks as in § 4.2 . (C) Variance of estimating CKA between monkey regions as in § 4.3 . (D) Signal adaptivity of CKA.
Notably, the Kendall’s τ \tau τ for CKA are decreased relative to CKD (Figure 7 C). Since CKA is scale-invariant while CKD is not, this suggests that the difference in scale across multiple neural regions and models may be important in understanding multi-system relationships. In other words, the scale invariance of CKA, when comparing multiple monkeys and models to one another, surprisingly hurts one’s ability to determine the proper ordering of the their pairwise relationships in concert, even when comparing across models and neural data. This difference in accuracy is particularly true when recording volume is low, suggesting that using CKD (an estimator that does not normalize the scale of representations) attains more accurate reads of the relationships between the subjects than using CKA (an estimator that normalizes the scales of representations to be equal).
Our explanation for this phenomenon is not necessarily surprising, but ill-documented in the literature. The reason for this is because estimating the true scale of a representation is not known during an experiment where finite M M M and N N N are sampled. Therefore, a similarity measure that demands normalization by scale necessarily would require more samples to attain an accurate estimate. In the case of CKA, not only does one need to get an accurate estimate of S ( K , H ) S(K,H) S ( K , H ) (the numerator), but also S ( K , K ) S ( H , H ) \sqrt{S(K,K)S(H,H)} S ( K , K ) S ( H , H ) (the denominator). Thus, when sample volume is low, errors propagate farther.
Variance Scaling when N X ≠ N Y N_X \ne N_Y N X = N Y
In the main body of the paper, we present empirical verification of 3.1 in experiments where N X = N Y N_X = N_Y N X = N Y . For N = N X = N Y N = N_X = N_Y N = N X = N Y , we showed L-shaped level curves when plotting log-variance against log ( M ) \log(M) log ( M ) and log ( N ) \log(N) log ( N ) , which are predicted by our theory of Var ∼ O ( 1 M + 1 N ) \operatorname{Var} \sim O\left(\frac{1}{M}+\frac{1}{N}\right) Var ∼ O ( M 1 + N 1 ) .
In most practical neuroscience applications, N X ≠ N Y N_X \ne N_Y N X = N Y . In Figure 8 , we show variance scaling in this setting, fixing M M M to be sufficiently large as to be negligible under our theory. Similarly, our results in Figure 8 (A) recapitulate the L-shaped curves from § 4.1 , verifying our theory. Reassuringly, comparing monkey data to monkey data in Figure 8 B also follows theory quite well.
Figure 8. Heatmaps of variance scaling when N X ≠ N Y N_X \ne N_Y N X = N Y and M = 1000 M = 1000 M = 1000 . X-axes are log ( N X ) \log(N_X) log ( N X ) , Y-axes are log ( N Y ) \log(N_Y) log ( N Y ) . (A) Variance of estimating CKD between random neural networks as in § 4.1 . (B) Monkey regions from Papale et al. [35 ] as in 4.3.
Cross-Region Comparisons in Monkey Data
To further illustrate the region-independent nature of our theory, we extend our results from § 4.3 . In Figure 2 B, we plotted variance heatmaps of similarity estimates between the same region across two monkeys. One may protest to our results’ generality; two regions in the same species likely have similar underlying statistics. In Figure 9 , Figure 10 , Figure 11 , Figure 12 , we show that our results can be generalized across arbitrary region-to-region estimation.
Figure 9. Variance of HSIC when subsampling across all regions between the two macaques available in the dataset. Within a set of heatmaps, rows (left-to-right) and columns (top-to-bottom) are ordered as V1, V4, IT. Subplots are ordered as MonkeyF-to-MonkeyN, MonkeyF-to-Monkey-F, and MonkeyN-to-MonkeyN.
Figure 10. Variance of CKD when subsampling across all regions between the two macaques available in the dataset. Within a set of heatmaps, rows (left-to-right) and columns (top-to-bottom) are ordered as V1, V4, IT. Subplots are ordered as MonkeyF-to-MonkeyN, MonkeyF-to-Monkey-F, and MonkeyN-to-MonkeyN.
Figure 11. Relative variance of HSIC when subsampling across all regions between the two macaques available in the dataset. Within a set of heatmaps, rows (left-to-right) and columns (top-to-bottom) are ordered as V1, V4, IT. Subplots are ordered as MonkeyF-to-MonkeyN, MonkeyF-to-Monkey-F, and MonkeyN-to-MonkeyN.
Figure 12. Relative variance of CKD when subsampling across all regions between the two macaques available in the dataset. Within a set of heatmaps, rows (left-to-right) and columns (top-to-bottom) are ordered as V1, V4, IT. Subplots are ordered as MonkeyF-to-MonkeyN, MonkeyF-to-Monkey-F, and MonkeyN-to-MonkeyN.
Almost universally, regardless of which region is compared to which region, regardless of whether we are comparing across monkeys or within monkeys, the variance estimates follow L-shaped curves as predicted by our theory. Notably, the scale of relative variance appears inconstant for the most part regardless of the simulation type, as seen by traversing the corresponding heatmaps across the rows in each figure. Overall, these results reiterate that our theoretical predictions are reproduced in biological data, and serve as a prediction for how to efficiently collect neural data given a finite recording budget.
Model-to-Monkey Comparisons
To evaluate the universality of our claims, we examine the variance of CKD when comparing our trained deep networks to macaque cortex. In Figure 13 , we plot the same heatmaps as before, where the top row is the variance of our CKD estimate and the bottom row is the relative variance of our CKD estimator. Once again, we reproduce the L-shaped, evenly-spaced curves independent of region identity. This further suggests that our theory applies universally regardless of the specific structure of the systems compared. Furthermore, note that the specific value of relative variance appears constant regardless of region identity suggests that differences in the value of CKD variance is largely due to the scale of the underlying CKD score. Hence, the proportion at which one is erroneous in their CKD estimate is region-independent.
Figure 13. Variance of CKD between penultimate model layer and macaque cortex regions. Top row is pure variance of CKD, bottom row is relative variance of CKD (variance divided by true CKD value). Note that relative variance is constant across region identity.
Random Neural Network Construction
Consider two random neural networks k k k , h h h . While their true similarity can be measured by sampling infinitely many M M M or N N N , we want to study how subsampling affects our similarity estimate. We can compare the similarity between k k k and h h h by constructing representations X X X and Y Y Y by presenting M M M inputs and extracting activations from only N N N neurons, keeping the neuron identities constant through sampling.
Consider a neural network k k k with one hidden layer with weights; its outputs are arbitrary as we are only concerned with representations in this untrained hidden layer. For
w ∼ N ( μ k , σ k ) , weights w \sim\mathcal{N}(\mu_k,\sigma_k),\ \text{weights} w ∼ N ( μ k , σ k ) , weights
u ^ ∼ N ( 0 , I D ) , inputs \hat{u} \sim\mathcal{N}(0,I_D),\ \text{inputs} u ^ ∼ N ( 0 , I D ) , inputs
over M M M inputs and N N N neurons.
Before presenting the inputs to the random network, we project the raw u ^ \hat{u} u ^ onto the unit D D D -sphere (where we take u = u ^ ∥ u ^ ∥ u = \frac{\hat{u}}{\lVert\hat{u}\rVert} u = ∥ u ^ ∥ u ^ ). With this, we can collect the neural representation for k k k
X = ReLU ( U W ) , U = ( u 1 ⊤ , … , u M ⊤ ) ∈ R M × D , W = ( w 1 , … , w N ) ∈ R D × N (105) X = \operatorname{ReLU}(UW),\ U = (u_1^\top,\ldots,u_M^\top) \in\mathbb{R}^{M \times D},\ W = (w_1,\ldots,w_N) \in\mathbb{R}^{D \times N} \tag*{(105)} X = ReLU ( U W ) , U = ( u 1 ⊤ , … , u M ⊤ ) ∈ R M × D , W = ( w 1 , … , w N ) ∈ R D × N (105)
Similarly, we can construct neural representation for another shallow, random neural network h h h
Y = ReLU ( U V ) , V = ( v 1 , … , v N ) ∈ R D × N , v ∼ N ( μ h , σ h ) Y = \operatorname{ReLU}(UV),\ V = (v_1,\ldots,v_N) \in\mathbb{R}^{D \times N},\ v \sim\mathcal{N}(\mu_h,\sigma_h) Y = ReLU ( U V ) , V = ( v 1 , … , v N ) ∈ R D × N , v ∼ N ( μ h , σ h )
Thus, we can compare the similarity between k k k and h h h by measuring the similarity between their neural representations X X X and Y Y Y for any similarity measure of our choosing.
We choose this analysis because random neural networks in this setting have been well-studied as approximants of kernel functions in deep networks ([3 ] ). In this particular setting, the eigenstructure of the kernel functions has been well-studied in [2 ] , which gives us access to theoretical values of HSIC (and thus CKD) in the infinite M M M , N N N limit.
Last, as our inputs are bounded, the q q q -factor in our input admits a simple dimension-free bound. It is simple to see why. For any fixed input u u u , w T u w^{\mathsf{T}}u w T u is Gaussian with mean at most ∣ μ ∣ |\mu| ∣ μ ∣ in magnitude and variance σ 2 \sigma^2 σ 2 , and since ∣ f ( u ) ∣ ≤ ∣ w T u ∣ |f(u)| \le|w^{\mathsf{T}}u| ∣ f ( u ) ∣ ≤ ∣ w T u ∣ , a short calculation gives q ≤ 128 μ 4 + 384 σ 4 q \le128\mu^4 + 384\sigma^4 q ≤ 128 μ 4 + 384 σ 4 for every D D D .
Image Dataset Details
We use three public datasets in this paper: the ImageNet dataset ([6 ] ), the MacaqueITBench dataset ([32 ] ), and the THINGS Ventral Spiking Dataset ([35 ] ) (Figure 14 ). The ImageNet dataset contains over 14 million naturalistic images with more than 20,000 unique semantic categories. We use the ImageNet dataset to test and validate our deep networks. Evaluation of performance and estimation of similarity between networks is done on a test set partition of the ImageNet dataset.
Figure 14. Representative images from the ImageNet dataset [6 ] , the MacaqueITBench dataset [32 ] , and the THINGS Ventral Spiking Dataset [35 ] . ImageNet and THINGS both comprise of naturalistic whole-scenes images. MacaqueITBench comprises of natural objects against a white background. Specific image categories intersect but are not identical between the three datasets.
In § 4.2 , we evaluate the effects of in- versus out-of-distribution evaluation data for similarity estimates on our deep networks. We use the MacaqueITBench dataset as a proxy for out-of-distribution image data. The MacaqueITBench dataset consists of 8233 unique natural images. Since the deep models did not see these images during training or evaluation, we use the entire dataset as a pool of test images. The images in the MacaqueITBench dataset differ markedly from the ImageNet dataset; while both datasets comprise of naturalistic images, MacaqueITBench images consist of a natural object on a white background, while ImageNet images are an entire natural scene. The specific images and image categories also differ, so we use the MacaqueITBench dataset as a proxy for out-of-distribution natural images.
We use both image and macaque spiking data from the THINGS Ventral Spiking Dataset (TVSD) in § 4.3 . Image data in TVSD was collected in the THINGS database [19 ] , consisting of 26,107 naturalistic visual images in whole scenes, similar to the ImageNet dataset. The TVSD dataset presented these images to two macaques, recording from V1, V4, and IT using chronic Utah array, consisting of between 200–512 neurons per region. The TVSD dataset is divided into a training set of 22,248 images presented 1 time each (12 images per category) and a test set of 100 images presented at 30 repetitions each. Because our theory suggests that trial-to-trial variability does not significantly impact similarity estimates, to increase the number of M M M we can work with, we use only images and data from the training set.
We threshold for mean reliability > 0.3 > 0.3 > 0.3 and use activations from the remaining neurons for comparison when subsampling; relatively few neurons are filtered out. Recordings are taken over 4 days for one macaque and 7 days for the other, with pseudorandomized image presentations across sessions, although all images are presented. In this paper, we treat the neurons recorded across sessions as identical. Hence, we construct six 22248 × N T O T A L 22248 \times N_{\mathrm{TOTAL}} 22248 × N TOTAL activation matrices, and we randomly bootstrap rows (subsampling M M M ) and columns (subsampling N N N ) to evaluate similarity comparisons over empirical X ∈ R M × N X X \in\mathbb{R}^{M \times N_X} X ∈ R M × N X matrices.
Finally, to illustrate additional examples of how input distribution does not significantly affect variance scaling, we subset these above experiments to just certain classes of images (e.g. animals, foods, machines, toys, etc.). Statistically, this is equivalent to conditioning our entire experiment on input distribution U \mathcal{U} U . In Figure 15 , we show qualitative agreement with results from monkey-to-monkey simulations from § 4.2 : L-shaped curves with consistent spacing regardless of region identity or input distribution. Divergence between the two regions gets corrected when accounting for relative variance, so the proportion to which an estimate is “off” is near-independent of region identity; divergence can largely be chalked up to differences in teh scale of CKD between two input distributions, suggesting that the similarity in representation is not identical over different image classes.
Figure 15. Variance of CKD estimates over specific image classes. (A) Variance of CKD estimates over animal (top) and food (bottom) images. L-shaped curves with consistent spacing found in Figure 2 reproduced. (B) Relative variance of the experiments from (A).
Model Training Details
Model Architecture
We train self-supervised SimCLR models on ImageNet using an all-convolutional encoder with injected Gaussian noise after each convolution.
Let x x x be an input image. The encoder produces a representation h h h and the projection head produces the contrastive embedding z z z :
h = A l l C o n v N e t ( x ) , z = p r o j e c t i o n _ h e a d ( h ) . \begin{aligned}
h &= \mathrm{AllConvNet}(x),\\
z &= \mathrm{projection\_head}(h).
\end{aligned} h z = AllConvNet ( x ) , = projection_head ( h ) .
Contrastive learning loss (Normalized Temperature-scaled Cross-Entropy loss, also known as NT-Xent) is computed on z z z .
After every convolutional layer, activations are injected with Gaussian noise at different parametrizations of σ 2 \sigma^2 σ 2 , such that x → x + N ( 0 , σ 2 ) x \to x + \mathcal{N}(0, \sigma^2) x → x + N ( 0 , σ 2 ) . In the main body of the paper, we focus on 5 models, with σ 2 = 0 , 0.01 , 0.03 , 0.09 \sigma^2 = 0, 0.01, 0.03, 0.09 σ 2 = 0 , 0.01 , 0.03 , 0.09 . through Noise is sampled independently at each forward pass.
Table 1: AllConvNet encoder architecture. All convolutions use 3 × 3 3 \times3 3 × 3 kernels and padding 1. Channel width is layer_dim = 96. After conv7 the feature map is 2 × 2 2 \times2 2 × 2 spatially; global average pooling (adaptive_avg_pool2d to 1 × 1 1 \times1 1 × 1 ) produces a 96-D representation.
Operations are all Conv2d, noise is always σ 2 \sigma^2 σ 2 .
Training Regime
tbl:2 : Training hyperparameters and compute setup.
Training uses the ImageNet train split via LightlyDataset, producing two independently augmented views per image. Validation uses the ImageNet val split, resized to 128 × 128 128 \times128 128 × 128 and ImageNet-normalized, also subsampled at stride 2. Each batch is a pair of views (x 0 , x 1 x_0, x_1 x 0 , x 1 ) of the same images. The model computes z 0 = SimCLR ( x 0 ) z_0 = \operatorname{SimCLR}(x_0) z 0 = SimCLR ( x 0 ) and z 1 = SimCLR ( x 1 ) z_1 = \operatorname{SimCLR}(x_1) z 1 = SimCLR ( x 1 ) , then minimizes NT-Xent between positive pairs across the batch.
During evaluation of similarity estimates, we present M M M randomly sampled images from a dataset of choice (for specifics on the datasets see Appendix § 18 ). We sample N N N random neurons from a desired layer (V1, V4, or IT in monkeys; second-to-last layer consisting of 96 × 4 × 4 = 1536 96 \times4 \times4 = 1536 96 × 4 × 4 = 1536 neurons post-ReLU without additive Gaussian noise in trained neural networks) Thus, we construct the X ∈ R M × N X X \in\mathbb{R}^{M \times N_X} X ∈ R M × N X neural representation matrix. The procedure for drawing neurons can be done either without replacement (subsampling) or with replacement (bootstrapping). In this paper we present the bootstrapped variance estimates, but the results do not qualitatively differ between the two procedures, provided that N N N is less than the total number of neurons in the layer; remarkably, even leaving just 1 out when sampling without replacement recapitulates these results qualitatively.
Sampling Procedure for Section 4.3
In Section 4.3, at each value of M M M , we present M M M random images to the 10 regions of study. From each region, we randomly sample N N N random neurons 10 times to create 10 copies of each region, and compare all pairwise estimates of HSIC, CKD, and CKA between the copies. Hence, we construct a 100 × 100 100 \times100 100 × 100 matrix at each ( M , N ) (M, N) ( M , N ) pair, for M , N ∈ { 10 , 33 , 100 , 1000 } M, N \in\{10, 33, 100, 1000\} M , N ∈ { 10 , 33 , 100 , 1000 } . For the clusters, we apply MDS (10 dimensions) on the 100 × 100 100 \times100 100 × 100 matrix, then project onto the first two principal components.
Next, at each value of ( M , N ) (M, N) ( M , N ) we randomly sample 1 copy from each model to generate a 10 × 10 10 \times10 10 × 10 matrix which we can compute a Kendall’s τ \tau τ against a reference 10 × 10 10 \times10 10 × 10 matrix containing the true distances between each pair of models. We repeat this procedure 128 times and report the mean Kendall’s τ \tau τ in Figure 3 . In this paper, we use the upper-triangular Kendall’s τ \tau τ , but using the row-wise Kendall’s τ \tau τ produces very similar results.