Block D — Optional: coherent sets from data
Section 4 of the paper replaces the analytic $\K_\tau$ by a $d\times d$ matrix built from time-lagged covariances (Eqs. 22–24) and asserts this reduces to Eq. (18) for OU (Supplement Sec. 6). A prelude first separates the learning problem (how a neuron with any function class could find a singular function from its own input: a variational objective and a time-lagged Hebbian rule) from the approximation problem (what a finite dictionary loses, and why it also regularises). Problem 13 then derives that matrix from scratch: what a Galerkin projection is, why Eq. (22) is the answer, and what is lost when the features do not span an invariant subspace. (Eq. (24) itself needs none of this: it is the eliminated stationarity condition of past–future CCA, as the remark after 14(a) shows; Galerkin is what gives Eq. (22) a meaning and tells you when the CCA answer is exact.) Problem 14 derives past–future CCA from scratch, checks the OU claim on simulated data, and identifies the estimator with it. Problem 15 asks whether taking exact eigenvectors of the compressed operator is the right target, and in what sense. Problem 16 applies the machinery to the dead-leaves stimulus of the paper's Fig. 2 and explains what the transient filter predicts.
Prelude — learning versus approximation
What a neuron with an unlimited basis would do. Section 4 of the paper moves in one step from "the neuron should compute a singular function" to the Galerkin matrices of Eqs. (22)–(24). That step bundles two different problems. The learning problem: a neuron has no access to $\K_\tau$, only to its own input stream, so how could it find a singular function from data at all, even if it could represent any function it liked? The approximation problem: a real neuron's synapses fix a finite set of features, so what is lost when the search is confined to their span? Keeping the two apart shows that Galerkin is not a different algorithm from "learn the singular function" but a parametrisation of it, and that Eqs. (22)–(24) describe the fixed point of a learning rule rather than the rule itself.
The learning problem is variational. Throughout this prelude the process is stationary with density $\rho_0$, the inner product is $\ip{f,g}=\E[f(X_t)g(X_t)]$, and $\K_\tau f(x)=\E[f(X_{t+\tau})\mid X_t=x]$. The subdominant singular value is the value of an optimisation problem whose every ingredient is a second moment of the data stream: $$\sigma_1=\max\Big\{\E\big[g(X_t)\,f(X_{t+\tau})\big]\;:\;\E[f^2]=\E[g^2]=1,\ \E[f]=\E[g]=0\Big\},$$ attained at the subdominant singular pair (Q1(i)). Here $g$ is evaluated on the present state and is the predictive function (its sign is membership in the earlier set), $f$ is evaluated on the later state and is the retrospective one; in the paper's notation of Eq. (8), $g=v_1$ and $f=u_1$. Nothing in the problem refers to the transition kernel. A learner that can evaluate candidate functions on pairs of samples $\tau$ apart, and adjust them uphill, will find the singular pair, whatever basis the functions are written in.
The rule is time-lagged Hebbian and needs two neurons. Gradient ascent on the constrained objective updates $g$ in the direction of its present input times the partner's output $\tau$ later, and $f$ in the direction of its input times the partner's output $\tau$ earlier, each with an anti-Hebbian term in its own output that pins the variance (Q1(ii)). It is canonical correlation analysis between present and future, learned online, and the predictive and retrospective neurons are each other's teaching signal. Non-reversibility (Problem 14(b)(ii)) is therefore not the only reason to expect two populations: even the learning problem needs a $g$ to correlate $f$ against.
Galerkin is the same problem in coordinates. Writing $f=\vec a\cdot\vec\phi$ and $g=\vec b\cdot\vec\phi$ turns the objective into $\vec b^{\,\top}\Sigma_\tau\vec a$ with constraints $\vec a^{\,\top}\Sigma_0\vec a=\vec b^{\,\top}\Sigma_0\vec b=1$, whose stationary points are those of Problem 14(a) and whose solution is the SVD of $\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$, i.e. Eqs. (22)–(24). With a complete basis the coordinate problem is the exact problem; with a finite basis it is the compressed problem of Problem 15, whose optimum can only be lower (15(a)) and whose maximiser is in general not the projection of the true singular function, and may be a different singular function altogether (Q1(iii)).
Why the paper can afford the jump, and why a small basis is also a virtue. For OU dynamics with linear features nothing is lost (13(d)), so in the case the paper analyses the approximation problem is empty. For a real cell the basis is not chosen: its synapses are its features. And with finite data an unrestricted function class is worse than useless, because the empirical objective can be driven to its maximum by interpolating noise (Q1(iv)); a small dictionary is a regulariser as well as a constraint. What one neuron cannot represent, a hierarchy can: the rectified outputs of upstream neurons are new, nonlinear features for downstream ones, which is the paper's remark that features "can be hierarchically composed without backpropagation".
Q1(i) The variational characterisation. Show that $\ip{g,\K_\tau f}=\E[g(X_t)f(X_{t+\tau})]$, and then that the maximum of this quantity over $\|f\|=\|g\|=1$, $f\perp1$, $g\perp1$ equals $\sigma_1$ and is attained at the subdominant singular pair. Which of $f,g$ is the predictive function?
Answer
Step 1 (the objective is a lagged second moment). By the definition of the inner product, $\ip{g,\K_\tau f}=\E[g(X_t)\,(\K_\tau f)(X_t)]$. By the definition of $\K_\tau$, $(\K_\tau f)(X_t)=\E[f(X_{t+\tau})\mid X_t]$. By the "taking out what is known" rule for conditional expectation ($g(X_t)$ is a function of the conditioning variable), $g(X_t)\,\E[f(X_{t+\tau})\mid X_t]=\E[g(X_t)f(X_{t+\tau})\mid X_t]$. By the tower property (Block 0, interlude), $\E\big[\E[g(X_t)f(X_{t+\tau})\mid X_t]\big]=\E[g(X_t)f(X_{t+\tau})]$. Chaining the four equalities gives the claim. Likewise $\|f\|^2=\E[f(X_t)^2]=\E[f(X_{t+\tau})^2]$ by stationarity, and $f\perp1$ means $\E[f(X_t)]=0$ by the definition of the inner product with the constant function.
Step 1 by direct integration. Write $\K_\tau$ as an integral operator, $\K_\tau f(x)=\int p_\tau(y\mid x)f(y)\,dy$ (the conditional expectation of a process with transition density $p_\tau$), and the inner product as an integral against $\rho_0$: $$\ip{g,\K_\tau f}=\int g(x)\Big[\int p_\tau(y\mid x)f(y)\,dy\Big]\rho_0(x)\,dx=\iint g(x)f(y)\,\big[\rho_0(x)\,p_\tau(y\mid x)\big]\,dx\,dy=\E[g(X_t)f(X_{t+\tau})].$$ Second equality: $g(x)\rho_0(x)$ is constant in $y$, so it moves inside the inner integral; the order of integration is immaterial because the double integral converges absolutely (Fubini; $f,g\in L^2(\rho_0)$ suffices by Cauchy–Schwarz). Third: $\rho_0(x)p_\tau(y\mid x)$ is the joint density of $(X_t,X_{t+\tau})$ (chain rule for densities: joint = marginal of the first times conditional of the second), and integrating a function of two variables against their joint density is its expectation. The tower property of the first version is the statement that the inner integral may be done first.
Step 2 (singular system). $\K_\tau$ is a contraction on $L^2(\rho_0)$ (Problem 7) and, under the paper's compactness assumption, has a singular system: orthonormal families $\{e_i\}$ and $\{h_i\}$ and numbers $1=\sigma_0\ge\sigma_1\ge\sigma_2\ge\cdots\ge0$ with $\K_\tau e_i=\sigma_ih_i$ and $\K_\tau^\dagger h_i=\sigma_ie_i$, so that $\K_\tau f=\sum_i\sigma_i\ip{e_i,f}h_i$ for every $f$. The top pair is $e_0=h_0=1$ with $\sigma_0=1$: $\K_\tau1=1$ because the conditional expectation of a constant is that constant, and $\K_\tau^\dagger1=1$ because stationarity makes $\rho_0$ invariant (Problem 7). No singular value exceeds the operator norm, which is $\le1$ for a contraction, so $\sigma_0=1$ is the largest.
Step 3 (expand and bound). Write $f=\sum_i\alpha_ie_i+f_\perp$ with $f_\perp$ orthogonal to all $e_i$ (so $\K_\tau f_\perp=0$ by the expansion above), and $g=\sum_i\beta_ih_i+g_\perp$ similarly. Then, by the expansion of $\K_\tau$ and orthonormality of $\{h_i\}$, $$\ip{g,\K_\tau f}=\sum_i\sigma_i\alpha_i\beta_i .$$ The constraints $f\perp1$ and $g\perp1$ say $\alpha_0=\ip{e_0,f}=0$ and $\beta_0=0$, so the sum starts at $i=1$. Now bound: $\sum_{i\ge1}\sigma_i\alpha_i\beta_i\le\sigma_1\sum_{i\ge1}|\alpha_i\beta_i|$ (ordering of the singular values), $\le\sigma_1\big(\sum\alpha_i^2\big)^{1/2}\big(\sum\beta_i^2\big)^{1/2}$ (Cauchy–Schwarz in $\ell^2$), $\le\sigma_1\|f\|\,\|g\|=\sigma_1$ (Bessel's inequality and the unit-norm constraints). Equality holds for $f=e_1$, $g=h_1$, which satisfy all constraints. So the maximum is $\sigma_1$, attained at the subdominant singular pair.
Which is which. $g$ is evaluated at $X_t$, the present, so $\operatorname{sign}g(X_t)$ is a statement about the current state that is correlated with $f(X_{t+\tau})$, a statement about the future: $g$ is the predictive function and its positive set is the earlier member $A$ of the coherent pair. $f$ is the retrospective function and its positive set is $B$. In the paper's Eq. (8), $\K_\tau u_i=\lambda_iv_i$, so the function that is fed to $\K_\tau$ lives on the later slice: $f=u_1$, $g=v_1$.
Q1(ii) The learning rule. Parametrise $f=\vec a\cdot\vec\phi$ and $g=\vec b\cdot\vec\phi$ with zero-mean features, and write the constrained problem with Lagrange multipliers. Derive gradient ascent on $\vec a,\vec b$, rewrite each gradient as an expectation of products of the neuron's own input and output samples, and hence as a stochastic (one-sample) rule. Interpret the terms, show the multipliers equal the achieved objective at a stationary point, and show that the stationary points are the CCA equations of Problem 14(a), i.e. Eqs. (22)–(24).
Answer
Setup. With $[\Sigma_0]_{ij}=\E[\phi_i(X_t)\phi_j(X_t)]$ and $[\Sigma_\tau]_{ij}=\E[\phi_i(X_t)\phi_j(X_{t+\tau})]$ (Problem 13(b)), the objective is, by linearity of expectation, $\E[g(X_t)f(X_{t+\tau})]=\sum_{ij}b_ia_j\E[\phi_i(X_t)\phi_j(X_{t+\tau})]=\vec b^{\,\top}\Sigma_\tau\vec a$, and the constraints are $\vec a^{\,\top}\Sigma_0\vec a=1$, $\vec b^{\,\top}\Sigma_0\vec b=1$ (same rule); the mean-zero constraints hold automatically because the features have mean zero. The Lagrangian is $$L(\vec a,\vec b,\alpha,\beta)=\vec b^{\,\top}\Sigma_\tau\vec a-\tfrac{\alpha}{2}\big(\vec a^{\,\top}\Sigma_0\vec a-1\big)-\tfrac{\beta}{2}\big(\vec b^{\,\top}\Sigma_0\vec b-1\big).$$
Step 1 (gradients). Rules: $\nabla_{\vec b}(\vec b^{\,\top}M\vec a)=M\vec a$ and $\nabla_{\vec a}(\vec b^{\,\top}M\vec a)=M^\top\vec b$ (gradient of a linear form); $\nabla_{\vec b}\tfrac12\vec b^{\,\top}S\vec b=S\vec b$ for symmetric $S$ (gradient of a quadratic form). Hence $$\nabla_{\vec b}L=\Sigma_\tau\vec a-\beta\,\Sigma_0\vec b,\qquad \nabla_{\vec a}L=\Sigma_\tau^\top\vec b-\alpha\,\Sigma_0\vec a .$$
Step 2 (gradients as expectations). By the definition of $\Sigma_\tau$ and linearity of expectation, $\Sigma_\tau\vec a=\E\big[\vec\phi(X_t)\,\vec a\cdot\vec\phi(X_{t+\tau})\big]=\E[\vec\phi(X_t)\,f(X_{t+\tau})]$; by the definition of $\Sigma_0$, $\Sigma_0\vec b=\E[\vec\phi(X_t)\,g(X_t)]$. By the definition of the transpose, $\Sigma_\tau^\top\vec b=\E[\vec\phi(X_{t+\tau})\,g(X_t)]$, and by stationarity $\Sigma_0\vec a=\E[\vec\phi(X_{t+\tau})f(X_{t+\tau})]$. Gradient ascent with step $\eta$ is therefore $$\Delta\vec b=\eta\,\E\big[\vec\phi(X_t)\big(f(X_{t+\tau})-\beta\,g(X_t)\big)\big],\qquad \Delta\vec a=\eta\,\E\big[\vec\phi(X_{t+\tau})\big(g(X_t)-\alpha\,f(X_{t+\tau})\big)\big].$$
Step 3 (one-sample rule). Each update is an expectation of a quantity computable from one pair of samples, so replacing the expectation by that quantity gives an unbiased stochastic gradient (its expectation is the gradient by construction): $$\Delta\vec b=\eta\,\vec\phi(x_t)\big[f(x_{t+\tau})-\beta\,g(x_t)\big],\qquad \Delta\vec a=\eta\,\vec\phi(x_{t+\tau})\big[g(x_t)-\alpha\,f(x_{t+\tau})\big].$$ Interpretation. The predictive neuron's weights $\vec b$ change by its own input $\vec\phi(x_t)$ times the retrospective partner's output $f(x_{t+\tau})$ one horizon later: a Hebbian term across time. The subtracted piece is its input times its own output, an anti-Hebbian (Oja-type) decay that holds $\E[g^2]$ at one. The retrospective neuron's rule is the mirror image, with its partner's output one horizon earlier. Each neuron needs its partner's output at a time offset by $\tau$, which in a circuit means a delay line or an eligibility trace, but it needs nothing else: no kernel, no model of the dynamics. The paper's Section 4 gives the fixed point of this rule, not the rule.
Step 4 (the multipliers). At a stationary point both gradients vanish. Multiply $\Sigma_\tau\vec a=\beta\Sigma_0\vec b$ on the left by $\vec b^{\,\top}$: $\vec b^{\,\top}\Sigma_\tau\vec a=\beta\,\vec b^{\,\top}\Sigma_0\vec b=\beta$ (constraint). Multiply $\Sigma_\tau^\top\vec b=\alpha\Sigma_0\vec a$ on the left by $\vec a^{\,\top}$: $\vec a^{\,\top}\Sigma_\tau^\top\vec b=\alpha$; and $\vec a^{\,\top}\Sigma_\tau^\top\vec b=(\vec b^{\,\top}\Sigma_\tau\vec a)^\top=\vec b^{\,\top}\Sigma_\tau\vec a$ (a scalar equals its transpose). So $\alpha=\beta=\vec b^{\,\top}\Sigma_\tau\vec a$, the achieved objective, as in Problem 14(a).
Step 5 (the fixed point is CCA). Writing the common multiplier as $\rho$, the stationarity conditions read $\Sigma_\tau\vec a=\rho\,\Sigma_0\vec b$ and $\Sigma_\tau^\top\vec b=\rho\,\Sigma_0\vec a$: exactly the CCA conditions of Problem 14(a) with $X=\vec\phi(x_t)$, $Y=\vec\phi(x_{t+\tau})$, whose solutions are the singular pairs of $\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$ (14(b)(i)), equivalently the eigenvectors of the matrices of Eq. (24) (13(e)). The top non-trivial stationary point is the global maximum, so the rule's target is the paper's filter. Medium on the dynamics of the rule itself: plain gradient ascent with the multipliers held at their stationary values does not by itself keep the iterates on the constraint set; the standard remedy (Oja 1982, and its CCA generalisations) replaces $\alpha,\beta$ by the current output products, which changes the transient but not the fixed points.
Q1(iii) Complete versus finite basis. Show that with a complete orthonormal basis of $L^2(\rho_0)$ the coordinate problem of Q1(ii) is the exact problem of Q1(i), and that with a finite span $F$ its value is $\sigma_1(C)\le\sigma_1$ for the compressed operator $C=P_F\K_\tau|_F$ of Problem 15. Then take the one-dimensional OU process $dx=-x\,dt+\sqrt2\,dW$ and $F=\operatorname{span}\{\mathrm{He}_2\}$, $\mathrm{He}_2(x)=x^2-1$, and show that the in-subspace maximiser is not the projection of the true subdominant pair onto $F$.
Answer
Complete basis. Let $\{\psi_k\}$ be a complete orthonormal set in $L^2(\rho_0)$. Every $f\in L^2(\rho_0)$ is $f=\sum_ka_k\psi_k$ with $a_k=\ip{\psi_k,f}$ (completeness), and $\|f\|^2=\sum_ka_k^2$ (Parseval). By linearity and continuity of $\K_\tau$ and of the inner product, $\ip{g,\K_\tau f}=\sum_{jk}b_ja_k\ip{\psi_j,\K_\tau\psi_k}=\vec b^{\,\top}\Sigma_\tau\vec a$ with $\Sigma_0=I$. So the map $f\mapsto\vec a$ is an isometric bijection between $L^2(\rho_0)$ and $\ell^2$ carrying the objective and constraints of Q1(i) to those of Q1(ii): the two problems have the same value and corresponding maximisers. Learning in a complete basis finds the exact singular pair.
Finite basis. For $f,g\in F$: $\ip{g,\K_\tau f}=\ip{P_Fg,\K_\tau f}$ ($g\in F$ so $P_Fg=g$) $=\ip{g,P_F\K_\tau f}$ ($P_F$ is self-adjoint, being an orthogonal projection) $=\ip{g,Cf}$ (definition of $C$). So the in-subspace problem is the singular-value problem of $C$ on $F\ominus\{1\}$, its value is $\sigma_1(C)$, and $\sigma_1(C)\le\sigma_1(\K_\tau)$ by Problem 15(a).
The example. For this OU process the stationary law is $N(0,1)$ and the Hermite polynomials are eigenfunctions, $\K_\tau\mathrm{He}_n=e^{-n\tau}\mathrm{He}_n$, orthogonal under $N(0,1)$ with $\|\mathrm{He}_n\|^2=n!$ (Problem 11). The process is reversible, so singular functions coincide with eigenfunctions and $\sigma_n=e^{-n\tau}$: the true subdominant pair is $f=g=\mathrm{He}_1=x$, value $e^{-\tau}$. With $F=\operatorname{span}\{\mathrm{He}_2\}$ the only admissible unit functions are $f,g=\pm\mathrm{He}_2/\sqrt2$ (mean zero holds because $\E[\mathrm{He}_2]=\E[X^2]-1=0$), and the in-subspace objective is $\ip{\mathrm{He}_2,\K_\tau\mathrm{He}_2}/2=e^{-2\tau}\|\mathrm{He}_2\|^2/2=e^{-2\tau}$ (eigen-relation, then the norm). Meanwhile the projection of the true pair onto $F$ is $\ip{\mathrm{He}_2,x}\,\mathrm{He}_2/2=0$, because $\ip{\mathrm{He}_2,x}=\E[X^3]-\E[X]=0$ for a standard normal. So the learner in this basis converges to a nonzero function whose "coherence" $e^{-2\tau}$ is genuine but which is the third singular function, not any approximation of the second; the projection of the second is zero. Which singular function a finite basis delivers depends on the basis, and no quantity computable inside $F$ reports the gap $e^{-\tau}-e^{-2\tau}$ to the true optimum (Problem 15(e)).
Q1(iv) Why the finite basis is also a regulariser, and how a hierarchy enlarges it. With $N$ sample pairs $(x_n,y_n)$, $y_n=x_{n+\tau}$, write the empirical version of the objective and constraints of Q1(i). Show that if the function class can interpolate arbitrary values at $N$ distinct points, the empirical optimum is $1$ and is attained by a pair that says nothing about the dynamics. Then show that a downstream neuron whose features are the rectified outputs $[\,\vec b_i\cdot\vec\phi\,]_+$ and $[-\vec b_i\cdot\vec\phi\,]_+$ of upstream neurons has a function class strictly containing the upstream one.
Answer
Empirical problem. Replacing each expectation in Q1(i) by a sample average (the plug-in estimator) gives $$\hat J(f,g)=\tfrac1N\sum_ng(x_n)f(y_n),\qquad \tfrac1N\sum_ng(x_n)^2=\tfrac1N\sum_nf(y_n)^2=1,\qquad \tfrac1N\sum_ng(x_n)=\tfrac1N\sum_nf(y_n)=0 .$$ Each of these depends on $g$ only through the vector of values $(g(x_n))_n$ and on $f$ only through $(f(y_n))_n$.
Degeneracy. By Cauchy–Schwarz in $\R^N$, $\hat J\le\big(\tfrac1N\sum g(x_n)^2\big)^{1/2}\big(\tfrac1N\sum f(y_n)^2\big)^{1/2}=1$. If the class can interpolate, pick any signs $s_n\in\{\pm1\}$ with $\sum_ns_n=0$ ($N$ even) and choose $g$ with $g(x_n)=s_n$ and $f$ with $f(y_n)=s_n$ (possible because the $x_n$ are distinct and the $y_n$ are distinct). Then the mean constraints hold, the second-moment constraints hold ($s_n^2=1$), and $\hat J=\tfrac1N\sum_ns_n^2=1$: the bound is attained. The signs were arbitrary, so the "perfectly coherent pair" found is one of $\binom{N}{N/2}$ equally good ones, none of which has anything to do with $\K_\tau$, whose true $\sigma_1$ is strictly less than $1$ for a noisy system (Block B, Q2(vi)). Interpolation is available to any class of dimension $\ge N$, so the estimator is meaningful only when the dictionary size $d$ is small compared with $N$, or an explicit penalty is added. The finite basis Section 4 starts from is therefore a regulariser, not only a limitation, and this is a legitimate reason to introduce it early.
Hierarchy. Let the upstream layer have learned filters $\vec b_1,\dots,\vec b_m$ and emit the ON/OFF pair $z_i^\pm=[\pm\vec b_i\cdot\vec\phi]_+$ (the paper's proposal that neurons rectify the positive and negative parts). A downstream neuron with these $2m$ features has function class $F_2=\operatorname{span}\{z_i^\pm\}$. It contains every upstream function: $\vec b_i\cdot\vec\phi=z_i^+-z_i^-$ (the identity $z=[z]_+-[-z]_+$ for any real $z$), so $\operatorname{span}\{\vec b_i\cdot\vec\phi\}\subseteq F_2$. It is strictly larger: $z_i^++z_i^-=|\vec b_i\cdot\vec\phi|$ is in $F_2$ and is not a linear function of $\vec\phi$. So each layer enlarges the dictionary with nonlinear functions of the input, and the downstream neuron runs the same rule as Q1(ii) on its own inputs: the approximation problem is attacked by depth, the learning problem stays local. Medium on how far this goes: the upstream filters were chosen to maximise their objective, not to be useful features for the layer above, so nothing guarantees that $F_2$ approaches the true nonlinear singular functions; the paper claims composability, not convergence.
Problem 13 — Galerkin projection: where Eq. (22) comes from
code/p13_galerkin.py for (f).Goal: understand "Galerkin projection" as a two-line recipe (apply the operator, then orthogonally project back), derive Eqs. (22)–(24) from it, and see the earlier blocks as special cases.
(a) The recipe. $\K_\tau$ acts on all functions of $x$, but a neuron can only represent elements of $F$. Explain why $\K_\tau f$ generally leaves $F$ even when $f\in F$. Then define the Galerkin approximation of $\K_\tau$ on $F$ as "apply $\K_\tau$, then take the closest element of $F$", write down the orthogonality condition this imposes, and derive Eq. (22), $K_\tau=\Sigma_0^{-1}\Sigma_\tau$, as the matrix acting on coefficient vectors.
Solution
Take $f=\vec c\cdot\vec\phi\in F$. By linearity of $\K_\tau$ (Problem 1), $\K_\tau f=\sum_jc_j\,\K_\tau\phi_j$, and each $\K_\tau\phi_j(x)=\E[\phi_j(X_{t+\tau})\mid X_t=x]$ is some new function of $x$ with no reason to be a combination of the $\phi_i$. Example: on a nonlinear system $\K_\tau x$ is a nonlinear function of $x$, so with the single feature $\phi(x)=x$ the image leaves $F$.
Step 1 (closest point = orthogonal projection). The closest element $g$ of a subspace $F$ to a given function $h$ is characterised by the residual $h-g$ being orthogonal to every element of $F$, equivalently to every basis function: $\ip{\phi_i,h-g}=0$ for all $i$. (Proof: for any $\delta\in F$, $\|h-g-\delta\|^2=\|h-g\|^2-2\ip{h-g,\delta}+\|\delta\|^2$, which is minimised at $\delta=0$ for all $\delta$ iff $\ip{h-g,\delta}=0$ for all $\delta\in F$.) This orthogonality condition is the Galerkin condition.
Step 2 (apply it to $h=\K_\tau f$). Seek $g=\vec c\,'\cdot\vec\phi$ with $\ip{\phi_i,\K_\tau f-g}=0$ for every $i$. Expanding both terms by linearity of the inner product, $$\sum_jc_j\ip{\phi_i,\K_\tau\phi_j}=\sum_jc'_j\ip{\phi_i,\phi_j}\qquad\text{for all }i,$$ which in matrix form is $\Sigma_\tau\vec c=\Sigma_0\,\vec c\,'$.
Step 3 (solve). Linear independence of the $\phi_i$ makes $\Sigma_0$ (a Gram matrix) invertible, so $\vec c\,'=\Sigma_0^{-1}\Sigma_\tau\,\vec c$. The map $\vec c\mapsto\vec c\,'$ is the matrix $K_\tau=\Sigma_0^{-1}\Sigma_\tau$, Eq. (22) (Supplement Eq. 51). Its $(i,j)$ entry answers: how much of $\phi_i$ appears in the projection of $\K_\tau\phi_j$.
The name comes from numerical PDEs, where Galerkin's method means: look for the solution in a finite-dimensional subspace and impose the equation only against test functions from that subspace. In the Koopman literature the same construction is called extended dynamic mode decomposition (EDMD; Williams, Kevrekidis & Rowley 2015, Klus et al. 2018), which are the paper's references for Eq. (22).
(b) Where the data enters. Nothing in (a) said which inner product to use. Show that with the stationary inner product $\ip{f,g}=\E[f(X_t)g(X_t)]$, the two matrices become $[\Sigma_0]_{ij}=\E[\phi_i(X_t)\phi_j(X_t)]$ and $[\Sigma_\tau]_{ij}=\E[\phi_i(X_t)\phi_j(X_{t+\tau})]$, and hence that Eq. (23) is their sample estimate. Which properties of the process does the estimate rely on?
Solution
$[\Sigma_0]_{ij}=\ip{\phi_i,\phi_j}=\E[\phi_i(X_t)\phi_j(X_t)]$ is the definition. For $\Sigma_\tau$, insert the definition of $\K_\tau$ and use the two rules of Problem 7(d): $$[\Sigma_\tau]_{ij}=\E\big[\phi_i(X_t)\,\K_\tau\phi_j(X_t)\big]=\E\Big[\phi_i(X_t)\,\E[\phi_j(X_{t+\tau})\mid X_t]\Big]=\E\Big[\E\big[\phi_i(X_t)\phi_j(X_{t+\tau})\mid X_t\big]\Big]=\E[\phi_i(X_t)\phi_j(X_{t+\tau})],$$ moving $\phi_i(X_t)$ inside the conditional expectation (it is a function of the conditioning variable) and then collapsing the nesting by the tower property. So $\Sigma_\tau$ is the lagged cross-covariance of the features, and $\Sigma_0$ their instantaneous covariance. Replacing each expectation by the time average $\tfrac1S\sum_s$ over a trajectory gives Eq. (23).
By direct integration. With $\K_\tau\phi_j(x)=\int p_\tau(y\mid x)\phi_j(y)\,dy$ (definition of $\K_\tau$ through the transition density) and the stationary inner product written as an integral, $$[\Sigma_\tau]_{ij}=\int\phi_i(x)\Big[\int p_\tau(y\mid x)\phi_j(y)\,dy\Big]\rho_0(x)\,dx=\iint\phi_i(x)\phi_j(y)\,\rho_0(x)p_\tau(y\mid x)\,dx\,dy=\E[\phi_i(X_t)\phi_j(X_{t+\tau})],$$ moving $\phi_i(x)\rho_0(x)$ inside the $y$-integral (it is constant in $y$; Fubini for the order) and recognising $\rho_0(x)p_\tau(y\mid x)$ as the joint density of $(X_t,X_{t+\tau})$ (joint = marginal times conditional). The Galerkin matrix is a lagged moment because the Koopman kernel times the stationary density is the two-time joint density.
The estimate uses: stationarity, so that $X_{t_s}$ and the pairs $(X_{t_s},X_{t_s+\tau})$ have the same law for every $s$ and the averages estimate a single $\Sigma_0$, $\Sigma_\tau$; and ergodicity, so that a time average over one trajectory converges to the ensemble expectation. This is why the paper discusses local stationarity and exponential forgetting immediately after Eq. (23). It is also the reason for choosing the $\rho_0$ inner product rather than, say, Lebesgue: it is the one whose Gram matrices a neuron can estimate from the lagged correlations of its own inputs.
(c) Block A was Galerkin all along. On a finite chain with stationary distribution $\pi$, take the indicator features $\phi_i=\mathbf 1_{\{i\}}$, $i=1,\dots,N$. Compute $\Sigma_0$ and $\Sigma_\tau$ and show $K_\tau=P$. Why is there no approximation here? What does the same choice give for a continuous process and a partition of the state space?
Solution
$[\Sigma_0]_{ij}=\E[\mathbf 1_{\{i\}}(X_t)\mathbf 1_{\{j\}}(X_t)]=P(X_t=i,X_t=j)=\pi_i\delta_{ij}$, so $\Sigma_0=\diag(\pi)$. $[\Sigma_\tau]_{ij}=\E[\mathbf 1_{\{i\}}(X_t)\mathbf 1_{\{j\}}(X_{t+1})]=P(X_t=i,X_{t+1}=j)=\pi_iP_{ij}$, so $\Sigma_\tau=\diag(\pi)P$. Hence $K_\tau=\diag(\pi)^{-1}\diag(\pi)P=P$, the Koopman matrix of Problem 2(a). No approximation occurs because the indicators span every function on $N$ states, so $\K_\tau f$ never leaves $F$ and the projection is the identity. Note also that in coefficient coordinates the inner product is $\vec c_f^{\,\top}\Sigma_0\vec c_g=\sum_i\pi_ic_{f,i}c_{g,i}=\ip{f,g}_\pi$: the $\pi$-weighted inner product of Block A is what Supplement Eq. (50) becomes here.
For a continuous process and indicators of a partition $\{B_i\}$, the same computation gives $[\Sigma_0]_{ij}=\rho_0(B_i)\delta_{ij}$ and $[\Sigma_\tau]_{ij}=P(X_t\in B_i,X_{t+\tau}\in B_j)$, so $K_\tau$ is the matrix of transition probabilities between cells, $P(X_{t+\tau}\in B_j\mid X_t\in B_i)$: Ulam's method. Now there is an approximation (functions constant on cells are not invariant under $\K_\tau$), and the numerator of the paper's Eq. (4) is exactly one entry of this matrix.
(d) Linear features on OU are exact. Take the OU process of Block C and $\phi(x)=x$ (the paper's Eq. 26). Show that $F$ is invariant under $\K_\tau$, so the projection does nothing, and compute $K_\tau$ two ways: from the action of $\K_\tau$ on linear functions, and from Eq. (22) using $\Sigma_\tau=\Sigma e^{A^\top\tau}$ (Problem 10a). Explain the transpose.
Solution
For OU, $x_{t+\tau}=e^{A\tau}x_t+\eta$ with $\eta$ zero-mean Gaussian independent of $x_t$ (Problem 10a), so $\K_\tau(\vec c\cdot x)=\E[\vec c\cdot(e^{A\tau}x+\eta)]=\vec c\cdot e^{A\tau}x=(e^{A^\top\tau}\vec c)\cdot x$. The image is again linear, so $F=\{\vec c\cdot x\}$ is invariant, the Galerkin condition is satisfied with zero residual, and the representation is exact. Reading off the coefficient map: $K_\tau=e^{A^\top\tau}$.
From Eq. (22): $\Sigma_0=\E[x_tx_t^\top]=\Sigma$ and $\Sigma_\tau=\E[x_tx_{t+\tau}^\top]=\E[x_t(e^{A\tau}x_t+\eta)^\top]=\Sigma e^{A^\top\tau}$, so $K_\tau=\Sigma^{-1}\Sigma e^{A^\top\tau}=e^{A^\top\tau}$. The two agree.
The transpose is not a convention clash. Points move by $x\mapsto e^{A\tau}x$; a linear observable is a covector $\vec c$, and covectors transform by the transpose (contragrediently): $\vec c\cdot(Mx)=(M^\top\vec c)\cdot x$. This is the same transpose that makes the paper's Eq. (18) read $e^{A^\top\tau}\Sigma^{-1}e^{A\tau}\Sigma$ for the $v$'s rather than $e^{A\tau}\cdots$, and it is behind the naming trap noted on the overview page.
(e) The adjoint in coefficient coordinates, and Eq. (24). Show that for $f=\vec c_f\cdot\vec\phi$ and $g=\vec c_g\cdot\vec\phi$ the inner product is $\ip{f,g}=\vec c_f^{\,\top}\Sigma_0\,\vec c_g$ (Supplement Eq. 50). Deduce that the adjoint of the matrix $K_\tau$ with respect to this metric is $K_\tau^\dagger=\Sigma_0^{-1}K_\tau^\top\Sigma_0$, compare with Problem 3(a), and multiply out $K_\tau K_\tau^\dagger$ and $K_\tau^\dagger K_\tau$ to obtain Eq. (24).
Solution
By bilinearity, $\ip{f,g}=\sum_{ij}c_{f,i}c_{g,j}\ip{\phi_i,\phi_j}=\vec c_f^{\,\top}\Sigma_0\vec c_g$. So $\R^d$ carries the metric $\Sigma_0$, and the adjoint of a matrix $K$ is defined by $\vec c_g^{\,\top}\Sigma_0(K\vec c_f)=(K^\dagger\vec c_g)^\top\Sigma_0\vec c_f$ for all $\vec c_f,\vec c_g$. The left side is $\vec c_g^{\,\top}\Sigma_0K\vec c_f$ and the right side is $\vec c_g^{\,\top}K^{\dagger\top}\Sigma_0\vec c_f$; equating the matrices gives $\Sigma_0K=K^{\dagger\top}\Sigma_0$, i.e. $K^\dagger=\Sigma_0^{-1}K^\top\Sigma_0$. This is Problem 3(a) with $\diag(\pi)$ replaced by the Gram matrix $\Sigma_0$; (c) shows they coincide for indicator features. The paper writes this as "a direct consequence of Eq. (5)" just above Eq. (24).
With $K_\tau=\Sigma_0^{-1}\Sigma_\tau$ and $\Sigma_\tau^\top=\Sigma_{-\tau}$ (the $(i,j)$ entry $\E[\phi_i(X_t)\phi_j(X_{t+\tau})]$ transposed is $\E[\phi_j(X_t)\phi_i(X_{t+\tau})]=\E[\phi_i(X_{t-\tau})\phi_j(X_t)]$ by stationarity): $K_\tau^\dagger=\Sigma_0^{-1}\Sigma_\tau^\top\Sigma_0^{-\top}\Sigma_0=\Sigma_0^{-1}\Sigma_{-\tau}$, using $\Sigma_0^\top=\Sigma_0$. Then $$F_\tau=K_\tau K_\tau^\dagger=\Sigma_0^{-1}\Sigma_\tau\Sigma_0^{-1}\Sigma_{-\tau},\qquad B_\tau=K_\tau^\dagger K_\tau=\Sigma_0^{-1}\Sigma_{-\tau}\Sigma_0^{-1}\Sigma_\tau,$$ which is Eq. (24). Their eigenvectors are the coefficient vectors of the singular functions (Eq. 25), because singular vectors of $K$ are eigenvectors of $KK^\dagger$ and $K^\dagger K$, exactly as in Problem 4. Problem 14 evaluates these for OU and identifies them with CCA.
(f) What projection loses (numeric). One-dimensional OU $dx=-x\,dt+\sqrt2\,dW$, stationary law $N(0,1)$, lag $\tau$. Using $x_{t+\tau}=e^{-\tau}x_t+\eta$ with $\eta\sim N(0,1-e^{-2\tau})$, compute $\K_\tau x^2$. (i) With features $\{x,x^2\}$, compute $\Sigma_0$, $\Sigma_\tau$ and $K_\tau$ analytically, and compare the $x^2$ entry of $K_\tau$ with the true coefficient $e^{-2\tau}$. Where did the discrepancy come from? (ii) Repeat with $\{1,x,x^2\}$. (iii) Confirm both with code/p13_galerkin.py, and relate the eigenvalues in (ii) to Problem 11.
Solution
$\K_\tau x^2=\E[(e^{-\tau}x+\eta)^2]=e^{-2\tau}x^2+(1-e^{-2\tau})$: a quadratic plus a constant. Also $\K_\tau x=e^{-\tau}x$ and $\K_\tau1=1$. Needed Gaussian moments: $\E[x^2]=1$, $\E[x^3]=0$, $\E[x^4]=3$.
(i) Features $\{x,x^2\}$. $\Sigma_0=\begin{pmatrix}\E[x^2]&\E[x^3]\\ \E[x^3]&\E[x^4]\end{pmatrix}=\diag(1,3)$. For $\Sigma_\tau$ use $[\Sigma_\tau]_{ij}=\E[\phi_i(x)\,\K_\tau\phi_j(x)]$: $\E[x\cdot e^{-\tau}x]=e^{-\tau}$; $\E[x\,(e^{-2\tau}x^2+1-e^{-2\tau})]=0$; $\E[x^2\cdot e^{-\tau}x]=0$; $\E[x^2(e^{-2\tau}x^2+1-e^{-2\tau})]=3e^{-2\tau}+1-e^{-2\tau}=1+2e^{-2\tau}$. So $$K_\tau=\Sigma_0^{-1}\Sigma_\tau=\diag\!\Big(e^{-\tau},\ \tfrac{1+2e^{-2\tau}}{3}\Big).$$ The $x$ entry is exact. The $x^2$ entry is $\tfrac13+\tfrac23e^{-2\tau}$ instead of $e^{-2\tau}$: at $\tau=0.5$, $0.579$ versus $0.368$. The constant $(1-e^{-2\tau})$ in $\K_\tau x^2$ is not in $F$, and it is not orthogonal to $x^2$ either ($\ip{1,x^2}=1\ne0$), so the projection smears part of it onto the $x^2$ direction: coefficient $\ip{x^2,\,1-e^{-2\tau}}/\ip{x^2,x^2}=(1-e^{-2\tau})/3$, which is exactly the excess. A Galerkin matrix is only as good as the invariance of the feature span, and the error lands on whichever features are correlated with what was dropped.
(ii) Features $\{1,x,x^2\}$. Now $\K_\tau$ maps $F$ into itself (polynomials of degree $\le2$ are invariant, Problem 11), so the matrix is exact. Reading coefficients off $\K_\tau1=1$, $\K_\tau x=e^{-\tau}x$, $\K_\tau x^2=(1-e^{-2\tau})\cdot1+e^{-2\tau}x^2$, with column $j$ holding the coefficients of $\K_\tau\phi_j$: $$K_\tau=\begin{pmatrix}1&0&1-e^{-2\tau}\\0&e^{-\tau}&0\\0&0&e^{-2\tau}\end{pmatrix},$$ upper triangular with eigenvalues $1,e^{-\tau},e^{-2\tau}$. Eq. (22) reproduces this (the reader may check: $\Sigma_0=\begin{pmatrix}1&0&1\\0&1&0\\1&0&3\end{pmatrix}$, $\Sigma_\tau=\begin{pmatrix}1&0&1\\0&e^{-\tau}&0\\1&0&1+2e^{-2\tau}\end{pmatrix}$). The eigenvalues are those of the Hermite eigenfunctions $\mathrm{He}_0,\mathrm{He}_1,\mathrm{He}_2$ of Problem 11 (with $a=1$, $\sigma=1$), and the eigenvectors are their coefficient vectors: $(1,0,0)$, $(0,1,0)$ and $(-1,0,1)$, i.e. $x^2-1=\mathrm{He}_2$. Including the constant feature is what makes the trivial pair $u_0=v_0=\mathbf 1$ of Problem 7(b) representable; the paper's Eq. (26) omits it, which is harmless for zero-mean linear features because $\ip{1,x}=0$, but would not be for $x^2$.
(iii) Running the script ($\Delta t=0.01$, $T=2\times10^4$, $\tau=0.5$) gives, for $\{x,x^2\}$, diagonal entries $0.601$ and $0.572$ against the analytic $0.607$ and $0.579$; for $\{1,x,x^2\}$, the $(1,3)$ entry $0.642$ against $0.632$ and eigenvalues $1.000,0.601,0.355$ against $1,0.607,0.368$. The residual gap is Euler–Maruyama bias at this $\Delta t$ (the discrete map has effective decay $1-\Delta t$ per step rather than $e^{-\Delta t}$), as in Problem 14(d).
Problem 14 — Past–future CCA, and how it recovers Eq. (18) (numeric)
Background: canonical correlation analysis. CCA (Hotelling 1936) takes two random vectors $X\in\R^p$ and $Y\in\R^q$ and asks for the pair of linear projections $a^\top X$, $b^\top Y$ that are most correlated; then for the next pair, uncorrelated with the first, and so on. The answer is the SVD of the whitened cross-covariance $\Sigma_{XX}^{-1/2}\Sigma_{XY}\Sigma_{YY}^{-1/2}$: its singular values are the canonical correlations $1\ge\rho_1\ge\rho_2\ge\cdots\ge0$ and its singular vectors, unwhitened, are the canonical directions. Correlation is invariant under invertible linear maps of $X$ and of $Y$ separately, so CCA sees only the two subspaces spanned by the coordinates, not the coordinates themselves.
Past–future CCA (also time-lagged CCA) takes $X=\vec\phi(x_t)$ and $Y=\vec\phi(x_{t+\tau})$, the same features at two times. Stationarity makes $\Sigma_{XX}=\Sigma_{YY}=\Sigma_0$ and $\Sigma_{XY}=\Sigma_\tau$, so the whitened cross-covariance is $\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$, which is precisely the compressed Koopman operator of Problem 13 written in an orthonormal basis of $F$. Its reversible special case, where $\Sigma_\tau$ is symmetric and the two canonical bases coincide, is time-lagged independent component analysis (TICA; Molgedey & Schuster 1994), the standard tool of molecular kinetics; the general case is the VAMP framework of Wu & Noé (2020) and the "singular functions from data" of Koltai et al. (2018). In neuroscience the same object appears as predictive information (Bialek, Nemenman & Tishby 2001): for Gaussian processes the mutual information between past and future is $-\tfrac12\sum_i\log(1-\rho_i^2)$, so the canonical pairs are the coordinates in which predictive information decomposes, and the Gaussian information bottleneck (Chechik, Globerson, Tishby & Weiss 2005) keeps them in order of $\rho_i$. That is the equivalence with "information bottleneck and CCA" that the Supplement (Sec. 6) asserts without proof. Lipshutz, Bahroun, Golkar, Sengupta & Chklovskii (2021) give a biologically plausible online circuit for CCA, which is the paper's implicit answer to how a neuron could run this computation.
code/p14_cca.py.Goal: see that a neuron with access only to lagged second moments of its input can, in principle, compute the singular vectors of Eq. (18).
(a) CCA from scratch. Maximise $a^\top\Sigma_{XY}b$ subject to $a^\top\Sigma_{XX}a=1$ and $b^\top\Sigma_{YY}b=1$. Derive the stationarity conditions, show the two Lagrange multipliers are equal to the achieved correlation $\rho$, eliminate $b$ to get $\Sigma_{XX}^{-1}\Sigma_{XY}\Sigma_{YY}^{-1}\Sigma_{YX}\,a=\rho^2a$, and rewrite the whole problem as an ordinary SVD in whitened coordinates. Why is CCA unchanged if $X$ is replaced by $GX$ for invertible $G$, and what does that say about the choice of features in Problem 13?
Solution
Maximising correlation is maximising covariance at fixed variances, hence the constrained form. Lagrangian $\mathcal L=a^\top\Sigma_{XY}b-\tfrac\lambda2(a^\top\Sigma_{XX}a-1)-\tfrac\mu2(b^\top\Sigma_{YY}b-1)$. Setting $\partial_a\mathcal L=0$ and $\partial_b\mathcal L=0$: $$\Sigma_{XY}b=\lambda\,\Sigma_{XX}a,\qquad\Sigma_{YX}a=\mu\,\Sigma_{YY}b .$$ Left-multiply the first by $a^\top$ and the second by $b^\top$ and use the constraints: $a^\top\Sigma_{XY}b=\lambda$ and $b^\top\Sigma_{YX}a=\mu$. These are the same scalar (transpose of each other), so $\lambda=\mu=\rho$, the correlation achieved at the optimum. From the second equation $b=\rho^{-1}\Sigma_{YY}^{-1}\Sigma_{YX}a$; substituting into the first, $\Sigma_{XY}\Sigma_{YY}^{-1}\Sigma_{YX}a=\rho^2\Sigma_{XX}a$, i.e. $\Sigma_{XX}^{-1}\Sigma_{XY}\Sigma_{YY}^{-1}\Sigma_{YX}\,a=\rho^2a$, and symmetrically $\Sigma_{YY}^{-1}\Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY}\,b=\rho^2b$. The top eigenvector gives the first canonical pair; the remaining eigenvectors give the successive pairs, and the constraint that later pairs be uncorrelated with earlier ones is the $\Sigma_{XX}$-orthogonality of eigenvectors of this (self-adjoint in the $\Sigma_{XX}$ metric, cf. Problem 3) matrix.
Whitened form. Put $\tilde a=\Sigma_{XX}^{1/2}a$, $\tilde b=\Sigma_{YY}^{1/2}b$ and $\tilde C=\Sigma_{XX}^{-1/2}\Sigma_{XY}\Sigma_{YY}^{-1/2}$. The constraints become $\|\tilde a\|=\|\tilde b\|=1$, the objective $\tilde a^\top\tilde C\tilde b$, and the stationarity conditions $\tilde C\tilde b=\rho\tilde a$, $\tilde C^\top\tilde a=\rho\tilde b$: the singular value equations of $\tilde C$. So the canonical correlations are the singular values of $\tilde C$ and the canonical directions its singular vectors, unwhitened by $\Sigma^{-1/2}$. This is the same isometry trick as Problem 3(c): whitening turns a weighted problem into a Euclidean one.
Invariance. If $X\mapsto GX$ then $a^\top X=(G^{-\top}a)^\top(GX)$, so the set of achievable projections $\{a^\top X\}$ is unchanged and so are the optima and the $\rho_i$; only the coordinates of $a$ change. CCA therefore depends on $\operatorname{span}\{X_1,\dots,X_p\}$ alone. For Problem 13 this says the Galerkin matrices depend on the feature span $F$, not on the basis chosen for it, exactly as the derivation there (a projection onto $F$) implies; recombining the features by an invertible matrix changes $K_\tau$ by a similarity and leaves the singular functions untouched.
Eq. (24) without Galerkin. Specialise (a) to the past–future case $X=\vec\phi(x_t)$, $Y=\vec\phi(x_{t+\tau})$. By stationarity $\Sigma_{XX}=\Sigma_{YY}=\Sigma_0$, and by the definitions of Problem 13(b) $\Sigma_{XY}=\Sigma_\tau$, $\Sigma_{YX}=\Sigma_\tau^\top$. The two eliminated stationarity conditions of (a) become $$\Sigma_0^{-1}\Sigma_\tau\,\Sigma_0^{-1}\Sigma_\tau^\top\,a=\rho^2a,\qquad \Sigma_0^{-1}\Sigma_\tau^\top\,\Sigma_0^{-1}\Sigma_\tau\,b=\rho^2b .$$ Now read the paper's matrices: Eq. (22) sets $K_\tau=\Sigma_0^{-1}\Sigma_\tau$, its adjoint in the $\Sigma_0$ metric is $K_\tau^\dagger=\Sigma_0^{-1}K_\tau^\top\Sigma_0=\Sigma_0^{-1}\Sigma_\tau^\top$ (Problem 13(e)), and Eq. (24) is $F_\tau=K_\tau K_\tau^\dagger=\Sigma_0^{-1}\Sigma_\tau\Sigma_0^{-1}\Sigma_\tau^\top$ and $B_\tau=K_\tau^\dagger K_\tau=\Sigma_0^{-1}\Sigma_\tau^\top\Sigma_0^{-1}\Sigma_\tau$. These are the two matrices above. So Eq. (24) is the eigenvalue form of past–future CCA on the features, and it is reached without mentioning an operator: pose the two-sided problem "maximise $\E[g(X_t)f(X_{t+\tau})]$ over the $f,g$ the neuron can build" (the prelude to this block), parametrise, and eliminate. The eigenvalue $\rho^2$ is the squared canonical correlation; the eigenvector $a$ of $F_\tau$ is the coefficient vector of the predictive filter on the present slice and $b$ of $B_\tau$ that of the retrospective filter on the later slice.
Where, then, does Galerkin enter? Only through Eq. (22): the claim that the matrix $\Sigma_0^{-1}\Sigma_\tau$ on its own approximates the operator $\K_\tau$. The CCA route never needs that matrix as a standalone object, only the two products, and it never asserts that anything approximates $\K_\tau$; it asserts only that the restricted problem has been solved exactly. Galerkin is the interpretation that gives Eq. (22) a meaning (Problem 13(a)), and it is what one needs for the questions the CCA route cannot pose: whether the restricted optimum coincides with the true singular pair, which holds when $F$ is invariant under $\K_\tau$ and $\K_\tau^\dagger$ (13(d), 15(d)), and what the neuron's answer silently discards, namely the component $(I-P_F)\K_\tau f$ of the residual that lies outside $F$ (15(e)). For a neuron the picture is therefore: it solves CCA between its own present and future inputs; "Galerkin" is how a mathematician describes what it has solved, and it is needed to say when the answer is exact. The two descriptions agree only because both $f$ and $g$ are restricted to $F$; restricting one side alone gives the Rayleigh–Ritz problem of 15(c), which is neither CCA nor estimable from a single trajectory.
Whitened and unwhitened filters. Be careful about which vector is "the filter". In the whitened coordinates of (a), $\tilde a=\Sigma_0^{1/2}a$ and $\tilde b=\Sigma_0^{1/2}b$ are singular vectors of $\tilde C=\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$; but the weights a neuron applies to its raw features $\vec\phi$ are the unwhitened vectors $a=\Sigma_0^{-1/2}\tilde a$ and $b=\Sigma_0^{-1/2}\tilde b$. The two describe one function of the state, $a\cdot\vec\phi=\tilde a\cdot\vec\psi$ with $\vec\psi=\Sigma_0^{-1/2}\vec\phi$ the whitened features (14(b)(i)): the singular function is basis-independent, only its coefficient vector depends on which features it is written in. Eq. (24) delivers the raw-feature vectors directly, with no square roots: substituting $a=\Sigma_0^{-1/2}\tilde a$, $$\Sigma_0^{-1}\Sigma_\tau\Sigma_0^{-1}\Sigma_\tau^\top\,a=\Sigma_0^{-1/2}\big(\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}\big)\big(\Sigma_0^{-1/2}\Sigma_\tau^\top\Sigma_0^{-1/2}\big)\tilde a=\Sigma_0^{-1/2}\tilde C\tilde C^\top\tilde a=\rho^2\,\Sigma_0^{-1/2}\tilde a=\rho^2a ,$$ using $\Sigma_0^{-1}=\Sigma_0^{-1/2}\Sigma_0^{-1/2}$ to split each inverse, and $\tilde C\tilde C^\top\tilde a=\rho^2\tilde a$ (a left singular vector of $\tilde C$ is an eigenvector of $\tilde C\tilde C^\top$). So the eigenvectors of $F_\tau$ are the unwhitened $a$, which is why the paper's Fig. 2b can plot "singular vectors from Eq. (24)" directly as temporal filters against a bipolar cell. For a neuron this is the practical route: it never forms a matrix square root, and the eigenvectors land in its own synaptic coordinates. Which vector a measured receptive field should resemble depends on where one records: if an upstream stage has already decorrelated the input, the downstream features are close to $\vec\psi$ and the measured weights close to $\tilde a$; otherwise they are $a$.
(b) Past–future specifics. With $X=\vec\phi(x_t)$, $Y=\vec\phi(x_{t+\tau})$ and the stationary inner product: (i) show that the whitened features $\vec\psi=\Sigma_0^{-1/2}\vec\phi$ are orthonormal in $L^2(\rho_0)$ and that $\tilde C=\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$ is the matrix of the compressed operator $C=P_F\K_\tau|_F$ in that basis; deduce $\rho_i\le1$ two ways. (ii) Show that reversibility makes $\Sigma_\tau$ symmetric, hence $a_i=\pm b_i$ (predictive and retrospective filters coincide) and CCA reduces to the generalised eigenproblem $\Sigma_\tau a=\rho\Sigma_0a$ of TICA. (iii) For jointly Gaussian $(X,Y)$ prove $I(X;Y)=-\tfrac12\sum_i\log(1-\rho_i^2)$, and evaluate it for the OU of part (d).
Solution
(i) $\E[\vec\psi\vec\psi^\top]=\Sigma_0^{-1/2}\E[\vec\phi\vec\phi^\top]\Sigma_0^{-1/2}=I$, so $\ip{\psi_i,\psi_j}=\delta_{ij}$: an orthonormal basis of $F$. The matrix of $C$ in an orthonormal basis has entries $\ip{\psi_i,C\psi_j}=\ip{\psi_i,\K_\tau\psi_j}$ (the projection drops because $\psi_i\in F$) $=\E[\psi_i(x_t)\psi_j(x_{t+\tau})]$ by the lagged-moment identity of Problem 13(b) (tower property, or direct integration), and $\E[\vec\psi(x_t)\vec\psi(x_{t+\tau})^\top]=\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}=\tilde C$. So canonical correlations are the singular values of the compressed Koopman operator, and Problem 15(b) is the statement that CCA solves the two-sided restricted problem. Two proofs of $\rho_i\le1$: statistically, a correlation coefficient is at most one (Cauchy–Schwarz); operator-theoretically, $\sigma_i(C)\le\sigma_i(\K_\tau)\le1$ by Problem 15(a) and the contraction bound of Problem 7. That the two arguments agree is the content of the identification.
(ii) Detailed balance says $(x_t,x_{t+\tau})$ and $(x_{t+\tau},x_t)$ have the same joint law (Problem 7d), so $\E[\phi_i(x_t)\phi_j(x_{t+\tau})]=\E[\phi_j(x_t)\phi_i(x_{t+\tau})]$, i.e. $\Sigma_\tau=\Sigma_\tau^\top$ and $\tilde C$ is symmetric. The SVD of a symmetric matrix is its eigendecomposition up to signs ($\tilde C=Q\Lambda Q^\top$ with $\sigma_i=|\lambda_i|$, $\tilde b_i=\operatorname{sign}(\lambda_i)\tilde a_i$), so $a_i=\pm b_i$: a reversible process has no distinction between predictive and retrospective filters, which is Problem 3(c)/9(c) again. (This uses that the features are functions of a Markov state whose time reversal is the same state. For lag vectors of a reversible scalar signal, time reversal also reverses the order of the lags, so $\Sigma_\tau$ is not symmetric; instead $\Sigma_\tau^\top=J\Sigma_\tau J$ with $J$ the lag-reversal permutation, and the future filter is the lag-reversed past filter. See Problem 16(d).) The stationarity condition $\Sigma_{XY}b=\rho\Sigma_{XX}a$ with $a=b$ reads $\Sigma_\tau a=\rho\Sigma_0a$, the TICA generalised eigenproblem, whose solutions are the Galerkin eigenvectors of $K_\tau=\Sigma_0^{-1}\Sigma_\tau$ themselves. For an irreversible process $\Sigma_\tau\ne\Sigma_\tau^\top$, eigenvectors of $K_\tau$ and singular vectors of $\tilde C$ part company, and one must use the latter: this is why the paper (and Problem 4) insists on singular rather than eigen-functions.
(iii) For a Gaussian vector with covariance $\Sigma$, $h=\tfrac12\log\det(2\pi e\Sigma)$, so $I(X;Y)=h(X)+h(Y)-h(X,Y)=\tfrac12\log\dfrac{\det\Sigma_{XX}\det\Sigma_{YY}}{\det\begin{pmatrix}\Sigma_{XX}&\Sigma_{XY}\\\Sigma_{YX}&\Sigma_{YY}\end{pmatrix}}$. Mutual information is invariant under invertible maps of each argument, so whiten: the joint covariance becomes $\begin{pmatrix}I&\tilde C\\\tilde C^\top&I\end{pmatrix}$, whose determinant by the Schur complement is $\det(I-\tilde C^\top\tilde C)=\prod_i(1-\rho_i^2)$, while the marginal determinants are $1$. Hence $I(X;Y)=-\tfrac12\sum_i\log(1-\rho_i^2)$: each canonical pair contributes independently, in decreasing order of $\rho_i$. For the OU process the lag vector is Gaussian, so this is exactly the predictive information between $x_t$ and $x_{t+\tau}$, and the $\lambda_i$ of Eq. (18) are its coordinates. With the analytic values of part (d), $\rho^2=(0.434,0.115)$: $I=-\tfrac12[\log0.566+\log0.885]=0.35$ nats, of which the subdominant pair carries $0.28$. The paper's "coherent set" filter is, for a Gaussian input, the single linear projection carrying the most predictive information; that is the sense in which the coherent-set, CCA and information-bottleneck pictures coincide, and the sense in which they do not: the information-theoretic statement needs Gaussianity, the CCA statement needs only second moments, and the coherent-set statement is about level sets of the singular function rather than the function itself.
(c) Simulate the process with Euler–Maruyama ($\Delta t=0.01$, $T=4000$, discard the transient) and estimate $\Sigma_0$, $\Sigma_\tau$.
Solution
Analytic values for reference: $\Sigma=\begin{pmatrix}0.5&0.1667\\0.1667&0.3333\end{pmatrix}$ and $A\Sigma=\begin{pmatrix}-0.5&-0.1667\\0.1667&-0.5\end{pmatrix}$, not symmetric, so the process is irreversible and $F_\tau\ne B_\tau$ is expected. The estimator uses $k=\tau/\Delta t=50$ samples of lag; $\Sigma_0$ is estimated symmetrically from both ends of each lagged pair, $\Sigma_\tau$ from $X_0^\top X_1/n$.
import numpy as np
from scipy.linalg import expm, solve_sylvester
rng = np.random.default_rng(0)
A = np.array([[-1., 0.], [1., -2.]]); D = np.eye(2)
dt, T, tau = 0.01, 4000., 0.5; n = int(T/dt); k = round(tau/dt)
x = np.zeros((n, 2)); noise = rng.standard_normal((n, 2))*np.sqrt(dt)
for t in range(n-1): x[t+1] = x[t] + A @ x[t]*dt + noise[t]
x = x[n//10:]; X0, X1 = x[:-k], x[k:]
S0 = (X0.T@X0 + X1.T@X1)/(2*len(X0)); St = X0.T@X1/len(X0); Smt = St.T
F_hat = np.linalg.solve(S0, St) @ np.linalg.solve(S0, Smt) # Eq. (24)
B_hat = np.linalg.solve(S0, Smt) @ np.linalg.solve(S0, St)
(d) Show analytically that Eq. (24) with linear features equals the matrices of Eq. (18), then compare eigenvalues and eigenvectors of the data estimates with the analytic ones.
Solution
From Problem 10(a), $\Sigma_\tau=\E[x_tx_{t+\tau}^\top]=\Sigma e^{A^\top\tau}$ and $\Sigma_{-\tau}=e^{A\tau}\Sigma$, $\Sigma_0=\Sigma$. Substituting into Eq. (24): $$F_\tau=\Sigma^{-1}\Sigma e^{A^\top\tau}\,\Sigma^{-1}e^{A\tau}\Sigma=e^{A^\top\tau}\Sigma^{-1}e^{A\tau}\Sigma=M^\top,\qquad B_\tau=\Sigma^{-1}e^{A\tau}\Sigma\,\Sigma^{-1}\Sigma e^{A^\top\tau}=\Sigma^{-1}e^{A\tau}\Sigma e^{A^\top\tau}=N^\top,$$ exactly the two matrices of Eq. (18). (This is the Supplement Sec. 6 claim; note it needs $\Sigma_0=\Sigma$, i.e. a stationary process with a genuine covariance — the same caveat as Problem 12(d).) Numerically, with $\tau=0.5$:
| eigenvalues (data) | eigenvalues (analytic) | top eigenvector (data) | top eigenvector (analytic) | |
|---|---|---|---|---|
| $F_\tau$ ($v$, present) | 0.438, 0.123 | 0.434, 0.115 | (0.928, 0.373) | (0.929, 0.371) |
| $B_\tau$ ($u$, future) | 0.438, 0.123 | 0.434, 0.115 | (0.750, 0.661) | (0.747, 0.665) |
Eigenvalues agree to the second decimal (the residual bias is Euler–Maruyama discretisation at $\Delta t=0.01$, which perturbs the effective $\Sigma$; halving $\Delta t$ halves it), eigenvectors to three decimals. As required, $F_\tau$ and $B_\tau$ share eigenvalues but have different eigenvectors: $v_1=(0.93,0.37)$ versus $u_1=(0.75,0.66)$, an angle of about $17^\circ$. A "predictive" unit and a "retrospective" unit for this input would carry different filters, and the difference is entirely due to $c\ne0$ (Problem 9d).
(e) Show that the eigenvectors of $F_\tau$ are the canonical directions of CCA between $x_t$ and $x_{t+\tau}$, and the eigenvalues the squared canonical correlations.
Solution
CCA between $X=x_t$ and $Y=x_{t+\tau}$ with $\Sigma_{XX}=\Sigma_{YY}=\Sigma_0$ and $\Sigma_{XY}=\Sigma_\tau$ seeks $a,b$ maximising $\operatorname{corr}(a^\top X,b^\top Y)$; the stationary conditions derived in (a) give the eigenproblems $\Sigma_{XX}^{-1}\Sigma_{XY}\Sigma_{YY}^{-1}\Sigma_{YX}\,a=\rho^2a$ and $\Sigma_{YY}^{-1}\Sigma_{YX}\Sigma_{XX}^{-1}\Sigma_{XY}\,b=\rho^2b$, which are precisely $F_\tau a=\rho^2a$ and $B_\tau b=\rho^2b$ with $\rho$ the canonical correlations. Equivalently, the $\rho_i$ are the singular values of the whitened cross-covariance $\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$, whose right/left singular vectors are $\Sigma_0^{1/2}a$ and $\Sigma_0^{1/2}b$. Numerically: canonical correlations squared $=(0.438,0.123)=$ eigenvalues of $F_\tau$.
So on linear features the whole construction is past–future CCA (Koltai et al. 2018; Wu & Noé 2020, where $\sum\rho_i^2$ is the VAMP-2 score), and $\Sigma_0^{-1/2}\Sigma_\tau\Sigma_0^{-1/2}$ is $\tilde M^\top$ of Problem 10(d): the whitened transition matrix is the canonical-correlation matrix. The paper's contribution beyond CCA is the coherent-set reading of the sign and the identification of the two canonical bases with predictive and retrospective units; the neural claim is that a cell can run this eigenproblem on its own lagged inputs, for which Lipshutz et al. (2021) give a local Hebbian/anti-Hebbian circuit. High for the CCA identity; the biological plausibility of the online estimator is outside this problem set.
Problem 15 — Is the approximation applied too early?
Background. Section 4 compresses $\K_\tau$ to a $d\times d$ matrix (Eq. 22), builds $F_\tau$ and $B_\tau$ from that matrix (Eq. 24), and takes their exact eigenvectors as the filters. A natural objection: what one presumably wants are approximate singular functions of the exact operator, suitably defined, and it is not obvious these coincide. In general they do not. For eigenvectors of $\K_\tau$, the compressed operator $C=P_F\K_\tau|_F$ can have eigenvalues nowhere near the spectrum of $\K_\tau$ ("spectral pollution"), and its eigenvectors need not approximate any eigenfunction; EDMD converges to $\K_\tau$ only in a weak sense that does not control individual eigenpairs (Korda & Mezić, J. Nonlinear Sci. 28, 2018). Residual DMD (Colbrook & Townsend, Comm. Pure Appl. Math. 77, 2024) exists precisely to repair this: it computes $\|\K_\tau f-\lambda f\|$ for each candidate pair and discards the spurious ones.
The paper is partly protected because it uses singular vectors, which obey a variational principle that eigenvectors of a non-normal operator do not: compressed singular values can never exceed the true ones, and the compressed pair is the exact solution of a well-posed restricted problem, "the most correlated present/future pair within the representable class" (the VAMP principle of Wu & Noé, J. Nonlinear Sci. 30, 2020). Two things remain. First, there is a hidden choice of where the projection sits: constraining both $f$ and $g$ to $F$ (the paper, and CCA) versus constraining only one of them (Rayleigh–Ritz for $\K_\tau\K^\dagger_\tau$), which give different answers. Second, the compressed pair equals the true one only when $F$ is invariant under $\K_\tau$ and $\K^\dagger_\tau$, which holds for OU with linear features (Supplement Sec. 6) but not for the nonlinear extension the paper proposes, and a neuron cannot measure the discrepancy from its own lagged covariances. This problem makes each of these statements precise.
code/p15_residual.py.Goal: know exactly in what sense exact singular vectors of the compressed operator are approximate singular functions of the exact one, where a modelling choice is hidden, and why the error is invisible to the estimator.
(a) Compression cannot inflate singular values. Using the Courant–Fischer characterisation $\sigma_i(\K)=\max_{\dim S=i}\min_{f\in S}\|\K f\|/\|f\|$, show $\sigma_i(C)\le\sigma_i(\K)$ for every $i$. Explain why no analogous statement holds for eigenvalues of a non-self-adjoint $\K$, and why Problem 13(f)(i) is nevertheless not a counterexample to (a).
Solution
For $S\subset F$, $\|Cf\|=\|P_F\K f\|\le\|\K f\|$ because an orthogonal projection is a contraction. Hence $$\sigma_i(C)=\max_{\substack{S\subset F\\\dim S=i}}\;\min_{f\in S}\frac{\|P_F\K f\|}{\|f\|}\;\le\;\max_{\substack{S\subset F\\\dim S=i}}\;\min_{f\in S}\frac{\|\K f\|}{\|f\|}\;\le\;\max_{\dim S=i}\;\min_{f\in S}\frac{\|\K f\|}{\|f\|}=\sigma_i(\K),$$ the first inequality by the contraction, the second by enlarging the set of subspaces maximised over. The same argument on $C^\dagger=P_F\K^\dagger|_F$ (the $\Sigma_0$-adjoint of Problem 13e) gives nothing new since $C$ and $C^\dagger$ share singular values.
Eigenvalues have no min–max characterisation unless the operator is self-adjoint (or normal). All one can say is that eigenvalues of $C$ lie in the numerical range $\{\ip{f,\K f}/\|f\|^2\}$ of $\K$, which for a non-normal operator can be much larger than the convex hull of its spectrum; that is spectral pollution. The 1-D OU of Problem 13(f) is reversible, so $\K$ is self-adjoint and positive, its singular values are its eigenvalues $e^{-n\tau}$, and the compressed value $0.579$ found there does obey (a): it sits below $\sigma_1=1$, and indeed between the true eigenvalues $0.607$ and $0.368$ whose eigenfunctions $x^2$ mixes (Cauchy interlacing). It is a spurious value in the sense that it approximates no eigenvalue, but not an inflated one. Pollution proper needs a non-normal $\K$, e.g. an irreversible chain or the OU of Problem 9(d).
(b) What the compressed pair optimises. Show that $$\sigma_1(C)=\max_{f,g\in F}\frac{\ip{g,\K f}}{\|f\|\,\|g\|},$$ attained at the top singular pair of $C$, and that the eigenvalues of the paper's $F_\tau$ are $\sigma_i(C)^2$. Conclude that the paper's filters are the exact solution of "the most correlated predictive/retrospective pair with both members representable", and state the VAMP-2 inequality $\sum_i\sigma_i(C)^2\le\sum_i\sigma_i(\K)^2$ with its equality case.
Solution
For $f,g\in F$, $\ip{g,\K f}=\ip{g,P_F\K f}=\ip{g,Cf}$ because $g\in F$ makes $\ip{g,(I-P_F)h}=0$ for any $h$. The maximum of $\ip{g,Cf}/(\|f\|\|g\|)$ over $F\times F$ is the top singular value of $C$, attained at its top singular pair (Cauchy–Schwarz in $g$ gives $\|Cf\|/\|f\|$, then maximise over $f$). By Problem 13(e), $F_\tau$ is the matrix of $CC^\dagger$, so its eigenvalues are $\sigma_i(C)^2$ and its eigenvectors the coefficient vectors of the $g$'s; $B_\tau$ likewise gives the $f$'s. In the language of Eq. (4)–(5), the paper's filters are the pair of representable observables whose present and future values are most correlated, which is exactly the CCA problem of Problem 14(a)–(b).
Summing (a) over $i\le d$: $\sum_{i\le d}\sigma_i(C)^2\le\sum_{i\le d}\sigma_i(\K)^2$, the VAMP-2 score bound. Equality holds iff $F$ is spanned by the top $d$ singular functions of $\K$ (then $C$ restricted to them is $\K$ itself, since both the input and the output lie in $F$). This turns feature choice into an optimisation with a known ceiling, and is the precise sense in which "approximating early" is harmless for singular vectors: the compressed problem is a lower bound on a variational objective of the exact operator, and maximising it over feature sets recovers the exact singular functions.
(c) The hidden choice. Rayleigh–Ritz applied directly to the self-adjoint operator $\K\K^\dagger$ would instead compute $\max_{g\in F}\|\K^\dagger g\|^2/\|g\|^2$, constraining only the retrospective function. Show this is $\ge\sigma_1(C)^2$. For the 1-D OU with the single feature $F=\operatorname{span}\{x^2\}$, compute both numbers at general $\tau$ and at $\tau=0.5$, identify the optimal $f$ in the one-sided problem, and say which of the two problems the paper is solving.
Solution
$\|\K^\dagger g\|=\max_{f}\ip{f,\K^\dagger g}/\|f\|=\max_f\ip{\K f,g}/\|f\|$ over all $f$, which is at least the maximum over $f\in F$; so $\max_{g\in F}\|\K^\dagger g\|/\|g\|\ge\sigma_1(C)$. The one-sided problem lets the predictive function leave $F$.
For $F=\operatorname{span}\{x^2\}$ the compressed operator is the scalar $c=\ip{x^2,\K x^2}/\ip{x^2,x^2}$. With $\K x^2=e^{-2\tau}x^2+(1-e^{-2\tau})$: $\ip{x^2,\K x^2}=3e^{-2\tau}+(1-e^{-2\tau})=1+2e^{-2\tau}$, so $c=\tfrac13(1+2e^{-2\tau})$ (as in Problem 13f) and $\sigma_1(C)^2=c^2$. The one-sided value (the process is reversible, $\K^\dagger=\K$) is $\|\K x^2\|^2/3$ with $\|\K x^2\|^2=e^{-4\tau}\cdot3+2e^{-2\tau}(1-e^{-2\tau})\cdot1+(1-e^{-2\tau})^2=1+2e^{-4\tau}$, i.e. $\tfrac13(1+2e^{-4\tau})$. At $\tau=0.5$: $c^2=0.335$ versus $0.424$; the true values $\sigma_i(\K)^2=e^{-2n\tau}$ are $1,\,0.368,\,0.135,\dots$ and both estimates obey their bounds. The gap is Jensen: $x^2=\mathrm{He}_0+\mathrm{He}_2$ has weights $\tfrac13,\tfrac23$ on eigenvalues $1,e^{-2\tau}$, and the one-sided value averages the squares $(1+2e^{-4\tau})/3$ while the two-sided one squares the average $((1+2e^{-2\tau})/3)^2$. The optimal $f$ in the one-sided problem is $\K^\dagger g/\|\K^\dagger g\|\propto\K x^2=e^{-2\tau}x^2+(1-e^{-2\tau})$, which contains a constant and is not in $F$.
The paper solves the two-sided problem: Eq. (24) is $CC^\dagger$, with the compression applied on both sides of the product. That is the right problem for a predictive and a retrospective neuron that each see only the features, and it is what CCA has always computed. But it is a modelling decision about representability, not an approximation to the one-sided Ritz problem, and neither is an approximation to the other. The paper does not flag the choice.
(d) When compression is exact, and when it is not. Show that if $F$ is invariant under both $\K$ and $\K^\dagger$ then $C$'s singular pairs are singular pairs of $\K$ with the same singular values. Verify the hypothesis for OU with linear features, using Problem 9. Then explain what the paper's construction returns for a nonlinear system with lag-vector features, and why a good VAMP score does not certify it.
Solution
If $\K F\subset F$ and $\K^\dagger F\subset F$ then $F^\perp$ is also invariant under both (for $h\perp F$ and $f\in F$: $\ip{f,\K h}=\ip{\K^\dagger f,h}=0$ since $\K^\dagger f\in F$; likewise for $\K^\dagger$). So $\K$ is block diagonal with respect to $F\oplus F^\perp$, $P_F\K|_F=\K|_F$ exactly, and $C^\dagger C=\K^\dagger\K|_F$; eigenvectors of $C^\dagger C$ are therefore eigenvectors of $\K^\dagger\K$, i.e. singular functions of $\K$, with singular values from the spectrum of $\K$ (a subset of it, the whole top block if $F$ contains the top singular functions).
OU with $\phi(x)=x$: $\K(\vec c\cdot x)=(e^{A^\top\tau}\vec c)\cdot x$ is linear (Problem 13d), and $\K^\dagger$ is the Koopman operator of the reversed process, which by Problem 9 is again OU with drift $A_{\rm rev}=\Sigma A^\top\Sigma^{-1}$, so $\K^\dagger(\vec c\cdot x)=(e^{A_{\rm rev}^\top\tau}\vec c)\cdot x$ is linear too. Both invariances hold, and Problem 14(d) is the resulting equality of Eq. (24) with Eq. (18). (Strictly, $F$ should include the constant so that $\lambda_0=1$ is represented; for zero-mean linear features $1\perp F$ and the block structure still holds.)
For a nonlinear process with lag-vector features $\phi(x)=x$, $\K x$ is a nonlinear function of the lag vector and neither invariance holds. The construction then returns the best linear filter pair: the linear predictive and retrospective observables most correlated across the lag. That is a well-defined and possibly useful object, but a coherent set of the underlying dynamics is a level set of a singular function which may be strongly nonlinear in the lag vector, and there is no theorem that the best linear pair approximates it. The VAMP score certifies only that $\sum\sigma_i(C)^2$ is as large as this feature class allows; without a reference value for $\sum\sigma_i(\K)^2$ it cannot say how far below the ceiling one is. Problem 13(f)(i) is the toy version: the feature set $\{x,x^2\}$ returns a confident $0.579$ where the truth is $0.368$, and nothing in the score flags it.
(e) Why the neuron cannot check (numeric). The natural certificate is the residual $r^2=\|\K f-\lambda g\|^2$ of a candidate pair. Expand it into three inner products and identify which ones are computable from $\Sigma_0$ and $\Sigma_\tau$. Show, via the law of total variance, that $\|\K f\|^2=\|f\|^2-\E\big[\operatorname{Var}(f(X_{t+\tau})\mid X_t)\big]$, and that $\|\K f\|^2=\E[f(X_{t+\tau})f(X'_{t+\tau})]$ for two independent futures $X,X'$ of the same present. Explain why a single trajectory cannot supply this, evaluate everything for the pair of (c), and confirm with the script.
Solution
$r^2=\|\K f\|^2-2\lambda\ip{g,\K f}+\lambda^2\|g\|^2$. For $f,g\in F$ the last two terms are $\vec c_g^{\,\top}\Sigma_\tau\vec c_f$ and $\vec c_g^{\,\top}\Sigma_0\vec c_g$, both from Eq. (23). The first is $\ip{\K f,\K f}$, which is not a bilinear form in $\phi$ evaluated at two times, so no lagged second moment of the features gives it.
Law of total variance: $\E[f(X_{t+\tau})^2\mid X_t]=(\K f)(X_t)^2+\operatorname{Var}(f(X_{t+\tau})\mid X_t)$. Taking expectations, $\|f\|^2=\|\K f\|^2+\E[\operatorname{Var}(f(X_{t+\tau})\mid X_t)]$, using stationarity on the left. So the single-trajectory quantity one can estimate, $\E[f(X_{t+\tau})^2]$, overestimates $\|\K f\|^2$ by the mean conditional variance, and this is the same gap as between the one-sided and two-sided values in (c) (the contraction bound of Problem 7a is this inequality). For the sibling identity, condition on the present: $\E[f(X_{t+\tau})f(X'_{t+\tau})\mid X_t]=(\K f)(X_t)^2$ by conditional independence, and average. So $\|\K f\|^2=\ip{f,\K^\dagger\K f}$ is a two-trajectory quantity, the sibling kernel of Problem 10, and estimating it needs pairs of futures launched from the same present. A single time series offers each present exactly one future. In a deterministic system the conditional variance vanishes, $\|\K f\|^2=\|f\|^2$, and the residual is computable from one trajectory; that is why residual DMD works there and why its stochastic extension needs extra sampling.
Both identities by direct integration. With $\K f(x)=\int p_\tau(y\mid x)f(y)\,dy$, $$\|\K f\|^2=\int\rho_0(x)\Big[\int p_\tau(y\mid x)f(y)\,dy\Big]^2dx=\iiint\rho_0(x)\,p_\tau(y\mid x)\,p_\tau(y'\mid x)\,f(y)f(y')\,dx\,dy\,dy' ,$$ writing the square as a double integral over two dummy futures. The weight $\rho_0(x)p_\tau(y\mid x)p_\tau(y'\mid x)$ is the joint density of a present $X_t\sim\rho_0$ and two conditionally independent futures launched from it (product of the two conditionals given the shared start), so the triple integral is $\E[f(X_{t+\tau})f(X'_{t+\tau})]$: the sibling identity. For the variance identity, $\int p_\tau(y\mid x)f(y)^2\,dy-\big[\int p_\tau(y\mid x)f(y)\,dy\big]^2=\operatorname{Var}(f(X_{t+\tau})\mid X_t=x)$ is the definition of a variance (second moment minus squared mean) under the kernel $p_\tau(\cdot\mid x)$. Multiply by $\rho_0(x)$ and integrate over $x$: the first term becomes $\iint\rho_0(x)p_\tau(y\mid x)f(y)^2\,dx\,dy=\int\rho_0(y)f(y)^2\,dy=\|f\|^2$, doing the $x$-integral first and using the invariance of $\rho_0$, $\int\rho_0(x)p_\tau(y\mid x)\,dx=\rho_0(y)$ (Problem 7); the second term is $\|\K f\|^2$ by the display above. Hence $\|f\|^2-\|\K f\|^2=\int\rho_0(x)\operatorname{Var}(f(X_{t+\tau})\mid X_t=x)\,dx$, the law of total variance in integral form. The single-trajectory quantity $\E[f(X_{t+\tau})^2]$ is the first term; what is missing is the triple integral, which needs two futures per present.
For the pair of (c), $f=g=x^2/\sqrt3$, $\lambda=c$: $r^2=\|\K f\|^2-c^2=\tfrac13(1+2e^{-4\tau})-\tfrac19(1+2e^{-2\tau})^2=0.424-0.335=0.089$ at $\tau=0.5$, against $r^2=0$ for the true pair $(\mathrm{He}_2/\sqrt2,\,e^{-2\tau})$. The residual would expose the compressed pair, but only with $\|\K f\|^2$ in hand. The script estimates it two ways: from sibling futures (200 000 stationary presents, two Euler–Maruyama futures each) it finds $0.428$ against the analytic $0.424$, giving $r^2\approx0.10$; from the single-trajectory proxy $\E[f(X_{t+\tau})^2]/\|f\|^2=1.000$ it would report $r^2\approx0.67$, wrong by the mean conditional variance $0.576$. The neuron has the second kind of data, not the first.
Problem 16 — Why the transient filter of Fig. 2 is predictive (numeric)
Background. The paper's Fig. 2 runs past–future CCA on lag vectors of a scalar "dead-leaves" signal, a sequence of plateaus at random luminance levels with sharp transitions, and finds two canonical directions above a spectral gap: a low-pass filter (sustained bipolar cell) and a smoothed derivative (transient bipolar cell). That the level of a plateau predicts the near future is obvious. That a derivative, which is zero everywhere except at an edge, predicts anything is not: after an edge one is simply on a new plateau, and a natural first guess is that an edge predicts a flat stretch ahead. This problem works out what the transient filter actually predicts and shows that it depends on a property of the leaf-size distribution.
code/p16_deadleaves.py.Goal: read the second canonical pair of Fig. 2 as a coherent pair, identify the mechanism that makes an edge informative, and see how time reversal acts on lag vectors.
(a) The memoryless case has one pair. Show that the autocovariance is $C(s)=\E[y(t)y(t+s)]=\sigma^2\,\Pi(s)$, where $\Pi(s)$ is the probability that no edge falls in an interval of length $s$, and that in the stationary regime $\Pi(s)=\frac1{\E T}\int_s^\infty P(T>u)\,du$. Conclude that for exponential lengths $C(s)=\sigma^2e^{-\lambda s}$, so that the signal is second-order indistinguishable from a one-dimensional OU process, and hence that linear past–future CCA has exactly one non-trivial pair, the level, for any lag length $d$.
Solution
If $t$ and $t+s$ fall on the same plateau, $y(t)y(t+s)=L^2$ with $\E L^2=\sigma^2$; if on different plateaus, the levels are independent with zero mean and the product averages to zero. Hence $C(s)=\sigma^2\Pi(s)$. In a stationary renewal process the plateau containing a typical time is length-biased: the residual length $R$ from $t$ to the next edge has density $P(T>u)/\E T$, so $\Pi(s)=P(R>s)=\frac1{\E T}\int_s^\infty P(T>u)\,du$. For $T\sim\mathrm{Exp}(\lambda)$, $P(T>u)=e^{-\lambda u}$ and $\Pi(s)=e^{-\lambda s}$.
A one-dimensional OU process $dx=-\lambda x\,dt+\sqrt{2\lambda\sigma^2}\,dW$ has the same autocovariance. Linear CCA between lag vectors depends on the process only through $\Sigma_0$ and $\Sigma_\tau$, which are built from $C$ (Problem 13b), so the dead-leaves signal and this OU give identical canonical correlations and directions. For the OU the lag vector is a noisy image of a one-dimensional state, so exactly one canonical correlation is non-zero, equal to $e^{-\lambda\tau}$ (in the adjacent-window construction the two windows meet at $y(t)$ and $y(t+1)$, and the correlation is $e^{-\lambda}$ per sample). The script confirms it: correlations $0.95,\,0.01,\,0.01,\dots$ for exponential plateaus with mean length $20$. A transient neuron would have nothing to predict.
(b) Heavy tails create a second pair. Explain why a non-exponential $\Pi$ gives more than one linear pair. Then identify the mechanism: show that $\E[y(t+\tau)\mid\text{level }L,\ \text{age }a]=L\,\Pi_a(\tau)$ with $\Pi_a(\tau)=P(T>a+\tau\mid T>a)$, and that for heavy-tailed $T$ this survival probability increases with the age $a$ of the plateau. What does a recent edge therefore say about the future, and why can a linear filter of the past detect it?
Solution
If $\Pi$ is not a single exponential, $C$ is not the autocovariance of any one-dimensional linear process, and the lag vector carries more than one linearly predictable direction (a sum of $m$ exponentials corresponds to an $m$-dimensional OU, Problem 13d generalised). For Pareto lengths the script finds correlations $0.92,\,0.21,\,0.14,\dots$: a clear second pair.
Condition on the present level $L$ and on the age $a$ (time since the last edge). Over the horizon either no edge occurs, and $y(t+\tau)=L$, or one does, and the new level has mean zero. So $\E[y(t+\tau)\mid L,a]=L\,P(\text{no edge in }[t,t+\tau]\mid a)=L\,\Pi_a(\tau)$ with $\Pi_a(\tau)=P(T>a+\tau)/P(T>a)$. For heavy-tailed $T$ this is increasing in $a$ (decreasing hazard: a plateau that has already lasted a long time is likely to last longer), while for exponential $T$ it is constant. Numerically, the probability that the level changes within $\tau$ is $0.84$ for plateaus younger than three samples and $0.16$ for plateaus older than thirty; for exponential lengths it is $0.45$ at every age.
So a recent edge means a young plateau, and a young plateau means the current level is a poor predictor of the future: the level will most likely be redrawn before $t+\tau$, i.e. revert toward the mean. That is a second-moment effect visible to a linear filter because the signed recent jump $y(t)-y(t-k)$ is correlated with the current level (after an up-step the level tends to be high) and, through the age it reveals, with the persistence of that level. The part of the jump uncorrelated with the level, which is what the second canonical variate is, predicts the correction to the level-based forecast.
(c) The coherent pair (numeric). Run the script for the heavy-tailed case. Report the whitened past and future filters of the first two pairs, the correlation of each canonical variate with the current level, the recent jump $y(t)-y(t-3)$, the future level $y(t+\tau)$ and the future change $y(t+\tau)-y(t)$, and state in words which coherent pair the second canonical direction defines. Compare with the paper's Fig. 2b and with the sustained/transient dichotomy.
Solution
| pair | $\rho$ | past filter (whitened, lags 0…11) | past variate correlates with | future variate correlates with |
|---|---|---|---|---|
| 1 | 0.92 | $1,\,0.57,\,0.41,\,0.27,\,0.22,\,0.20,\dots,0.16$ (low-pass) | level $1.00$; jump $0.37$ | $y(t+\tau)$: $0.45$ |
| 2 | 0.21 | $-0.76,\,-0.43,\,-0.04,\,0.39,\,0.58,\,0.60,\dots,1$ (derivative) | level $0.01$; jump $-0.61$ | $y(t+\tau)$: $0.76$; $y(t+\tau)-y(t)$: $0.70$ |
The future filters are the lag-reversed past filters (part d). Pair 1 is the level: its whitened filter is a decaying low-pass shape like the paper's dashed curve, even though in raw lag coordinates it is essentially $y(t)$ alone; whitening by $\Sigma_0^{1/2}$ smears a delta into the first column of $\Sigma_0^{1/2}$, which for a slowly decorrelating signal is a low-pass filter. Pair 2 is uncorrelated with the level by construction and reads the signed recent jump with negative sign: "just stepped down" gives a positive past variate. Its future partner, oriented so the pair is positively correlated, reads "the level at $t+\tau$ is high, and higher than now". So the coherent pair is
just stepped down $\;\longrightarrow\;$ will be higher by $t+\tau$, $\qquad$ just stepped up $\;\longrightarrow\;$ will be lower by $t+\tau$.
An edge does not predict a flat future; every moment is flat except at edges. It predicts that the current level will not last, and since levels are redrawn independently, that the signal will move back toward the mean. The ON transient unit, $H(+\mathbf w^\top\hat{\mathbf x})$ with $\mathbf w$ the derivative filter, is the membership index of "recent up-step, expect a decrease"; the OFF unit is its complement. The sustained pair reports the level; the transient pair reports, in effect, how much the level should be trusted. The whitened shapes match Fig. 2b, and the sustained/transient split of bipolar cells is read as the two most predictable directions of this input class. High for the mechanism in this model; whether real dead-leaves scans have the required heavy tail at the relevant scale, and whether the second correlation survives the retina's noise, is an empirical question the paper does not test directly.
(d) Time reversal acts on lag vectors by permuting lags. The dead-leaves signal is statistically time-reversible. Show that the lag-vector process is nevertheless not reversible in the sense of Problem 14(b)(ii), that instead $\Sigma_\tau^\top=J\Sigma_\tau J$ with $J$ the permutation reversing lag order, and deduce that the future canonical directions are the lag-reversed past ones, $\mathbf b_i=\pm J\mathbf a_i$. Check numerically, and use this to decode the paper's remark that the left singular vectors are obtained "by inverting the time axis (and inverting the sign for the second singular vector)".
Solution
Reversibility of $y$ means $(y(s))_s$ and $(y(-s))_s$ have the same law. The lag vector at time $t$ is $\hat{\mathbf x}(t)=(y(t),\dots,y(t-d+1))$; under time reversal the sample that was most recent becomes the oldest, so the reversed process's lag vector is $J\hat{\mathbf x}$, not $\hat{\mathbf x}$. Hence $[\Sigma_\tau]_{ij}=\E[y(t-i)\,y(t+\tau-j)]=C(\tau-j+i)$, whereas $[\Sigma_\tau]_{ji}=C(\tau-i+j)$: not equal in general. The script reports $\|\Sigma\text{-whitened }C-C^\top\|_\infty\approx0.4$. What reversibility does give is $[\Sigma_\tau]_{ij}=C(\tau+i-j)=[\Sigma_\tau]_{d-1-j,\,d-1-i}$, i.e. $\Sigma_\tau^\top=J\Sigma_\tau J$; the script finds this identity holds to $10^{-3}$. Since $\Sigma_0$ is Toeplitz, $J\Sigma_0J=\Sigma_0$ as well, so the whitened cross-covariance satisfies $\tilde C^\top=J\tilde CJ$. If $\tilde C\tilde{\mathbf b}=\rho\tilde{\mathbf a}$ and $\tilde C^\top\tilde{\mathbf a}=\rho\tilde{\mathbf b}$, then applying $J$ to the second and using $J\tilde C^\top J=\tilde C$ gives $\tilde C(J\tilde{\mathbf a})=\rho(J\tilde{\mathbf b})$: the pair $(J\tilde{\mathbf b},J\tilde{\mathbf a})$ is also a singular pair with the same $\rho$, so for a non-degenerate $\rho$, $\tilde{\mathbf b}=\pm J\tilde{\mathbf a}$ and likewise $\mathbf b=\pm J\mathbf a$. The table in (c) shows exactly this: each future filter is the past filter read backwards.
The paper's phrasing is this fact in plotting coordinates. Its Fig. 2b plots the past filters against time lag on $[-1,0]$; the future filter of a pair, plotted against time in the future window, is the mirror image ("invert the time axis"). The sign is a convention: with the orientation used here, where each pair is positively correlated, the mirrored derivative filter reads "will go down" when the past one reads "just went up" with no extra sign; if instead one insists that the mirrored filter keep the past filter's sign convention ("late minus early" in both windows), the pair needs a minus sign, which is the paper's "inverting the sign for the second". Either way the content is the same: the transient pair encodes mean reversion, and the sustained pair does not need a sign because $y(t)$ predicts $y(t+\tau)$ with a positive coefficient. The general lesson for Problem 14(b)(ii): "reversible implies $\Sigma_\tau$ symmetric" is a statement about features of a Markov state, and a lag vector is a Markov state only up to the reordering that time reversal induces.