1#ifndef LIKELIHOOD_DISCRETE_H
2#define LIKELIHOOD_DISCRETE_H
81 std::vector<double> weights,
82 unsigned int seed = std::random_device{}(),
83 bool standardize =
false);
86 std::vector<double>
rvs(std::size_t n)
override;
90 throw std::logic_error(
"LikelihoodMarginal::logpdf is not implemented");
95 throw std::logic_error(
"LikelihoodMarginal::f_df_ddf is not implemented");
100 double cdf(
double)
override {
101 throw std::logic_error(
"LikelihoodMarginal::cdf is not implemented");
105 double ppf(
double)
override {
106 throw std::logic_error(
"LikelihoodMarginal::ppf is not implemented");
111 throw std::logic_error(
"LikelihoodMarginal::mean is not implemented");
116 throw std::logic_error(
"LikelihoodMarginal::std is not implemented");
125 void build_alias_tables(std::vector<double> weights);
128 std::uniform_real_distribution<double> u01_;
129 std::vector<double> values_;
131 std::vector<double> prob_;
132 std::vector<std::size_t> alias_;
Base type for lightweight configuration structures.
Interface for one-dimensional marginal probability distributions.
Discrete marginal sampler using Vose's alias method.
double logpdf(double) override
Not implemented; use this class only for sampling.
double ppf(double) override
Not implemented; use this class only for sampling.
std::vector< double > rvs(std::size_t n) override
Draws random samples from the marginal distribution.
double mean() override
Not implemented; use this class only for sampling.
double cdf(double) override
Not implemented; use this class only for sampling.
double std() override
Not implemented; use this class only for sampling.
PDFDiff f_df_ddf(double) override
Not implemented; use this class only for sampling.
Polymorphic base class for configuration types.
Abstract interface for scalar marginal distributions.
Configuration object for LikelihoodMarginal.
std::vector< double > values
std::vector< double > weights
Support points of the discrete distribution.