rvar
rvs
Module for random variable classes.
- class quinn.rvar.rvs.RV[source]
Bases:
ModuleParent class for random variables.
- class quinn.rvar.rvs.MVN(mean, cov)[source]
Bases:
RV
- class quinn.rvar.rvs.Gaussian_1d(mu, rho=None, logsigma=None)[source]
Bases:
RVOne dimensional gaussian random variable.
- mu
Mean tensor.
- Type:
torch.Tensor
- rho
\(\rho\) tensor, where \(\rho=\log{(e^\sigma-1)}\) or, equivalently, \(\sigma=\log{(1+e^\rho)}\). This is the parameterization used in Blundell et al. [1].
- Type:
torch.Tensor
- logsigma
A more typical parameterization of the gaussian standard deviation \(\sigma\) via its natural logarithm \(\log{\sigma}\).
- Type:
torch.Tensor
- normal
The underlying torch-based normal random variable.
- Type:
torch.distributions.Normal
- __init__(mu, rho=None, logsigma=None)[source]
Instantiate the random variable.
- Parameters:
mu (torch.Tensor) – Mean tensor.
rho (torch.Tensor, optional) – Parameterization that relates to standard deviation as \(\sigma=\log{(1+e^\rho)}\).
logsigma (torch.Tensor, optional) – Parameterization that relates to standard deviation as \(\log{\sigma}\).
Note
Exactly one of rho or logsigma should be not None.
Note
rho and logsigma, if not None, should have same shape as mu.
- class quinn.rvar.rvs.GMM2_1d(pi, sigma1, sigma2)[source]
Bases:
RVOne dimensional gaussian mixture random variable with two gaussians that have zero mean and user-defined standard deviations.
- pi
Weight of the first gaussian. The second weight is 1-pi.
- Type:
float
- sigma1
Standard deviation of the first gaussian. Can also be a scalar torch.Tensor.
- Type:
float
- sigma2
Standard deviation of the second gaussian. Can also be a scalar torch.Tensor.
- Type:
float
- normal1
The underlying torch-based normal random variable for the first gaussian.
- Type:
torch.distributions.Normal
- normal2
The underlying torch-based normal random variable for the second gaussian.
- Type:
torch.distributions.Normal
- __init__(pi, sigma1, sigma2)[source]
Instantiation of the GMM2 object.
- Parameters:
pi (float) – Weight of the first gaussian. The second weight is 1-pi.
sigma1 (float) – Standard deviation of the first gaussian. Can also be a scalar torch.Tensor.
sigma2 (float) – Standard deviation of the second gaussian. Can also be a scalar torch.Tensor.