[261] | 1 | \hypertarget{classbdm_1_1emix}{ |
---|
| 2 | \section{bdm::emix Class Reference} |
---|
| 3 | \label{classbdm_1_1emix}\index{bdm::emix@{bdm::emix}} |
---|
| 4 | } |
---|
| 5 | {\tt \#include $<$emix.h$>$} |
---|
| 6 | |
---|
| 7 | Inheritance diagram for bdm::emix:\nopagebreak |
---|
| 8 | \begin{figure}[H] |
---|
| 9 | \begin{center} |
---|
| 10 | \leavevmode |
---|
| 11 | \includegraphics[width=64pt]{classbdm_1_1emix__inherit__graph} |
---|
| 12 | \end{center} |
---|
| 13 | \end{figure} |
---|
[270] | 14 | |
---|
| 15 | |
---|
| 16 | \subsection{Detailed Description} |
---|
| 17 | Mixture of epdfs. |
---|
| 18 | |
---|
| 19 | Density function: \[ f(x) = \sum_{i=1}^{n} w_{i} f_i(x), \quad \sum_{i=1}^n w_i = 1. \] where $f_i(x)$ is any density on random variable $x$, called {\em component\/}, \subsection*{Public Member Functions} |
---|
[261] | 20 | \begin{CompactItemize} |
---|
| 21 | \item |
---|
[270] | 22 | \hypertarget{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}{ |
---|
| 23 | \hyperlink{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}{emix} ()} |
---|
| 24 | \label{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d} |
---|
[261] | 25 | |
---|
| 26 | \begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item |
---|
| 27 | void \hyperlink{classbdm_1_1emix_d8c1aefba8302759836b5f26999ce840}{set\_\-parameters} (const vec \&\hyperlink{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{w}, const Array$<$ \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ $>$ \&\hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms}, bool copy=true) |
---|
| 28 | \item |
---|
| 29 | \hypertarget{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}{ |
---|
| 30 | vec \hyperlink{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}{sample} () const } |
---|
| 31 | \label{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc} |
---|
| 32 | |
---|
[270] | 33 | \begin{CompactList}\small\item\em Returns a sample, $ x $ from density $ f_x()$. \item\end{CompactList}\item |
---|
[261] | 34 | \hypertarget{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}{ |
---|
| 35 | vec \hyperlink{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}{mean} () const } |
---|
| 36 | \label{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a} |
---|
| 37 | |
---|
| 38 | \begin{CompactList}\small\item\em return expected value \item\end{CompactList}\item |
---|
| 39 | \hypertarget{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}{ |
---|
| 40 | vec \hyperlink{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}{variance} () const } |
---|
| 41 | \label{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86} |
---|
| 42 | |
---|
| 43 | \begin{CompactList}\small\item\em return expected variance (not covariance!) \item\end{CompactList}\item |
---|
| 44 | \hypertarget{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}{ |
---|
| 45 | double \hyperlink{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}{evallog} (const vec \&val) const } |
---|
| 46 | \label{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e} |
---|
| 47 | |
---|
| 48 | \begin{CompactList}\small\item\em Compute log-probability of argument {\tt val}. \item\end{CompactList}\item |
---|
| 49 | \hypertarget{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}{ |
---|
| 50 | vec \hyperlink{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}{evallog\_\-m} (const mat \&Val) const } |
---|
| 51 | \label{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b} |
---|
| 52 | |
---|
| 53 | \begin{CompactList}\small\item\em Compute log-probability of multiple values argument {\tt val}. \item\end{CompactList}\item |
---|
| 54 | \hypertarget{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}{ |
---|
| 55 | mat \hyperlink{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}{evallog\_\-M} (const mat \&Val) const } |
---|
| 56 | \label{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2} |
---|
| 57 | |
---|
| 58 | \begin{CompactList}\small\item\em Auxiliary function that returns pdflog for each component. \item\end{CompactList}\item |
---|
| 59 | \hypertarget{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}{ |
---|
| 60 | \hyperlink{classbdm_1_1emix}{emix} $\ast$ \hyperlink{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}{marginal} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const } |
---|
| 61 | \label{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646} |
---|
| 62 | |
---|
| 63 | \begin{CompactList}\small\item\em Return marginal density on the given \hyperlink{classbdm_1_1RV}{RV}, the remainig rvs are intergrated out. \item\end{CompactList}\item |
---|
| 64 | \hypertarget{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}{ |
---|
| 65 | \hyperlink{classbdm_1_1mratio}{mratio} $\ast$ \hyperlink{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}{condition} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const } |
---|
| 66 | \label{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf} |
---|
| 67 | |
---|
| 68 | \begin{CompactList}\small\item\em Return conditional density on the given \hyperlink{classbdm_1_1RV}{RV}, the remaining rvs will be in conditioning. \item\end{CompactList}\item |
---|
| 69 | \hypertarget{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}{ |
---|
| 70 | vec \& \hyperlink{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}{\_\-w} ()} |
---|
| 71 | \label{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be} |
---|
| 72 | |
---|
| 73 | \begin{CompactList}\small\item\em returns a pointer to the internal mean value. Use with Care! \item\end{CompactList}\item |
---|
| 74 | \hypertarget{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ |
---|
| 75 | void \hyperlink{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ownComs} ()} |
---|
| 76 | \label{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e} |
---|
| 77 | |
---|
| 78 | \begin{CompactList}\small\item\em Auxiliary function for taking ownership of the \hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms()}. \item\end{CompactList}\item |
---|
| 79 | \hypertarget{classbdm_1_1emix_578616445243674438257be99ba71612}{ |
---|
| 80 | \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1emix_578616445243674438257be99ba71612}{\_\-Coms} (int i)} |
---|
| 81 | \label{classbdm_1_1emix_578616445243674438257be99ba71612} |
---|
| 82 | |
---|
[270] | 83 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize} |
---|
| 84 | \begin{Indent}{\bf Matematical Operations}\par |
---|
| 85 | \begin{CompactItemize} |
---|
| 86 | \item |
---|
[261] | 87 | \hypertarget{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{ |
---|
| 88 | virtual mat \hyperlink{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{sample\_\-m} (int N) const } |
---|
| 89 | \label{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058} |
---|
| 90 | |
---|
[270] | 91 | \begin{CompactList}\small\item\em Returns N samples, $ [x_1 , x_2 , \ldots \ $ from density $ f_x(rv)$. \item\end{CompactList}\end{CompactItemize} |
---|
| 92 | \end{Indent} |
---|
| 93 | \begin{Indent}{\bf Connection to other classes}\par |
---|
| 94 | {\em Description of the random quantity via attribute {\tt rv} is optional. For operations such as sampling {\tt rv} does not need to be set. However, for {\tt marginalization} and {\tt conditioning} {\tt rv} has to be set. NB: }\begin{CompactItemize} |
---|
| 95 | \item |
---|
| 96 | \hypertarget{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{ |
---|
| 97 | void \hyperlink{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv0)} |
---|
| 98 | \label{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff} |
---|
| 99 | |
---|
| 100 | \begin{CompactList}\small\item\em Name its rv. \item\end{CompactList}\item |
---|
| 101 | \hypertarget{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{ |
---|
| 102 | bool \hyperlink{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{isnamed} () const } |
---|
| 103 | \label{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9} |
---|
| 104 | |
---|
| 105 | \begin{CompactList}\small\item\em True if rv is assigned. \item\end{CompactList}\item |
---|
[261] | 106 | \hypertarget{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{ |
---|
| 107 | const \hyperlink{classbdm_1_1RV}{RV} \& \hyperlink{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{\_\-rv} () const } |
---|
| 108 | \label{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21} |
---|
| 109 | |
---|
[270] | 110 | \begin{CompactList}\small\item\em Return name (fails when isnamed is false). \item\end{CompactList}\end{CompactItemize} |
---|
| 111 | \end{Indent} |
---|
| 112 | \begin{Indent}{\bf Access to attributes}\par |
---|
| 113 | \begin{CompactItemize} |
---|
| 114 | \item |
---|
| 115 | \hypertarget{classbdm_1_1epdf_46dfe100cd621716ee5c7ee25a20f24b}{ |
---|
| 116 | bool \hyperlink{classbdm_1_1epdf_46dfe100cd621716ee5c7ee25a20f24b}{dimension} () const } |
---|
| 117 | \label{classbdm_1_1epdf_46dfe100cd621716ee5c7ee25a20f24b} |
---|
[261] | 118 | |
---|
[270] | 119 | \begin{CompactList}\small\item\em Size of the random variable. \item\end{CompactList}\end{CompactItemize} |
---|
| 120 | \end{Indent} |
---|
[261] | 121 | \subsection*{Protected Attributes} |
---|
| 122 | \begin{CompactItemize} |
---|
| 123 | \item |
---|
| 124 | \hypertarget{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{ |
---|
| 125 | vec \hyperlink{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{w}} |
---|
| 126 | \label{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46} |
---|
| 127 | |
---|
| 128 | \begin{CompactList}\small\item\em weights of the components \item\end{CompactList}\item |
---|
| 129 | \hypertarget{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{ |
---|
| 130 | Array$<$ \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ $>$ \hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms}} |
---|
| 131 | \label{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e} |
---|
| 132 | |
---|
| 133 | \begin{CompactList}\small\item\em Component (epdfs). \item\end{CompactList}\item |
---|
| 134 | \hypertarget{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}{ |
---|
| 135 | bool \hyperlink{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}{destroyComs}} |
---|
| 136 | \label{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4} |
---|
| 137 | |
---|
| 138 | \begin{CompactList}\small\item\em Flag if owning Coms. \item\end{CompactList}\item |
---|
[270] | 139 | \hypertarget{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{ |
---|
| 140 | int \hyperlink{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{dim}} |
---|
| 141 | \label{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce} |
---|
| 142 | |
---|
| 143 | \begin{CompactList}\small\item\em dimension of the random variable \item\end{CompactList}\item |
---|
[261] | 144 | \hypertarget{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{ |
---|
| 145 | \hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}} |
---|
| 146 | \label{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8} |
---|
| 147 | |
---|
[270] | 148 | \begin{CompactList}\small\item\em Description of the random variable. \item\end{CompactList}\end{CompactItemize} |
---|
[261] | 149 | |
---|
| 150 | |
---|
| 151 | \subsection{Member Function Documentation} |
---|
| 152 | \hypertarget{classbdm_1_1emix_d8c1aefba8302759836b5f26999ce840}{ |
---|
| 153 | \index{bdm::emix@{bdm::emix}!set\_\-parameters@{set\_\-parameters}} |
---|
| 154 | \index{set\_\-parameters@{set\_\-parameters}!bdm::emix@{bdm::emix}} |
---|
| 155 | \subsubsection[set\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void bdm::emix::set\_\-parameters (const vec \& {\em w}, \/ const Array$<$ {\bf epdf} $\ast$ $>$ \& {\em Coms}, \/ bool {\em copy} = {\tt true})}} |
---|
| 156 | \label{classbdm_1_1emix_d8c1aefba8302759836b5f26999ce840} |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | Set weights {\tt w} and components {\tt Coms} By default Coms are copied inside. Parameter {\tt copy} can be set to false if Coms live externally. Use method \hyperlink{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ownComs()} if Coms should be destroyed by the destructor. |
---|
| 160 | |
---|
[270] | 161 | References bdm::epdf::\_\-rv(), Coms, destroyComs, bdm::epdf::dim, bdm::RV::equal(), bdm::epdf::rv, and w. |
---|
[261] | 162 | |
---|
[270] | 163 | Referenced by bdm::MixEF::epredictor(), marginal(), and bdm::mmix::set\_\-parameters(). |
---|
[261] | 164 | |
---|
| 165 | The documentation for this class was generated from the following files:\begin{CompactItemize} |
---|
| 166 | \item |
---|
| 167 | \hyperlink{emix_8h}{emix.h}\item |
---|
| 168 | emix.cpp\end{CompactItemize} |
---|