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.

Parameters:
dimint

The dimensionality of the distribution.

radiusfloat

The radius of the soft ball.

sharpnessint

The sharpness of the soft boundary of the ball.

log_prob(x: Tensor) Tensor#

Return the log of the probability density function evaluated at x.

Parameters:
xtorch.Tensor

The input tensor.

Returns:
log_probtorch.Tensor

The log of the probability density function evaluated at x.

sample(n_samples: int) Tensor#

Get samples from the softball distribution.

Parameters:
n_samplesint

The number of samples to be drawn.

Returns:
samplestorch.Tensor

The samples drawn from the softball distribution.

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.

Parameters:
dimint

The dimensionality of the distribution.

meanfloat

The mean of the Gaussian distribution.

stddevfloat

The standard deviation of the Gaussian distribution.

log_prob(x: Tensor) Tensor#

Return the log of the probability density function evaluated at x.

Parameters:
xtorch.Tensor

The input tensor.

Returns:
log_probtorch.Tensor

The log of the probability density function evaluated at x.

sample(n_samples: int) Tensor#

Get samples from the Gaussian distribution.

Parameters:
n_samplesint

The number of samples to be drawn.

Returns:
samplestorch.Tensor

The samples drawn from the Gaussian distribution.

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.