|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Discrete marginal sampler using Vose's alias method. More...
#include <LikelihoodMarginal.h>


Public Member Functions | |
| LikelihoodMarginal (std::vector< double > values, std::vector< double > weights, unsigned int seed=std::random_device{}(), bool standardize=false) | |
| Constructs a discrete likelihood marginal. | |
| std::vector< double > | rvs (std::size_t n) override |
| Draws random samples from the marginal distribution. | |
| double | logpdf (double) override |
| Not implemented; use this class only for sampling. | |
| PDFDiff | f_df_ddf (double) override |
| Not implemented; use this class only for sampling. | |
| double | cdf (double) override |
| Not implemented; use this class only for sampling. | |
| double | ppf (double) override |
| Not implemented; use this class only for sampling. | |
| double | mean () override |
| Not implemented; use this class only for sampling. | |
| double | std () override |
| Not implemented; use this class only for sampling. | |
Public Member Functions inherited from IMarginalDistribution | |
| virtual | ~IMarginalDistribution ()=default |
| virtual Vector | sample (std::size_t n)=0 |
| virtual | ~IMarginalDistribution ()=default |
| Virtual destructor for safe polymorphic deletion. | |
Discrete marginal sampler using Vose's alias method.
This class implements efficient O(1) sampling from a finite weighted support.
The constructor:
If standardize is enabled, samples returned by rvs are transformed as:
![\[
z = \frac{x-\mu}{\sigma}.
\]](form_73.png)
std::logic_error instead of returning a plausible placeholder value. Definition at line 63 of file LikelihoodMarginal.h.
| LikelihoodMarginal::LikelihoodMarginal | ( | std::vector< double > | values, |
| std::vector< double > | weights, | ||
| unsigned int | seed = std::random_device{}(), |
||
| bool | standardize = false |
||
| ) |
Constructs a discrete likelihood marginal.
| values | Support values. |
| weights | Non-negative weights associated with support values. |
| seed | Seed for the internal random engine. |
| standardize | If true, sampled values are centered and rescaled using the weighted mean and standard deviation. |
| std::invalid_argument | if:
|
Definition at line 3 of file LikelihoodMarginal.cpp.
|
inlineoverridevirtual |
Not implemented; use this class only for sampling.
Implements IMarginalDistribution.
Definition at line 100 of file LikelihoodMarginal.h.
|
inlineoverridevirtual |
Not implemented; use this class only for sampling.
Implements IMarginalDistribution.
Definition at line 94 of file LikelihoodMarginal.h.
|
inlineoverridevirtual |
Not implemented; use this class only for sampling.
Implements IMarginalDistribution.
Definition at line 89 of file LikelihoodMarginal.h.
|
inlineoverridevirtual |
Not implemented; use this class only for sampling.
Implements IMarginalDistribution.
Definition at line 110 of file LikelihoodMarginal.h.
|
inlineoverridevirtual |
Not implemented; use this class only for sampling.
Implements IMarginalDistribution.
Definition at line 105 of file LikelihoodMarginal.h.
|
overridevirtual |
Draws random samples from the marginal distribution.
| n | Number of samples to generate. |
n containing iid draws. Implements IMarginalDistribution.
Definition at line 81 of file LikelihoodMarginal.cpp.
|
inlineoverridevirtual |
Not implemented; use this class only for sampling.
Implements IMarginalDistribution.
Definition at line 115 of file LikelihoodMarginal.h.