#include <MixtureDistribution.h>
Definition at line 14 of file MixtureDistribution.h.
Public Member Functions | |
MixtureDistribution (std::vector< std::shared_ptr< Distribution >> const &components, Eigen::VectorXd const &probs) | |
virtual | ~MixtureDistribution ()=default |
virtual Eigen::VectorXd | GradLogDensityImpl (unsigned int wrt, ref_vector< Eigen::VectorXd > const &inputs) override |
std::vector< std::shared_ptr< Distribution > > | Components () |
Eigen::VectorXd | Probabilities () |
Public Member Functions inherited from muq::Modeling::Distribution | |
Distribution (unsigned int varSizeIn, Eigen::VectorXi const &hyperSizesIn=Eigen::VectorXi()) | |
virtual | ~Distribution ()=default |
virtual double | LogDensity (ref_vector< Eigen::VectorXd > const &inputs) |
Evaluate the log-density. More... | |
virtual double | LogDensity (std::vector< Eigen::VectorXd > const &inputs) |
VARIADIC_TO_REFVECTOR (LogDensity, Eigen::VectorXd, double) | |
virtual Eigen::VectorXd | GradLogDensity (unsigned int wrt, std::vector< Eigen::VectorXd > const &inputs) |
virtual Eigen::VectorXd | GradLogDensity (unsigned int wrt, ref_vector< Eigen::VectorXd > const &inputs) |
template<typename... Args> | |
Eigen::VectorXd | GradLogDensity (unsigned int wrt, Args... args) |
virtual Eigen::VectorXd | ApplyLogDensityHessian (unsigned int const inWrt1, unsigned int const inWrt2, ref_vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec) |
virtual Eigen::VectorXd | ApplyLogDensityHessian (unsigned int const inWrt1, unsigned int const inWrt2, std::vector< Eigen::VectorXd > const &input, Eigen::VectorXd const &vec) |
Eigen::VectorXd | Sample (ref_vector< Eigen::VectorXd > const &inputs) |
Sample the distribution. More... | |
Eigen::VectorXd | Sample (std::vector< Eigen::VectorXd > const &inputs) |
Eigen::VectorXd | Sample () |
Sample the distribution with no inputs. More... | |
VARIADIC_TO_REFVECTOR (Sample, Eigen::VectorXd, Eigen::VectorXd) | |
std::shared_ptr< Density > | AsDensity () |
Returns a density built from this distribution. More... | |
std::shared_ptr< RandomVariable > | AsVariable () |
Returns a random variable built from this distribution. More... | |
Additional Inherited Members | |
Public Attributes inherited from muq::Modeling::Distribution | |
const unsigned int | varSize |
const Eigen::VectorXi | hyperSizes |
MixtureDistribution::MixtureDistribution | ( | std::vector< std::shared_ptr< Distribution >> const & | components, |
Eigen::VectorXd const & | probs | ||
) |
Construct a mixture distribution from a list of components and a vector probabilities for each component.
[in] | components | List of component distributions |
[in] | probs | Vector of probabilities. Must have the same size as components. Probabilities will be normalized to sum to 1. |
Definition at line 8 of file MixtureDistribution.cpp.
References components, muq::Modeling::Distribution::hyperSizes, probs, and muq::Modeling::Distribution::varSize.
|
virtualdefault |
|
inline |
Returns the vector of component distributions.
Definition at line 36 of file MixtureDistribution.h.
References components.
|
overridevirtual |
Compute the gradient of the log density with respect to either the distribution input or the hyperparameters.
[in] | wrt | Specifies the index of the variable we wish to take the gradient wrt. If wrt==0, then the gradient should be taken wrt the input variable. |
Reimplemented from muq::Modeling::Distribution.
Definition at line 59 of file MixtureDistribution.cpp.
References components, muq::Modeling::Distribution::hyperSizes, probs, and muq::Modeling::Distribution::varSize.
|
overrideprotectedvirtual |
Compute the log density.
[in] | A | vector of extra hyperparameter vectors. |
Reimplemented from muq::Modeling::Distribution.
Definition at line 50 of file MixtureDistribution.cpp.
References components, and probs.
|
inline |
Returns the probability vector.
Definition at line 39 of file MixtureDistribution.h.
References probs.
|
overrideprotectedvirtual |
Sample the distribution.
Reimplemented from muq::Modeling::Distribution.
Definition at line 77 of file MixtureDistribution.cpp.
References components, and probs.
|
protected |
Definition at line 53 of file MixtureDistribution.h.
Referenced by Components(), GradLogDensityImpl(), LogDensityImpl(), MixtureDistribution(), and SampleImpl().
|
protected |
Definition at line 54 of file MixtureDistribution.h.
Referenced by GradLogDensityImpl(), LogDensityImpl(), MixtureDistribution(), Probabilities(), and SampleImpl().