pybop.parameters.priors#
Classes#
A base class for defining prior distributions. |
|
Represents an exponential distribution with a specified scale parameter. |
|
Represents a Gaussian (normal) distribution with a given mean and standard deviation. |
|
Represents a uniform distribution over a specified interval. |
Module Contents#
- class pybop.parameters.priors.BasePrior[source]#
A base class for defining prior distributions.
This class provides a foundation for implementing various prior distributions. It includes methods for calculating the probability density function (PDF), log probability density function (log PDF), and generating random variates from the distribution.
- prior#
The underlying continuous random variable distribution.
- Type:
scipy.stats.rv_continuous
- loc#
The location parameter of the distribution.
- Type:
float
- scale#
The scale parameter of the distribution.
- Type:
float
- logpdf(x)[source]#
Calculates the logarithm of the probability density function of the distribution at x.
- Parameters:
x (float) – The point(s) at which to evaluate the log pdf.
- Returns:
The logarithm of the probability density function value at x.
- Return type:
float
- pdf(x)[source]#
Calculates the probability density function (PDF) of the distribution at x.
- Parameters:
x (float) – The point(s) at which to evaluate the pdf.
- Returns:
The probability density function value at x.
- Return type:
float
- rvs(size=1, random_state=None)[source]#
Generates random variates from the distribution.
- Parameters:
size (int) – The number of random variates to generate.
random_state (int, optional) – The random state seed for reproducibility. Default is None.
- Returns:
An array of random variates from the distribution.
- Return type:
array_like
- Raises:
ValueError – If the size parameter is negative.
- class pybop.parameters.priors.Exponential(scale, loc=0, random_state=None)[source]#
Bases:
BasePriorRepresents an exponential distribution with a specified scale parameter.
This class provides methods to calculate the pdf, the log pdf, and to generate random variates from the distribution.
- Parameters:
scale (float) – The scale parameter (lambda) of the exponential distribution.
- class pybop.parameters.priors.Gaussian(mean, sigma, random_state=None)[source]#
Bases:
BasePriorRepresents a Gaussian (normal) distribution with a given mean and standard deviation.
This class provides methods to calculate the probability density function (pdf), the logarithm of the pdf, and to generate random variates (rvs) from the distribution.
- Parameters:
mean (float) – The mean (mu) of the Gaussian distribution.
sigma (float) – The standard deviation (sigma) of the Gaussian distribution.
- class pybop.parameters.priors.Uniform(lower, upper, random_state=None)[source]#
Bases:
BasePriorRepresents a uniform distribution over a specified interval.
This class provides methods to calculate the pdf, the log pdf, and to generate random variates from the distribution.
- Parameters:
lower (float) – The lower bound of the distribution.
upper (float) – The upper bound of the distribution.