core.priors#
This module contains the classes implementing some of the prior distributions used in the core.model.BulkDGD.
- class bulkdgd.core.priors.SoftballPrior(dim: int, radius: float, sharpness: float)#
Class implementing a “softball” prior distribution.
It is an almost uniform prior for an m-dimensional ball, with the logistic function making a soft (differentiable) boundary.
- __init__(dim: int, radius: float, sharpness: float) None#
Initialize an instance of the softball prior distribution.
- log_prob(x: Tensor) Tensor#
Return the log of the probability density function evaluated at
x.- Parameters:
- x
torch.Tensor The input tensor.
- x
- Returns:
- log_prob
torch.Tensor The log of the probability density function evaluated at
x.
- log_prob
- sample(n_samples: int) Tensor#
Get samples from the softball distribution.
- Parameters:
- n_samples
int The number of samples to be drawn.
- n_samples
- Returns:
- samples
torch.Tensor The samples drawn from the softball distribution.
- samples
- property dim#
The dimensionality of the softball distribution.
- property radius#
The radius of the soft ball.
- property sharpness#
The sharpness of the soft boundary of the ball.
- class bulkdgd.core.priors.GaussianPrior(dim: int, mean: float, stddev: float)#
Class implementing a Gaussian prior distribution.
- __init__(dim: int, mean: float, stddev: float) None#
Initialize an instance of the Gaussian distribution.
- log_prob(x: Tensor) Tensor#
Return the log of the probability density function evaluated at
x.- Parameters:
- x
torch.Tensor The input tensor.
- x
- Returns:
- log_prob
torch.Tensor The log of the probability density function evaluated at
x.
- log_prob
- sample(n_samples: int) Tensor#
Get samples from the Gaussian distribution.
- Parameters:
- n_samples
int The number of samples to be drawn.
- n_samples
- Returns:
- samples
torch.Tensor The samples drawn from the Gaussian distribution.
- samples
- property dim#
The dimensionality of the Gaussian distribution.
- property mean#
The mean of the Gaussian distribution.
- property stddev#
The standard deviation of the Gaussian distribution.