Support non-reversible quasiseparable kernels#276
Open
burke86 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for non-reversible state-space models in tinygp’s quasiseparable kernel machinery.
The previous QSM generator construction works for tinygp’s existing reversible kernels, but it relies implicitly on a reversibility identity that does not hold for general causal systems. In a non-reversible model, the ordering of the stationary covariance and transition matrices matters. Using the reversible ordering can produce incorrectly oriented cross-covariances and disagreement between the quasiseparable, Kalman, and direct dense formulations.
Motivation
I encountered this while implementing a causal filtered-response kernel in which a latent stochastic process drives a downstream response through a one-way linear filter. This structure appears in many settings beyond that particular application, including delayed-response systems, causal multivariate Gaussian processes. These models are generally non-reversible because information propagates from the driver into the response without an equivalent reverse coupling.
Previous behavior
tinygp defines$F_{21}$ is the physical forward column-state transition,
transition_matrix(t1, t2)using an adjoint convention. Ifthen
transition_matrix(t1, t2)returnsThe previous QSM construction used
For$t_i>t_j$ , this represents the lower-triangular covariance as
Because$A_k=F_k^{\mathsf{T}}$ , this is equivalent to
The covariance obtained by propagating the column state forward in time is instead
The essential difference is therefore
For a reversible stationary process, these expressions are equal:
This is why the previous implementation works for tinygp’s existing reversible kernels and why the issue was not exposed by the existing test suite.
For a non-reversible process, such as a one-way driver-to-response system,
The previous QSM construction can therefore produce incorrectly oriented cross-covariances. This is especially visible when different observations load different components of a multivariate latent state.
New behavior
This PR stores the physical forward transition in the QSM generators:
The resulting lower-triangular covariance element is
which is the standard causal state-space covariance.
For reversible kernels, the old and new constructions represent the same covariance. The change therefore preserves existing behavior while extending the QSM machinery to the more general non-reversible case.
Changes
This PR:
transition_matrixreturns the adjoint of the physical forward column-state transition;The test kernel has one-way coupling of the form
so its stationary state satisfies
It therefore exposes transition-orientation errors that reversible test kernels cannot detect.
Testing
The new tests compare:
QuasisepSolver;QuasisepSolver;KalmanSolver;The existing quasiseparable and Kalman tests continue to pass.
Validation on the clean branch:
User impact
This enables custom quasiseparable kernels for causal and coupled state-space systems where one latent component drives another without reciprocal coupling.
Existing reversible kernels retain their current covariance and likelihood behavior, while non-reversible kernels now agree across the direct dense, Kalman, and quasiseparable implementations.