[261] | 1 | \hypertarget{classbdm_1_1mratio}{ |
---|
| 2 | \section{bdm::mratio Class Reference} |
---|
| 3 | \label{classbdm_1_1mratio}\index{bdm::mratio@{bdm::mratio}} |
---|
| 4 | } |
---|
| 5 | {\tt \#include $<$emix.h$>$} |
---|
| 6 | |
---|
| 7 | Inheritance diagram for bdm::mratio:\nopagebreak |
---|
| 8 | \begin{figure}[H] |
---|
| 9 | \begin{center} |
---|
| 10 | \leavevmode |
---|
| 11 | \includegraphics[width=64pt]{classbdm_1_1mratio__inherit__graph} |
---|
| 12 | \end{center} |
---|
| 13 | \end{figure} |
---|
[270] | 14 | |
---|
| 15 | |
---|
| 16 | \subsection{Detailed Description} |
---|
| 17 | Class representing ratio of two densities which arise e.g. by applying the Bayes rule. It represents density in the form: \[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \] where $ f(rvc) = \int f(rv,rvc) d\ rv $. |
---|
| 18 | |
---|
| 19 | In particular this type of arise by conditioning of a mixture model. |
---|
| 20 | |
---|
| 21 | At present the only supported operation is \hyperlink{classbdm_1_1mratio_3a2cbce8c61ca9f592d9c2220f7c1204}{evallogcond()}. \subsection*{Public Member Functions} |
---|
[261] | 22 | \begin{CompactItemize} |
---|
| 23 | \item |
---|
[270] | 24 | \hyperlink{classbdm_1_1mratio_0ff56d13f9515d7e5f23b7a4cc5529b4}{mratio} (const \hyperlink{classbdm_1_1epdf}{epdf} $\ast$nom0, const \hyperlink{classbdm_1_1RV}{RV} \&rv, bool copy=false) |
---|
[261] | 25 | \item |
---|
| 26 | \hypertarget{classbdm_1_1mratio_3a2cbce8c61ca9f592d9c2220f7c1204}{ |
---|
| 27 | double \hyperlink{classbdm_1_1mratio_3a2cbce8c61ca9f592d9c2220f7c1204}{evallogcond} (const vec \&val, const vec \&cond)} |
---|
| 28 | \label{classbdm_1_1mratio_3a2cbce8c61ca9f592d9c2220f7c1204} |
---|
| 29 | |
---|
| 30 | \begin{CompactList}\small\item\em Shortcut for conditioning and evaluation of the internal \hyperlink{classbdm_1_1epdf}{epdf}. In some cases, this operation can be implemented efficiently. \item\end{CompactList}\item |
---|
| 31 | \hypertarget{classbdm_1_1mratio_c8b39fea586d4258bb3c881406edaf15}{ |
---|
| 32 | void \hyperlink{classbdm_1_1mratio_c8b39fea586d4258bb3c881406edaf15}{ownnom} ()} |
---|
| 33 | \label{classbdm_1_1mratio_c8b39fea586d4258bb3c881406edaf15} |
---|
| 34 | |
---|
| 35 | \begin{CompactList}\small\item\em Object takes ownership of nom and will destroy it. \item\end{CompactList}\item |
---|
| 36 | \hypertarget{classbdm_1_1mratio_c0cc0b25dbdc54751466616655454c5c}{ |
---|
| 37 | \hyperlink{classbdm_1_1mratio_c0cc0b25dbdc54751466616655454c5c}{$\sim$mratio} ()} |
---|
| 38 | \label{classbdm_1_1mratio_c0cc0b25dbdc54751466616655454c5c} |
---|
| 39 | |
---|
[270] | 40 | \begin{CompactList}\small\item\em Default destructor. \item\end{CompactList}\end{CompactItemize} |
---|
| 41 | \begin{Indent}{\bf Matematical operations}\par |
---|
| 42 | \begin{CompactItemize} |
---|
| 43 | \item |
---|
[269] | 44 | virtual vec \hyperlink{classbdm_1_1mpdf_f0c1db6fcbb3aae2dd6123884457a367}{samplecond} (const vec \&cond) |
---|
[261] | 45 | \begin{CompactList}\small\item\em Returns a sample from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. \item\end{CompactList}\item |
---|
[270] | 46 | virtual mat \hyperlink{classbdm_1_1mpdf_afe4185b26baeb03688202e254d3b005}{samplecond\_\-m} (const vec \&cond, int N) |
---|
[261] | 47 | \begin{CompactList}\small\item\em Returns. \item\end{CompactList}\item |
---|
| 48 | \hypertarget{classbdm_1_1mpdf_db94784a9aacf74c65c5a014f6743530}{ |
---|
| 49 | virtual void \hyperlink{classbdm_1_1mpdf_db94784a9aacf74c65c5a014f6743530}{condition} (const vec \&cond)} |
---|
| 50 | \label{classbdm_1_1mpdf_db94784a9aacf74c65c5a014f6743530} |
---|
| 51 | |
---|
| 52 | \begin{CompactList}\small\item\em Update {\tt ep} so that it represents this \hyperlink{classbdm_1_1mpdf}{mpdf} conditioned on {\tt rvc} = cond. \item\end{CompactList}\item |
---|
| 53 | \hypertarget{classbdm_1_1mpdf_0b0ed1ed663071bb7cf4a1349eb94fcb}{ |
---|
| 54 | virtual vec \hyperlink{classbdm_1_1mpdf_0b0ed1ed663071bb7cf4a1349eb94fcb}{evallogcond\_\-m} (const mat \&Dt, const vec \&cond)} |
---|
| 55 | \label{classbdm_1_1mpdf_0b0ed1ed663071bb7cf4a1349eb94fcb} |
---|
| 56 | |
---|
[270] | 57 | \begin{CompactList}\small\item\em Matrix version of evallogcond. \item\end{CompactList}\end{CompactItemize} |
---|
| 58 | \end{Indent} |
---|
| 59 | \begin{Indent}{\bf Access to attributes}\par |
---|
| 60 | \begin{CompactItemize} |
---|
| 61 | \item |
---|
| 62 | \hypertarget{classbdm_1_1mpdf_5571482d150fbcb72cc36f6694ce1a10}{ |
---|
| 63 | \hyperlink{classbdm_1_1RV}{RV} \textbf{\_\-rv} ()} |
---|
| 64 | \label{classbdm_1_1mpdf_5571482d150fbcb72cc36f6694ce1a10} |
---|
[261] | 65 | |
---|
[270] | 66 | \item |
---|
| 67 | \hypertarget{classbdm_1_1mpdf_26001264236846897bd11e4baad47245}{ |
---|
| 68 | \hyperlink{classbdm_1_1RV}{RV} \textbf{\_\-rvc} ()} |
---|
| 69 | \label{classbdm_1_1mpdf_26001264236846897bd11e4baad47245} |
---|
[261] | 70 | |
---|
[270] | 71 | \item |
---|
| 72 | \hypertarget{classbdm_1_1mpdf_1c2bae3e1e90874e72941863974ec0ed}{ |
---|
| 73 | int \textbf{dimension} ()} |
---|
| 74 | \label{classbdm_1_1mpdf_1c2bae3e1e90874e72941863974ec0ed} |
---|
| 75 | |
---|
| 76 | \item |
---|
| 77 | \hypertarget{classbdm_1_1mpdf_35e135910aed187b7290742f50e61bc8}{ |
---|
| 78 | int \textbf{dimensionc} ()} |
---|
| 79 | \label{classbdm_1_1mpdf_35e135910aed187b7290742f50e61bc8} |
---|
| 80 | |
---|
| 81 | \item |
---|
[261] | 82 | \hypertarget{classbdm_1_1mpdf_1892fe3933488942253679f068e9e7f6}{ |
---|
[270] | 83 | \hyperlink{classbdm_1_1epdf}{epdf} \& \textbf{\_\-epdf} ()} |
---|
[261] | 84 | \label{classbdm_1_1mpdf_1892fe3933488942253679f068e9e7f6} |
---|
| 85 | |
---|
[270] | 86 | \item |
---|
[261] | 87 | \hypertarget{classbdm_1_1mpdf_05e843fd11c410a99dad2b88c55aca80}{ |
---|
[270] | 88 | \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \textbf{\_\-e} ()} |
---|
[261] | 89 | \label{classbdm_1_1mpdf_05e843fd11c410a99dad2b88c55aca80} |
---|
| 90 | |
---|
[270] | 91 | \end{CompactItemize} |
---|
| 92 | \end{Indent} |
---|
| 93 | \begin{Indent}{\bf Connection to other objects}\par |
---|
| 94 | \begin{CompactItemize} |
---|
| 95 | \item |
---|
| 96 | \hypertarget{classbdm_1_1mpdf_7631a5570e4ade1420065e8df78f4401}{ |
---|
| 97 | void \textbf{set\_\-rvc} (const \hyperlink{classbdm_1_1RV}{RV} \&rvc0)} |
---|
| 98 | \label{classbdm_1_1mpdf_7631a5570e4ade1420065e8df78f4401} |
---|
| 99 | |
---|
| 100 | \item |
---|
| 101 | \hypertarget{classbdm_1_1mpdf_18ac26bc2f96ae01ef4eb06178abbd75}{ |
---|
| 102 | void \textbf{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv0)} |
---|
| 103 | \label{classbdm_1_1mpdf_18ac26bc2f96ae01ef4eb06178abbd75} |
---|
| 104 | |
---|
| 105 | \item |
---|
| 106 | \hypertarget{classbdm_1_1mpdf_f8e3798150b42fd1f3e16ddbbe0e7045}{ |
---|
| 107 | bool \textbf{isnamed} ()} |
---|
| 108 | \label{classbdm_1_1mpdf_f8e3798150b42fd1f3e16ddbbe0e7045} |
---|
| 109 | |
---|
| 110 | \end{CompactItemize} |
---|
| 111 | \end{Indent} |
---|
[261] | 112 | \subsection*{Protected Attributes} |
---|
| 113 | \begin{CompactItemize} |
---|
| 114 | \item |
---|
| 115 | \hypertarget{classbdm_1_1mratio_f31caba90a2aa10fbf7631832404fe54}{ |
---|
| 116 | const \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1mratio_f31caba90a2aa10fbf7631832404fe54}{nom}} |
---|
| 117 | \label{classbdm_1_1mratio_f31caba90a2aa10fbf7631832404fe54} |
---|
| 118 | |
---|
| 119 | \begin{CompactList}\small\item\em Nominator in the form of \hyperlink{classbdm_1_1mpdf}{mpdf}. \item\end{CompactList}\item |
---|
| 120 | \hypertarget{classbdm_1_1mratio_7daa5d02d3a3be9d15fd4156d886ed88}{ |
---|
| 121 | \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1mratio_7daa5d02d3a3be9d15fd4156d886ed88}{den}} |
---|
| 122 | \label{classbdm_1_1mratio_7daa5d02d3a3be9d15fd4156d886ed88} |
---|
| 123 | |
---|
| 124 | \begin{CompactList}\small\item\em Denominator in the form of \hyperlink{classbdm_1_1epdf}{epdf}. \item\end{CompactList}\item |
---|
| 125 | \hypertarget{classbdm_1_1mratio_51bfe6675e724f7fbeaaeacce5a9f9b8}{ |
---|
| 126 | bool \hyperlink{classbdm_1_1mratio_51bfe6675e724f7fbeaaeacce5a9f9b8}{destroynom}} |
---|
| 127 | \label{classbdm_1_1mratio_51bfe6675e724f7fbeaaeacce5a9f9b8} |
---|
| 128 | |
---|
| 129 | \begin{CompactList}\small\item\em flag for destructor \item\end{CompactList}\item |
---|
| 130 | \hypertarget{classbdm_1_1mratio_cda5bd23ba60146d69e1f804ff7710c7}{ |
---|
| 131 | \hyperlink{classbdm_1_1datalink__m2e}{datalink\_\-m2e} \hyperlink{classbdm_1_1mratio_cda5bd23ba60146d69e1f804ff7710c7}{dl}} |
---|
| 132 | \label{classbdm_1_1mratio_cda5bd23ba60146d69e1f804ff7710c7} |
---|
| 133 | |
---|
[270] | 134 | \begin{CompactList}\small\item\em \hyperlink{classbdm_1_1datalink}{datalink} between conditional and nom \item\end{CompactList}\item |
---|
| 135 | \hypertarget{classbdm_1_1mpdf_7c1900976ff13dbc09c9729b3bbff9e6}{ |
---|
| 136 | int \hyperlink{classbdm_1_1mpdf_7c1900976ff13dbc09c9729b3bbff9e6}{dimc}} |
---|
| 137 | \label{classbdm_1_1mpdf_7c1900976ff13dbc09c9729b3bbff9e6} |
---|
[261] | 138 | |
---|
[270] | 139 | \begin{CompactList}\small\item\em dimension of the condition \item\end{CompactList}\item |
---|
[261] | 140 | \hypertarget{classbdm_1_1mpdf_5a5f08950daa08b85b01ddf4e1c36288}{ |
---|
| 141 | \hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1mpdf_5a5f08950daa08b85b01ddf4e1c36288}{rvc}} |
---|
| 142 | \label{classbdm_1_1mpdf_5a5f08950daa08b85b01ddf4e1c36288} |
---|
| 143 | |
---|
| 144 | \begin{CompactList}\small\item\em random variable in condition \item\end{CompactList}\item |
---|
| 145 | \hypertarget{classbdm_1_1mpdf_5eea43c56d38e4441bfb30270db949c0}{ |
---|
| 146 | \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1mpdf_5eea43c56d38e4441bfb30270db949c0}{ep}} |
---|
| 147 | \label{classbdm_1_1mpdf_5eea43c56d38e4441bfb30270db949c0} |
---|
| 148 | |
---|
| 149 | \begin{CompactList}\small\item\em pointer to internal \hyperlink{classbdm_1_1epdf}{epdf} \item\end{CompactList}\end{CompactItemize} |
---|
| 150 | |
---|
| 151 | |
---|
| 152 | \subsection{Constructor \& Destructor Documentation} |
---|
| 153 | \hypertarget{classbdm_1_1mratio_0ff56d13f9515d7e5f23b7a4cc5529b4}{ |
---|
| 154 | \index{bdm::mratio@{bdm::mratio}!mratio@{mratio}} |
---|
| 155 | \index{mratio@{mratio}!bdm::mratio@{bdm::mratio}} |
---|
| 156 | \subsubsection[mratio]{\setlength{\rightskip}{0pt plus 5cm}bdm::mratio::mratio (const {\bf epdf} $\ast$ {\em nom0}, \/ const {\bf RV} \& {\em rv}, \/ bool {\em copy} = {\tt false})\hspace{0.3cm}{\tt \mbox{[}inline\mbox{]}}}} |
---|
| 157 | \label{classbdm_1_1mratio_0ff56d13f9515d7e5f23b7a4cc5529b4} |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | Default constructor. By default, the given \hyperlink{classbdm_1_1epdf}{epdf} is not copied! It is assumed that this function will be used only temporarily. |
---|
| 161 | |
---|
[270] | 162 | References bdm::epdf::\_\-rv(), den, destroynom, bdm::mpdf::ep, bdm::RV::length(), bdm::epdf::marginal(), nom, bdm::mpdf::rvc, bdm::epdf::set\_\-rv(), and bdm::RV::subt(). |
---|
[261] | 163 | |
---|
| 164 | \subsection{Member Function Documentation} |
---|
[269] | 165 | \hypertarget{classbdm_1_1mpdf_f0c1db6fcbb3aae2dd6123884457a367}{ |
---|
[261] | 166 | \index{bdm::mratio@{bdm::mratio}!samplecond@{samplecond}} |
---|
| 167 | \index{samplecond@{samplecond}!bdm::mratio@{bdm::mratio}} |
---|
[269] | 168 | \subsubsection[samplecond]{\setlength{\rightskip}{0pt plus 5cm}virtual vec bdm::mpdf::samplecond (const vec \& {\em cond})\hspace{0.3cm}{\tt \mbox{[}inline, virtual, inherited\mbox{]}}}} |
---|
| 169 | \label{classbdm_1_1mpdf_f0c1db6fcbb3aae2dd6123884457a367} |
---|
[261] | 170 | |
---|
| 171 | |
---|
| 172 | Returns a sample from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. |
---|
| 173 | |
---|
| 174 | \begin{Desc} |
---|
| 175 | \item[Parameters:] |
---|
| 176 | \begin{description} |
---|
[269] | 177 | \item[{\em cond}]is numeric value of {\tt rv} \end{description} |
---|
[261] | 178 | \end{Desc} |
---|
| 179 | |
---|
| 180 | |
---|
[269] | 181 | References bdm::mpdf::condition(), bdm::mpdf::ep, and bdm::epdf::sample(). |
---|
[261] | 182 | |
---|
[270] | 183 | Referenced by bdm::MPF$<$ BM\_\-T $>$::bayes(), bdm::PF::bayes(), and bdm::ArxDS::step().\hypertarget{classbdm_1_1mpdf_afe4185b26baeb03688202e254d3b005}{ |
---|
[261] | 184 | \index{bdm::mratio@{bdm::mratio}!samplecond\_\-m@{samplecond\_\-m}} |
---|
| 185 | \index{samplecond\_\-m@{samplecond\_\-m}!bdm::mratio@{bdm::mratio}} |
---|
[270] | 186 | \subsubsection[samplecond\_\-m]{\setlength{\rightskip}{0pt plus 5cm}virtual mat bdm::mpdf::samplecond\_\-m (const vec \& {\em cond}, \/ int {\em N})\hspace{0.3cm}{\tt \mbox{[}inline, virtual, inherited\mbox{]}}}} |
---|
| 187 | \label{classbdm_1_1mpdf_afe4185b26baeb03688202e254d3b005} |
---|
[261] | 188 | |
---|
| 189 | |
---|
| 190 | Returns. |
---|
| 191 | |
---|
| 192 | \begin{Desc} |
---|
| 193 | \item[Parameters:] |
---|
| 194 | \begin{description} |
---|
| 195 | \item[{\em N}]samples from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. \item[{\em cond}]is numeric value of {\tt rv} \item[{\em ll}]is a return value of log-likelihood of the sample. \end{description} |
---|
| 196 | \end{Desc} |
---|
| 197 | |
---|
| 198 | |
---|
[270] | 199 | References bdm::mpdf::condition(), bdm::epdf::dimension(), bdm::mpdf::ep, and bdm::epdf::sample(). |
---|
[261] | 200 | |
---|
| 201 | The documentation for this class was generated from the following file:\begin{CompactItemize} |
---|
| 202 | \item |
---|
| 203 | \hyperlink{emix_8h}{emix.h}\end{CompactItemize} |
---|