Biorthogonal PSD-Like Layers

A PSDLayer lifts $\mathbb{R}^{2n}$ to $\mathbb{R}^{2N}$ with one matrix $\Phi\in{}St(n, N)$, applied to $q$ and to $p$ alike, and its inverse in the LeftInverseSymplecticAutoencoder is the transpose. A BiorthogonalPSDLayer applies two matrices, $\Phi$ to $q$ and $\Psi$ to $p$, that only have to be biorthogonal, $\Psi^T\Phi = \mathbb{I}_n$. Biorthogonal weights of this kind are used in [40, 41].

The mathematics of the pairs is on the page The Biorthogonal Manifold of GeometricOptimizers: there the lift $A = \mathrm{diag}(\Phi, \Psi)$ is shown to be symplectic exactly when $\Psi^T\Phi = \mathbb{I}_n$ (A symplectic lift), the pairs form the homogeneous space $\mathcal{B}(n, N)\cong{}GL(N)/GL(N-n)$ of dimension $2Nn - n^2$ (A homogeneous space of the general linear group), and its global tangent space and retractions are given. This page says what the layers do with it.

The layers

BiorthogonalPSDLayer applies $A$, and TransposeBiorthogonalPSDLayer applies its symplectic inverse $A^+ = \mathrm{diag}(\Psi^T, \Phi^T)$, i.e. $\Psi^T$ to $q$ and $\Phi^T$ to $p$; both docstrings below give the matrices. The PSDLayer is the case $\Phi = \Psi\in{}St(n, N)$, where $A^+ = A^T$.

parameterlength returns the dimension $2Nn - n^2$ of $\mathcal{B}(n, N)$, as parameterlength of a PSDLayer returns $\dim{}St(n, N) = Nn - \frac{n(n+1)}{2}$. A biorthogonal lift therefore has $Nn - \frac{n(n-1)}{2}$ more free parameters than the PSDLayer of the same size, slightly more than twice as many.

The parameters

The layer has one parameter, weight, a point of BiorthogonalManifold, which stores the $N\times{}2n$ matrix $[\Phi\ \ \Psi]$. BiorthogonalPSDLayer multiplies by the two halves of that matrix and TransposeBiorthogonalPSDLayer by their transposes; neither inverts a matrix. $\Psi^T\Phi = \mathbb{I}_n$ is a property of the point, and holds to the accuracy with which the point is on the manifold, which check of GeometricOptimizers measures as $\|\Psi^T\Phi - \mathbb{I}_n\|$.

The layer is initialized at the pair $(U, U)$, with $U\in{}St(n, N)$ the matrix that a PSDLayer of the same size applies to $q$ and $p$ when it draws its weight from the same random number generator and initializer: that weight for $n < N$, its transpose for $n = N$. So the layer starts as that PSDLayer.

The weight is trained on $\mathcal{B}(n, N)$ by the manifold optimizers of GeometricOptimizers, as the weight of a PSDLayer is trained on the Stiefel manifold: the gradient that automatic differentiation returns for weight is the derivative with respect to the stored matrix $[\Phi\ \ \Psi]$, the optimizer projects it onto the tangent space with rgrad and steps through the global tangent space of the manifold, and the retraction keeps $\Psi^T\Phi = \mathbb{I}_n$. Adam takes entrywise second moments in the coordinates of the global section, and on this manifold its step depends on that section and need not descend; GradientMethod and MomentumMethod do not depend on the section.

In the left-inverse symplectic autoencoder

LeftInverseSymplecticAutoencoder(full_dim, reduced_dim; biorthogonal = true) uses a BiorthogonalPSDLayer for every lift of its decoder, and the encoder applies the TransposeBiorthogonalPSDLayers, sharing their parameters. The encoder is still an exact left inverse of the decoder for every value of the parameters, since each layer of the encoder is the symplectic inverse of a layer of the decoder.

using GeometricMachineLearning

arch = LeftInverseSymplecticAutoencoder(10, 4; n_blocks = 2, n_layers = 2, biorthogonal = true)
nn = NeuralNetwork(arch)
ξ = rand(4)
encoder(nn)(decoder(nn)(ξ)) ≈ ξ
true

Library Functions

GeometricMachineLearning.BiorthogonalPSDLayer — Type
BiorthogonalPSDLayer(input_dim, output_dim)

Make an instance of BiorthogonalPSDLayer, a symplectic lift from $\mathbb{R}^{2n}$ (input_dim) to $\mathbb{R}^{2N}$ (output_dim), $n \leq N$.

The layer is the block-diagonal matrix

\[A = \begin{bmatrix} \Phi & \mathbb{O} \\ \mathbb{O} & \Psi \end{bmatrix}, \qquad \Psi^T\Phi = \mathbb{I}_n,\]

with a biorthogonal pair $\Phi, \Psi \in \mathbb{R}^{N\times{}n}$. The constraint $\Psi^T\Phi = \mathbb{I}_n$ is equivalent to $A^T\mathbb{J}_{2N}A = \mathbb{J}_{2n}$, so $A$ is symplectic. PSDLayer is the case $\Phi = \Psi \in St(n, N)$.

The pair is the one parameter weight, a point of the manifold of biorthogonal pairs BiorthogonalManifold, which stores the $N\times{}2n$ matrix $[\Phi\ \ \Psi]$. parameterlength is the dimension $2Nn - n^2$ of that manifold. The initial parameter is the pair $(U, U)$, with $U \in St(n, N)$ the matrix that PSDLayer(input_dim, output_dim) applies to $q$ and $p$ when it draws its weight with the same random number generator and initializer: that weight for $n < N$, its transpose for $n = N$. So a new layer is that PSDLayer.

Its symplectic inverse $A^+ = \mathbb{J}_{2n}^TA^T\mathbb{J}_{2N}$ is TransposeBiorthogonalPSDLayer, returned by inverse_layer.

source
GeometricMachineLearning.TransposeBiorthogonalPSDLayer — Type
TransposeBiorthogonalPSDLayer(input_dim, output_dim)

Make an instance of TransposeBiorthogonalPSDLayer, the symplectic inverse of BiorthogonalPSDLayer(output_dim, input_dim), sharing its parameter tuple ps = (weight = B,) with B the point $[\Phi\ \ \Psi]$ of the manifold of biorthogonal pairs:

\[A^+ = \begin{bmatrix} \Psi^T & \mathbb{O} \\ \mathbb{O} & \Phi^T \end{bmatrix}.\]

Since $\Psi^T\Phi = \mathbb{I}_n$, it is a left inverse of BiorthogonalPSDLayer at every point of the manifold.

source