template<typename T = double>
LikelihoodFunction class
Abstract base class for likelihood functions in Bayesian analysis.
| Template parameters | |
|---|---|
| T | Floating point type for calculations |
Represents the probability of observing data given parameters. Supports both single observations and vectorized calculations.
Derived classes
-
template<typename T = double>class BernoulliLikelihood
- Bernoulli likelihood for binary outcomes.
-
template<typename T = double>class BinomialLikelihood
- Binomial likelihood for count data.
-
template<typename T = double>class CustomLikelihood
- Custom likelihood function wrapper.
-
template<typename T = double>class NormalKnownVarianceLikelihood
- Normal likelihood with known variance.
-
template<typename T = double>class PoissonLikelihood
- Poisson likelihood for count data.
Public types
- using value_type = T
- using vector_type = boost::numeric::ublas::vector<T>
-
using function_type = boost::function<T(T, const vector_
type&)>
Constructors, destructors, conversion operators
- ~LikelihoodFunction() defaulted virtual
Public functions
- auto evaluate(T theta, T observation) const -> T pure virtual
- Evaluate likelihood for a single observation.
-
auto evaluate(T theta,
const vector_
type& observations) const -> T pure virtual - Evaluate likelihood for multiple observations.
- auto log_evaluate(T theta, T observation) const -> T virtual
- Evaluate log-likelihood for numerical stability.
-
auto log_evaluate(T theta,
const vector_
type& observations) const -> T virtual - Evaluate log-likelihood for multiple observations.
-
auto sufficient_statistics(const vector_
type& observations) const -> vector_ type pure virtual - Get the sufficient statistics for the data.
- auto family() const -> std::string pure virtual
- Get the family name of the likelihood.
- auto clone() const -> std::unique_ptr<LikelihoodFunction<T>> pure virtual
- Clone the likelihood function.
- auto has_conjugate_prior() const -> bool virtual
- Check if the likelihood has a conjugate prior.
- auto conjugate_prior_family() const -> std::optional<std::string> virtual
- Get the name of the conjugate prior family (if exists)
Function documentation
template<typename T>
T liarsdice:: bayesian:: LikelihoodFunction<T>:: evaluate(T theta,
T observation) const pure virtual
Evaluate likelihood for a single observation.
| Parameters | |
|---|---|
| theta | Parameter value |
| observation | Single data point |
| Returns | Likelihood value |
template<typename T>
T liarsdice:: bayesian:: LikelihoodFunction<T>:: evaluate(T theta,
const vector_ type& observations) const pure virtual
Evaluate likelihood for multiple observations.
| Parameters | |
|---|---|
| theta | Parameter value |
| observations | Vector of data points |
| Returns | Combined likelihood value |
template<typename T>
T liarsdice:: bayesian:: LikelihoodFunction<T>:: log_evaluate(T theta,
T observation) const virtual
Evaluate log-likelihood for numerical stability.
| Parameters | |
|---|---|
| theta | Parameter value |
| observation | Single data point |
| Returns | Log-likelihood value |
template<typename T>
T liarsdice:: bayesian:: LikelihoodFunction<T>:: log_evaluate(T theta,
const vector_ type& observations) const virtual
Evaluate log-likelihood for multiple observations.
| Parameters | |
|---|---|
| theta | Parameter value |
| observations | Vector of data points |
| Returns | Combined log-likelihood value |
template<typename T>
vector_ type liarsdice:: bayesian:: LikelihoodFunction<T>:: sufficient_statistics(const vector_ type& observations) const pure virtual
Get the sufficient statistics for the data.
| Parameters | |
|---|---|
| observations | Data points |
| Returns | Vector of sufficient statistics |