parameterspace.priors.base
BasePrior
Base class defining the API of the priors.
The priors enable the incorporation of domain knowledge into the parameter definition by allowing the specification of a PDF/PMF. These are used to sample random values and to compute the loglikelihood of a given value.
loglikelihood(self, value)
Compute the log PDF (up to an additive constant) of a given value.
Note
Values for the priors are always after the transformation!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
|
[description] |
required |
Returns:
Type | Description |
---|---|
|
[descriptions] |
Source code in parameterspace/priors/base.py
def loglikelihood(self, value):
"""
Compute the log PDF (up to an additive constant) of a given value.
Note:
Values for the priors are always after the transformation!
Args:
value: [description]
Returns:
[descriptions]
"""
return np.log(self.pdf(value))
pdf(self, value)
Computes the PDF of a given value.
Note
Values for the priors are always after the transformation!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
|
[description] |
required |
Returns:
Type | Description |
---|---|
|
[descriptions] |
Source code in parameterspace/priors/base.py
@abc.abstractmethod
def pdf(self, value):
"""
Computes the PDF of a given value.
Note:
Values for the priors are always after the transformation!
Args:
value: [description]
Returns:
[descriptions]
"""
sample(self, num_samples=1)
Draw random samples from the prior.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_samples |
int |
[description] |
1 |
Returns:
Type | Description |
---|---|
|
[descriptions] |
Source code in parameterspace/priors/base.py
@abc.abstractmethod
def sample(self, num_samples: int = 1):
"""
Draw random samples from the prior.
Args:
num_samples: [description]
Returns:
[descriptions]
"""