stats

Statistics utilities for symmetric random variables with known group representations.

symm_learning.stats.cov(x: Tensor, y: Tensor, rep_x: Representation, rep_y: Representation)[source]

Compute the covariance between two symmetric random variables.

The covariance of r.v. can be computed from the orthogonal projections of the r.v. to each isotypic subspace. Hence, in the disentangled/isotypic basis the covariance can be computed in block-diagonal form:

\[\begin{split}\begin{align} \mathbf{C}_{xy} &= \mathbf{Q}_y^T (\bigoplus_{k} \mathbf{C}_{xy}^{(k)} )\mathbf{Q}_x \\ &= \mathbf{Q}_y^T ( \bigoplus_{k} \sum_{b\in \mathbb{B}_k} \mathbf{Z}_b^{(k)} \otimes \mathbf{b} ) \mathbf{Q}_x \\ \end{align}\end{split}\]

Where \(\mathbf{Q}_x^{\mathsf T}\) and \(\mathbf{Q}_y^{\mathsf T}\) are the change-of-basis matrices to the isotypic bases of \(\mathcal{X}\) and \(\mathcal{Y}\), respectively; \(\mathbf{C}_{xy}^{(k)}\) is the covariance restricted to the isotypic subspaces of type k; and \(\mathbf{Z}_b^{(k)}\) are the free parameters—i.e. the expansion coefficients in the endomorphism basis \(\mathbb{B}_k\) of the irreducible representation of type k.

Parameters:
  • x (Tensor) – Realizations of a random variable \(X\).

  • y (Tensor) – Realizations of a random variable \(Y\).

  • rep_x (Representation) – The representation acting on the symmetric vector spaces \(\mathcal{X}\).

  • rep_y (Representation) – The representation acting on the symmetric vector spaces \(\mathcal{Y}\).

Returns:

The covariance matrix between the two random variables, of shape \((D_y, D_x)\).

Return type:

Tensor

Shape:

X: \((N, D_x)\) where \(D_x\) is the dimension of the random variable X. Y: \((N, D_y)\) where \(D_y\) is the dimension of the random variable Y.

Output: \((D_y, D_x)\)

symm_learning.stats.var_mean(x: Tensor, rep_x: Representation)[source]

Compute the mean and variance of a symmetric random variable.

Parameters:
  • x – (torch.Tensor) of shape \((N, D_x)\) containing the observations of the symmetric random

  • variable

  • rep_x – (Representation) representation of the symmetric random variable.

Returns:

Mean and variance of the symmetric random variable. The mean is restricted to be in the trivial/G-invariant subspace of the symmetric vector space. The variance is constrained such that in the irrep-spectral basis, each G-irreducible subspace (i.e., each subspace associated with an irrep) has the same variance in all dimensions of that subspace.

Return type:

(torch.Tensor, torch.Tensor)

Shape:
  • x: \((N, D_x)\) or \((N, D_x, T)\) where N is the number of samples, D_x is the dimension of the symmetric random variable, and T is the sequence length (if applicable).

  • Output: A tuple containing the variance and the mean. The variance has shape \((D_x,)\) and the mean has shape \((D_x,)\). If a sequence is provided (T dimension), the shapes are \((D_x, T)\).