mean#

mean(x, rep_x)[source]#

Estimate the \(\mathbb{G}\)-invariant mean of a random variable.

Let \(\mathbf{X}: \Omega \to \mathcal{X}\) be a random variable taking values in the symmetric vector space \(\mathcal{X}\), with group representation \(\rho_{\mathcal{X}}:\mathbb{G}\to\mathrm{GL}(\mathcal{X})\), and marginal density \(\mathbb{P}_{\mathbf{X}}\). Under the assumption that this marginal is invariant under the group action (i.e., a point and all its symmetric points have equal likelihood under the marginal), formally:

\[\mathbb{P}_{\mathbf{X}}(\mathbf{x}) = \mathbb{P}_{\mathbf{X}}\!\left(\rho_{\mathcal{X}}(g)\mathbf{x}\right), \quad \forall \mathbf{x}\in\mathcal{X},\ \forall g\in\mathbb{G},\]

the true mean satisfies

\[\mathbb{E}[\mathbf{X}] = \rho_{\mathcal{X}}(g)\,\mathbb{E}[\mathbf{X}], \quad \forall g\in\mathbb{G},\]

hence \(\mathbb{E}[\mathbf{X}] \in \mathcal{X}^{\text{inv}}\).

Implementation: from samples \(\{\mathbf{x}^{(n)}\}_{n=1}^N\), we first compute the empirical mean

\[\widehat{\mathbb{E}}[\mathbf{X}] = \frac{1}{N}\sum_{n=1}^N \mathbf{x}^{(n)},\]

and then project it onto the invariant subspace:

\[\widehat{\mathbb{E}}_{\mathbb{G}}[\mathbf{X}] = \mathbf{P}_{\mathrm{inv}}\,\widehat{\mathbb{E}}[\mathbf{X}], \quad \mathbf{P}_{\mathrm{inv}} = \mathbf{Q}\mathbf{S}\mathbf{Q}^T,\]

where \(\mathbf{S}\) selects trivial-irrep coordinates in the irrep-spectral basis. (see invariant_orthogonal_projector()). Under the repository’s canonical isotypic ordering, this corresponds to the first isotypic block when present.

Parameters:
  • x (Tensor) – (Tensor) samples of \(\mathbf{X}\) with shape \((N,D_x)\) or \((N,D_x,T)\); when a time axis is present it is folded into the sample axis.

  • rep_x (Representation) – (Representation) representation \(\rho_{\mathcal{X}}\) on \(\mathcal{X}\).

Returns:

Invariant mean vector in \(\mathcal{X}\).

Return type:

(Tensor)

Shape:
  • x: \((N,D_x)\) or \((N,D_x,T)\).

  • Output: \((D_x,)\).

Note

For repeated calls with the same representation object rep_x, this function caches \(\mathbf{P}_{\mathrm{inv}}\) in rep_x.attributes["invariant_orthogonal_projector"].