aepsych.likelihoods¶
aepsych.likelihoods module¶
- class aepsych.likelihoods.BernoulliObjectiveLikelihood(objective)[source]¶
Bases:
_OneDimensionalLikelihood
Bernoulli likelihood with a flexible link (objective) defined by a callable (which can be a botorch objective)
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- Parameters
objective (Callable) –
- forward(function_samples, **kwargs)[source]¶
Computes the conditional distribution \(p(\mathbf y \mid \mathbf f, \ldots)\) that defines the likelihood.
- Parameters
function_samples (torch.Tensor) – Samples from the function (\(\mathbf f\))
data (dict {str: torch.Tensor}, optional - Pyro integration only) – Additional variables that the likelihood needs to condition on. The keys of the dictionary will correspond to Pyro sample sites in the likelihood’s model/guide.
args – Additional args
kwargs – Additional kwargs
- Return type
Distribution
(with same shape as function_samples )
- training: bool¶
- class aepsych.likelihoods.OrdinalLikelihood(n_levels, link=None)[source]¶
Bases:
Likelihood
Ordinal likelihood, suitable for rating models (e.g. likert scales). Formally, .. math:: z_k(xmid f) := p(d_k < f(x) le d_{k+1}) = sigma(d_{k+1}-f(x)) - sigma(d_{k}-f(x)), where \(\sigma()\) is the link function (equivalent to the perceptual noise distribution in psychophysics terms), \(f(x)\) is the latent GP evaluated at x, and \(d_k\) is a learned cutpoint parameter for each level.
Initializes internal Module state, shared by both nn.Module and ScriptModule.
- Parameters
n_levels (int) –
link (Optional[Callable]) –
- property cutpoints¶
- forward(function_samples, *params, **kwargs)[source]¶
Computes the conditional distribution \(p(\mathbf y \mid \mathbf f, \ldots)\) that defines the likelihood.
- Parameters
function_samples (torch.Tensor) – Samples from the function (\(\mathbf f\))
data (dict {str: torch.Tensor}, optional - Pyro integration only) – Additional variables that the likelihood needs to condition on. The keys of the dictionary will correspond to Pyro sample sites in the likelihood’s model/guide.
args – Additional args
kwargs – Additional kwargs
- Return type
Distribution
(with same shape as function_samples )
- training: bool¶