Skip to main content

core.FactorCov

core.FactorCov(factor)

Low-rank covariance \(F F^\top\) per input.

The draws of sample are joint across the batch, as with SampleCov.

Parameters

Name Type Description Default
factor Tensor The factor \(F\), [N, *event, R]. required

Methods

Name Description
diagonal \(\sum_r F_{\cdot r}^2\), [N, *event].
per_input \(F F^\top\) per input, [N, E, E].
sample n_samples draws \(F z\), \(z \sim \mathcal{N}(0, I_R)\), one \(z\) per draw for all inputs.
scaled The factor times \(\sqrt{s}\).

diagonal

core.FactorCov.diagonal()

\(\sum_r F_{\cdot r}^2\), [N, *event].

Returns

Name Type Description
Tensor A tensor shaped like the mean.

per_input

core.FactorCov.per_input()

\(F F^\top\) per input, [N, E, E].

Returns

Name Type Description
Tensor The blocks, [N, E, E].

Raises

Name Type Description
StructureError An input has more than MAX_DENSE_EVENT output entries.

sample

core.FactorCov.sample(n_samples, /, *, generator=None)

n_samples draws \(F z\), \(z \sim \mathcal{N}(0, I_R)\), one \(z\) per draw for all inputs.

Parameters

Name Type Description Default
n_samples int Number of draws. required
generator torch.Generator | None The generator to draw with, on any device: the draws move to the factor’s. None means torch’s global RNG. None

Returns

Name Type Description
Tensor The draws, [n_samples, *mean.shape].

scaled

core.FactorCov.scaled(s, /)

The factor times \(\sqrt{s}\).

Parameters

Name Type Description Default
s Tensor The factor \(s \ge 0\), a 0-dim tensor. required

Returns

Name Type Description
Self A covariance of the same type.