Estimating Neural Representation Alignment from Sparsely Sampled Inputs and Features — part 3/5
Cleaned-text code points [31556, 47125). Bibliography omitted here; source.md includes it.
In Figure 6 , we calculate the CKA between all pair-wise single trial measurements for each brain region and report the mean of each estimator. As before, our estimator yields consistent estimates across different neuron samplings Q Q , while the others remain highly biased. Furthermore, we observe that trial-to-trial similarities for regions V1 and V4 are significantly higher than the region IT. This indicates that the trial-to-trial variability in IT is larger than in earlier visual regions.
## Discussion
Murphy et al. ((2024)) also highlights the sensitivity of the naive CKA estimator to the number of features, with a focus on the ratio of the number of inputs and features. They motivate the problem by showing that the naive CKA ( Equation 1 ) between two independent random matrices X X and Y Y (their entries are i.i.d. standard normal) takes a non-zero value which depends on the ratio of the number of stimuli and neurons: 1 ( 1 + P Q a ) ( 1 + P Q b ) \frac{1}{\sqrt{\left(1+\frac{P}{Q_{a}}\right)\left(1+\frac{P}{Q_{b}}\right)}} (13) in the limit of large P P , Q a Q_{a} , and Q b Q_{b} . They observe that CKA ^ S \widehat{\text{CKA}}_{S} takes value 0 0 in the same setup, resolving this issue of having spurious similarities between independent random matrices. While this observation is correct, Murphy et al. ((2024)) interprets this result as CKA ^ S \widehat{\text{CKA}}_{S} resolving the issue of the naive CKA being sensitive to Q a Q_{a} and Q b Q_{b} (denoted by P 1 P_{1} and P 2 P_{2} in their paper), since CKA ^ S \widehat{\text{CKA}}_{S} value is 0 0 regardless of Q a Q_{a} and Q b Q_{b} . Extrapolating this interpretation, they apply CKA ^ S \widehat{\text{CKA}}_{S} to real neural data in an attempt to resolve the issue of CKA sensitivity to the number of neurons.
However, here we explain that this interpretation is only valid when the true CKA is 0, and therefore cannot be generalized to other cases. CKA ^ S \widehat{\text{CKA}}_{S} returns 0 0 in the random matrix setup, not because it corrects neuron sampling, but because it corrects the stimulus sampling. We can see that by taking the number of stimuli to infinity ( P → ∞ P\to\infty ) in Equation 13 , which makes the CKA estimate approach 0 0 . In practical scenarios, where the measurement matrices are not random, CKA ^ S \widehat{\text{CKA}}_{S} is still sensitive to the number of features as we have shown in Equation 8 . CKA ^ C \widehat{\text{CKA}}_{C} presented in this paper resolves this problem.
Finally, our estimator for the ℋ \mathcal{H} -value can be used for de-biasing other HSIC-based CKA measures, such as angular-CKA introduced in Williams et al. ((2021)) and Representational Similarity Analysis (RSA) ( Kriegeskorte et al., (2008) ) , since these measures also ignore the bias coming from finite neuron sampling.
## Conclusion
We have addressed a key limitation in applying CKA to scenarios where only a subset of features—such as neurons or model units—is observable. While CKA is widely used to compare representations in machine learning and neuroscience, existing estimators systematically underestimate similarity when features are undersampled, a common issue in neural data collection or reduced-dimension network analyses.
Theoretically, we showed how the stimulus-corrected ℋ \mathcal{H} estimator still fails to yield unbiased CKA under partial column sampling. We derived a bias-corrected estimator that handles both input and feature sampling, more accurately recovering true representation similarity. Empirically, our method performed well on both synthetic data and electrophysiological recordings from the ventral visual stream (V1, V4, and IT). Conventional approaches underestimated alignment, particularly for high-dimensional or semantically complex representations, whereas our estimator revealed consistent neural similarity patterns and clearer evidence of object-category disentanglement.
## Supplementary Information
## Appendix A Full derivation of the ℋ \mathcal{H} estimators
### A.1 Expression of ℋ \mathcal{H} in terms of the uncentered kernel
Recall that the kernel is defined as k ( x , y ) = ⟨ ϕ ( x ) , ϕ ( y ) ⟩ k(x,y)=\left\langle\phi(x),\phi(y)\right\rangle and the centered kernel is k ′ ( x , y ) = ⟨ ϕ ( x ) − 𝔼 x [ ϕ ( x ) ] , ϕ ( y ) − 𝔼 x [ ϕ ( x ) ] ⟩ k^{\prime}(x,y)=\left\langle\phi(x)-\mathbb{E}_{x}\left[\phi(x)\right],\phi(y)-\mathbb{E}_{x}\left[\phi(x)\right]\right\rangle . Then ℋ \mathcal{H} is defined as
ℋ ( k ( a ) , k ( b ) ) = 𝔼 x , y [ k ′ ( x , y ) ( a ) k ′ ( x , y ) ( b ) ] \mathcal{H}(k^{(a)},k^{(b)})=\mathbb{E}_{x,y}\left[k^{\prime}{}^{(a)}(x,y)k^{\prime}{}^{(b)}(x,y)\right]
Note that k ′ k^{\prime} can be written in terms of k k :
k ′ ( x , y ) = ⟨ ϕ ( x ) − 𝔼 x [ ϕ ( x ) ] , ϕ ( y ) − 𝔼 x [ ϕ ( x ) ] ⟩ k^{\prime}(x,y)=\left\langle\phi(x)-\mathbb{E}_{x}\left[\phi(x)\right],\phi(y)-\mathbb{E}_{x}\left[\phi(x)\right]\right\rangle
= k ( x , y ) − 𝔼 z [ k ( x , z ) ] − 𝔼 z [ k ( z , y ) ] + 𝔼 z , w [ k ( z , w ) ] . =k(x,y)-\mathbb{E}_{z}\left[k(x,z)\right]-\mathbb{E}_{z}\left[k(z,y)\right]+\mathbb{E}_{z,w}\left[k(z,w)\right]. Plugging this into our definition of ℋ \mathcal{H} , we arrive at the expression of ℋ \mathcal{H} explicitly in terms of the original uncentered kernels, k ( a ) k^{(a)} and k ( b ) k^{(b)} :
ℋ ( k ( a ) , k ( b ) ) = 𝔼 x , y [ k ( a ) ( x , y ) k ( b ) ( x , y ) ] − 2 𝔼 x , y , z [ k ( a ) ( x , y ) k ( b ) ( x , z ) ] + 𝔼 x , y [ k ( a ) ( x , y ) ] 𝔼 x , y [ k ( b ) ( x , y ) ] \mathcal{H}(k^{(a)},k^{(b)})=\mathbb{E}_{x,y}\left[k^{(a)}(x,y)k^{(b)}(x,y)\right]-2\mathbb{E}_{x,y,z}\left[k^{(a)}(x,y)k^{(b)}(x,z)\right]+\mathbb{E}_{x,y}\left[k^{(a)}(x,y)\right]\mathbb{E}_{x,y}\left[k^{(b)}(x,y)\right]
We want to derive an estimator where each term has an expected value that is equal to an individual term above.
### A.2 Identifying the source of bias in the naive estimator
We begin our analysis by considering the naive ℋ \mathcal{H} estimator:
ℋ ^ 0 ( Φ ( a ) , Φ ( b ) ) = 1 P 2 tr ( H K ( a ) H K ( b ) ) \widehat{\mathcal{H}}_{0}(\Phi^{(a)},\Phi^{(b)})=\frac{1}{P^{2}}\text{tr}\left(HK^{(a)}HK^{(b)}\right) where H = I − 1 P 11 ⊤ H=I-\frac{1}{P}11^{\top} and K ( a ) = 1 Q Φ ( a ) Φ ( a ) ⊤ K^{(a)}=\frac{1}{Q}\Phi^{(a)}\Phi^{(a)\top} . When we expand this, we get
ℋ ^ 0 ( Φ ( a ) , Φ ( b ) ) = 1 P 2 ∑ i j = 1 P K i j ( a ) K i j ( b ) − 2 P 3 ∑ i j l = 1 P K i j ( a ) K j l ( b ) + 1 P 4 ∑ i j l m = 1 P K i j ( a ) K l m ( b ) . \widehat{\mathcal{H}}_{0}(\Phi^{(a)},\Phi^{(b)})=\frac{1}{P^{2}}\sum_{ij=1}^{P}K_{ij}^{(a)}K_{ij}^{(b)}-\frac{2}{P^{3}}\sum_{ijl=1}^{P}K_{ij}^{(a)}K_{jl}^{(b)}+\frac{1}{P^{4}}\sum_{ijlm=1}^{P}K_{ij}^{(a)}K_{lm}^{(b)}.
Note that K ( a ) K^{(a)} and K ( b ) K^{(b)} are dependent on the stimuli { x i } i = 1 P \left\{x_{i}\right\}_{i=1}^{P} such that, for example K i j ( a ) = k ( a ) ( x i , x j ) K_{ij}^{(a)}=k^{(a)}(x_{i},x_{j}) . Now, let us take the average of ℋ ^ 0 \widehat{\mathcal{H}}_{0} over all possible stimuli sets { x i } i = 1 P \left\{x_{i}\right\}_{i=1}^{P} sampled from 𝒳 \mathcal{X} . We can compute the expected value separately for each term and add them together for the final result. Let us consider the first term:
𝔼 { x i } i = 1 P [ 1 P 2 ∑ i j = 1 P K i j ( a ) K i j ( b ) ] = 1 P 2 𝔼 { x i } i = 1 P [ ∑ i j = 1 P k ( a ) ( x i , x j ) k ( b ) ( x i , x j ) ] \mathbb{E}_{\left\{x_{i}\right\}_{i=1}^{P}}\left[\frac{1}{P^{2}}\sum_{ij=1}^{P}K_{ij}^{(a)}K_{ij}^{(b)}\right]=\frac{1}{P^{2}}\mathbb{E}_{\left\{x_{i}\right\}_{i=1}^{P}}\left[\sum_{ij=1}^{P}k^{(a)}(x_{i},x_{j})k^{(b)}(x_{i},x_{j})\right]
= 1 P 2 ∑ i ≠ j P 𝔼 x , x ′ [ k ( a ) ( x , x ′ ) k ( b ) ( x , x ′ ) ] + 1 P 2 ∑ i P 𝔼 x [ k ( a ) ( x , x ) k ( b ) ( x , x ) ] =\frac{1}{P^{2}}\sum_{i\neq j}^{P}\mathbb{E}_{x,x^{\prime}}\left[k^{(a)}(x,x^{\prime})k^{(b)}(x,x^{\prime})\right]+\frac{1}{P^{2}}\sum_{i}^{P}\mathbb{E}_{x}\left[k^{(a)}(x,x)k^{(b)}(x,x)\right]
= ( P − 1 P ) 𝔼 x , x ′ [ k ( a ) ( x , x ′ ) k ( b ) ( x , x ′ ) ] + 1 P 𝔼 x [ k ( a ) ( x , x ) k ( b ) ( x , x ) ] =\left(\frac{P-1}{P}\right)\mathbb{E}_{x,x^{\prime}}\left[k^{(a)}(x,x^{\prime})k^{(b)}(x,x^{\prime})\right]+\frac{1}{P}\mathbb{E}_{x}\left[k^{(a)}(x,x)k^{(b)}(x,x)\right]
= 𝔼 x , x ′ [ k ( a ) ( x , x ′ ) k ( b ) ( x , x ′ ) ] + 1 P ( 𝔼 x [ k ( a ) ( x , x ) k ( b ) ( x , x ) ] − 𝔼 x , x ′ [ k ( a ) ( x , x ′ ) k ( b ) ( x , x ′ ) ] ) =\mathbb{E}_{x,x^{\prime}}\left[k^{(a)}(x,x^{\prime})k^{(b)}(x,x^{\prime})\right]+\frac{1}{P}\left(\mathbb{E}_{x}\left[k^{(a)}(x,x)k^{(b)}(x,x)\right]-\mathbb{E}_{x,x^{\prime}}\left[k^{(a)}(x,x^{\prime})k^{(b)}(x,x^{\prime})\right]\right) Notice that in the second equality, we separate the sum into two parts, based on whether the indices overlap or not: i = j i=j vs i ≠ j i\neq j . This is essential since the expected values are different for these two cases. Note that in the second term here is 𝒪 ( 1 / P ) \mathcal{O}(1/P) , contributing as bias. We would not have gotten this bias if the term 1 P 2 ∑ i j = 1 P K i j ( a ) K i j ( b ) \frac{1}{P^{2}}\sum_{ij=1}^{P}K_{ij}^{(a)}K_{ij}^{(b)} was instead defined as 1 P ( P − 1 ) ∑ i ≠ j P K i j ( a ) K i j ( b ) \frac{1}{P\left(P-1\right)}\sum_{i\neq j}^{P}K_{ij}^{(a)}K_{ij}^{(b)} . In that case, the expected value does not have a bias:
𝔼 { x i } i = 1 P [ 1 P ( P − 1 ) ∑ i ≠ j P K i j ( a ) K i j ( b ) ] = 𝔼 x , x ′ [ k ( a ) ( x , x ′ ) k ( b ) ( x , x ′ ) ] . \mathbb{E}_{\left\{x_{i}\right\}_{i=1}^{P}}\left[\frac{1}{P\left(P-1\right)}\sum_{i\neq j}^{P}K_{ij}^{(a)}K_{ij}^{(b)}\right]=\mathbb{E}_{x,x^{\prime}}\left[k^{(a)}(x,x^{\prime})k^{(b)}(x,x^{\prime})\right]. Note that 1 P ( P − 1 ) \frac{1}{P\left(P-1\right)} is introduced as a scaling factor since P ( P − 1 ) P\left(P-1\right) is the number of summand in ∑ i ≠ j P \sum_{i\neq j}^{P} .
### A.3 Derivation of the stimulus-corrected ℋ \mathcal{H} estimator
Applying the same logic to the rest of the terms in ℋ ^ 0 ( Φ ( a ) , Φ ( b ) ) \widehat{\mathcal{H}}_{0}(\Phi^{(a)},\Phi^{(b)}) , we arrive at an estimator that removes the bias from input sampling:
ℋ ^ S ( Φ ( a ) , Φ ( b ) ) = 1 P ( P − 1 ) ∑ i ≠ j P K i j ( a ) K i j ( b ) − 2 P ( P − 1 ) ( P − 2 ) ∑ i ≠ j ≠ l P K i j ( a ) K j l ( b ) + 1 P ( P − 1 ) ( P − 2 ) ( P − 3 ) ∑ i ≠ j ≠ l ≠ m P K i j ( a ) K l m ( b ) . \widehat{\mathcal{H}}_{S}(\Phi^{(a)},\Phi^{(b)})=\frac{1}{P\left(P-1\right)}\sum_{i\neq j}^{P}K_{ij}^{(a)}K_{ij}^{(b)}-\frac{2}{P\left(P-1\right)\left(P-2\right)}\sum_{i\neq j\neq l}^{P}K_{ij}^{(a)}K_{jl}^{(b)}+\frac{1}{P\left(P-1\right)\left(P-2\right)\left(P-3\right)}\sum_{i\neq j\neq l\neq m}^{P}K_{ij}^{(a)}K_{lm}^{(b)}. This is equivalent to the estimator by Song et al. Note that these sums over disjoint indices, e.g. ∑ i ≠ j ≠ l P \sum_{i\neq j\neq l}^{P} , are practically difficult to compute, so they are decomposed into a linear combination of regular sums. Denoting K i j ( a ) K l m ( b ) K_{ij}^{(a)}K_{lm}^{(b)} as v i j l m v_{ijlm} , the first term can be rewritten as:
∑ i ≠ j P K i j ( a ) K i j ( b ) = ∑ i j v i j i j − ∑ i v i i i i , \sum_{i\neq j}^{P}K_{ij}^{(a)}K_{ij}^{(b)}=\sum_{ij}v_{ijij}-\sum_{i}v_{iiii}, whereas the second term can be:
∑ i ≠ j ≠ l P K i j ( a ) K j l ( b ) = ∑ i j l v i j j l − ∑ i j v i i i j − ∑ i j v i j j j − ∑ i j v i j i j + ∑ i 2 v i i i i , \sum_{i\neq j\neq l}^{P}K_{ij}^{(a)}K_{jl}^{(b)}=\sum_{ijl}v_{ijjl}-\sum_{ij}v_{iiij}-\sum_{ij}v_{ijjj}-\sum_{ij}v_{ijij}+\sum_{i}2v_{iiii}, and the third term:
∑ i ≠ j ≠ l ≠ m P K i j ( a ) K l m ( b ) = ∑ i j l m v i j l m − ∑ i j l ( v i i j l + v j l i i + 4 v i j j l ) + ∑ i j ( v i i j j + 4 v i i i j + 4 v i j j j + 2 v i j i j ) − ∑ i 6 v i i i i \sum_{i\neq j\neq l\neq m}^{P}K_{ij}^{(a)}K_{lm}^{(b)}=\sum_{ijlm}v_{ijlm}-\sum_{ijl}\left(v_{iijl}+v_{jlii}+4v_{ijjl}\right)+\sum_{ij}\left(v_{iijj}+4v_{iiij}+4v_{ijjj}+2v_{ijij}\right)-\sum_{i}6v_{iiii}
Replacing the terms in ℋ ^ S ( Φ ( a ) , Φ ( b ) ) \widehat{\mathcal{H}}_{S}(\Phi^{(a)},\Phi^{(b)}) with these new notations, we arrive at the following expression:
ℋ ^ S ( Φ ( a ) , Φ ( b ) ) = 1 P ( P − 3 ) × ( ( ∑ i j v i j i j − ∑ i v i i i i ) − 2 ( P − 2 ) ( ∑ i j l v i j j l − ∑ i j v i i i j − ∑ i j v i j j j + ∑ i v i i i i ) + 1 ( P − 1 ) ( P − 2 ) ( ∑ i j l m v i j l m − ∑ i j l v i i j l − ∑ i j l v j l i i + ∑ i j v i i j j ) ) \widehat{\mathcal{H}}_{S}(\Phi^{(a)},\Phi^{(b)})=\frac{1}{P\left(P-3\right)}\times\\ \left(\left(\sum_{ij}v_{ijij}-\sum_{i}v_{iiii}\right)-\frac{2}{\left(P-2\right)}\left(\sum_{ijl}v_{ijjl}-\sum_{ij}v_{iiij}-\sum_{ij}v_{ijjj}+\sum_{i}v_{iiii}\right)+\frac{1}{\left(P-1\right)\left(P-2\right)}\left(\sum_{ijlm}v_{ijlm}-\sum_{ijl}v_{iijl}-\sum_{ijl}v_{jlii}+\sum_{ij}v_{iijj}\right)\right) (S1)
ℋ ^ S ( Φ ( a ) , Φ ( b ) ) = 1 P 3 ( P − 3 ) × ∑ i j l m ( ( v i j i j − v i i i i P ) − 2 P P − 2 ( v i j j l − v i i i j P − v i j j j P + v i i i i P 2 ) + P 2 ( P − 1 ) ( P − 2 ) ( v i j l m − v i i j l P − v j l i i P + v i i j j P 2 ) ) \widehat{\mathcal{H}}_{S}(\Phi^{(a)},\Phi^{(b)})=\frac{1}{P^{3}\left(P-3\right)}\times\\ \sum_{ijlm}\left(\left(v_{ijij}-\frac{v_{iiii}}{P}\right)-\frac{2P}{P-2}\left(v_{ijjl}-\frac{v_{iiij}}{P}-\frac{v_{ijjj}}{P}+\frac{v_{iiii}}{P^{2}}\right)+\frac{P^{2}}{\left(P-1\right)\left(P-2\right)}\left(v_{ijlm}-\frac{v_{iijl}}{P}-\frac{v_{jlii}}{P}+\frac{v_{iijj}}{P^{2}}\right)\right) (S2)
Suppose K ′ K^{\prime} is a version of K K whose diagonal elements are 0 0 , and v ′ i j l m ≔ K ′ i j ( a ) K ′ l m ( b ) v^{\prime}_{ijlm}\coloneqq K^{\prime}{}_{ij}^{(a)}K^{\prime}{}_{lm}^{(b)} . Then, the above expression simplifies to
ℋ ^ S ( Φ ( a ) , Φ ( b ) ) = 1 P ( P − 3 ) ( ∑ i j v i j i j ′ − 2 ( P − 2 ) ∑ i j l v i j j l ′ + 1 ( P − 1 ) ( P − 2 ) ∑ i j l m v i j l m ′ ) \widehat{\mathcal{H}}_{S}(\Phi^{(a)},\Phi^{(b)})=\frac{1}{P\left(P-3\right)}\left(\sum_{ij}v^{\prime}_{ijij}-\frac{2}{\left(P-2\right)}\sum_{ijl}v^{\prime}_{ijjl}+\frac{1}{\left(P-1\right)\left(P-2\right)}\sum_{ijlm}v^{\prime}_{ijlm}\right)
= 1 P ( P − 3 ) ( tr ( K ′ K ′ ( a ) ) ( b ) − 2 ( P − 2 ) 1 ⊤ K ′ K ′ ( a ) 1 ( b ) + 1 ( P − 1 ) ( P − 2 ) 1 ⊤ K ′ 11 ⊤ ( a ) K ′ 1 ( b ) ) =\frac{1}{P\left(P-3\right)}\left(\text{tr}\left(K^{\prime}{}^{(a)}K^{\prime}{}^{(b)}\right)-\frac{2}{\left(P-2\right)}1^{\top}K^{\prime}{}^{(a)}K^{\prime}{}^{(b)}1+\frac{1}{\left(P-1\right)\left(P-2\right)}1^{\top}K^{\prime}{}^{(a)}11^{\top}K^{\prime}{}^{(b)}1\right) which is the exact expression found in Song et al. ((2012)) .
### A.4 Derivation of the stimulus-neuron-corrected ℋ \mathcal{H} estimator
Our estimator assumes that the features are also sampled, and the features are correlated or identical in (a) and (b). Let us consider a single term v i j l m v_{ijlm} (redefined here as K i j ( a ) K l m ( a ) K_{ij}^{(a)}K_{lm}^{(a)} reflecting a = b a=b ) and see how the sampling of features contribute to the bias.