[210] | 1 | \hypertarget{classmratio}{ |
---|
| 2 | \section{mratio Class Reference} |
---|
| 3 | \label{classmratio}\index{mratio@{mratio}} |
---|
| 4 | } |
---|
| 5 | 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 $. |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | {\tt \#include $<$emix.h$>$} |
---|
| 9 | |
---|
| 10 | Inheritance diagram for mratio:\nopagebreak |
---|
| 11 | \begin{figure}[H] |
---|
| 12 | \begin{center} |
---|
| 13 | \leavevmode |
---|
| 14 | \includegraphics[width=46pt]{classmratio__inherit__graph} |
---|
| 15 | \end{center} |
---|
| 16 | \end{figure} |
---|
| 17 | Collaboration diagram for mratio:\nopagebreak |
---|
| 18 | \begin{figure}[H] |
---|
| 19 | \begin{center} |
---|
| 20 | \leavevmode |
---|
| 21 | \includegraphics[width=120pt]{classmratio__coll__graph} |
---|
| 22 | \end{center} |
---|
| 23 | \end{figure} |
---|
| 24 | \subsection*{Public Member Functions} |
---|
| 25 | \begin{CompactItemize} |
---|
| 26 | \item |
---|
| 27 | \hyperlink{classmratio_c2452f4fc3046cfe8f2453deb343b3ac}{mratio} (const \hyperlink{classepdf}{epdf} $\ast$nom0, const \hyperlink{classRV}{RV} \&\hyperlink{classmpdf_f6687c07ff07d47812dd565368ca59eb}{rv}, bool copy=false) |
---|
| 28 | \item |
---|
[219] | 29 | \hypertarget{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}{ |
---|
| 30 | double \hyperlink{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}{evallogcond} (const vec \&val, const vec \&cond)} |
---|
| 31 | \label{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09} |
---|
[210] | 32 | |
---|
| 33 | \begin{CompactList}\small\item\em Shortcut for conditioning and evaluation of the internal \hyperlink{classepdf}{epdf}. In some cases, this operation can be implemented efficiently. \item\end{CompactList}\item |
---|
| 34 | \hypertarget{classmratio_41d6d8f4245f67c732299ba7167aacb9}{ |
---|
| 35 | void \hyperlink{classmratio_41d6d8f4245f67c732299ba7167aacb9}{ownnom} ()} |
---|
| 36 | \label{classmratio_41d6d8f4245f67c732299ba7167aacb9} |
---|
| 37 | |
---|
| 38 | \begin{CompactList}\small\item\em Object takes ownership of nom and will destroy it. \item\end{CompactList}\item |
---|
| 39 | \hypertarget{classmratio_e62904f18041e73228d8db671e517280}{ |
---|
| 40 | \hyperlink{classmratio_e62904f18041e73228d8db671e517280}{$\sim$mratio} ()} |
---|
| 41 | \label{classmratio_e62904f18041e73228d8db671e517280} |
---|
| 42 | |
---|
| 43 | \begin{CompactList}\small\item\em Default destructor. \item\end{CompactList}\item |
---|
| 44 | virtual vec \hyperlink{classmpdf_3f172b79ec4a5ebc87898a5381141f1b}{samplecond} (const vec \&cond, double \&ll) |
---|
| 45 | \begin{CompactList}\small\item\em Returns the required moment of the \hyperlink{classepdf}{epdf}. \item\end{CompactList}\item |
---|
[219] | 46 | virtual mat \hyperlink{classmpdf_b1dae6171ee39a6a05976c7b1007a3c5}{samplecond\_\-m} (const vec \&cond, vec \&ll, int N) |
---|
[210] | 47 | \begin{CompactList}\small\item\em Returns. \item\end{CompactList}\item |
---|
| 48 | \hypertarget{classmpdf_0f95a0cc6ab40611f46804682446ed83}{ |
---|
| 49 | virtual void \hyperlink{classmpdf_0f95a0cc6ab40611f46804682446ed83}{condition} (const vec \&cond)} |
---|
| 50 | \label{classmpdf_0f95a0cc6ab40611f46804682446ed83} |
---|
| 51 | |
---|
| 52 | \begin{CompactList}\small\item\em Update {\tt ep} so that it represents this \hyperlink{classmpdf}{mpdf} conditioned on {\tt rvc} = cond. \item\end{CompactList}\item |
---|
[219] | 53 | \hypertarget{classmpdf_95fcff214848f66f1b489459370573fa}{ |
---|
| 54 | virtual vec \hyperlink{classmpdf_95fcff214848f66f1b489459370573fa}{evallogcond\_\-m} (const mat \&Dt, const vec \&cond)} |
---|
| 55 | \label{classmpdf_95fcff214848f66f1b489459370573fa} |
---|
[210] | 56 | |
---|
[219] | 57 | \begin{CompactList}\small\item\em Matrix version of evallogcond. \item\end{CompactList}\item |
---|
[210] | 58 | \hypertarget{classmpdf_15ef062183b1ccdf794732d5fa0b77cd}{ |
---|
| 59 | \hyperlink{classRV}{RV} \hyperlink{classmpdf_15ef062183b1ccdf794732d5fa0b77cd}{\_\-rvc} () const } |
---|
| 60 | \label{classmpdf_15ef062183b1ccdf794732d5fa0b77cd} |
---|
| 61 | |
---|
| 62 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
| 63 | \hypertarget{classmpdf_71256ffb5fbd08f41d650e606a5bd585}{ |
---|
| 64 | \hyperlink{classRV}{RV} \hyperlink{classmpdf_71256ffb5fbd08f41d650e606a5bd585}{\_\-rv} () const } |
---|
| 65 | \label{classmpdf_71256ffb5fbd08f41d650e606a5bd585} |
---|
| 66 | |
---|
| 67 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
| 68 | \hypertarget{classmpdf_e17780ee5b2cfe05922a6c56af1462f8}{ |
---|
| 69 | \hyperlink{classepdf}{epdf} \& \hyperlink{classmpdf_e17780ee5b2cfe05922a6c56af1462f8}{\_\-epdf} ()} |
---|
| 70 | \label{classmpdf_e17780ee5b2cfe05922a6c56af1462f8} |
---|
| 71 | |
---|
| 72 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize} |
---|
| 73 | \subsection*{Protected Attributes} |
---|
| 74 | \begin{CompactItemize} |
---|
| 75 | \item |
---|
| 76 | \hypertarget{classmratio_8a3e60f5a532237e4450cd06039a28db}{ |
---|
| 77 | const \hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmratio_8a3e60f5a532237e4450cd06039a28db}{nom}} |
---|
| 78 | \label{classmratio_8a3e60f5a532237e4450cd06039a28db} |
---|
| 79 | |
---|
| 80 | \begin{CompactList}\small\item\em Nominator in the form of \hyperlink{classmpdf}{mpdf}. \item\end{CompactList}\item |
---|
| 81 | \hypertarget{classmratio_d34916f6403460fbcac71902f32aa791}{ |
---|
| 82 | \hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmratio_d34916f6403460fbcac71902f32aa791}{den}} |
---|
| 83 | \label{classmratio_d34916f6403460fbcac71902f32aa791} |
---|
| 84 | |
---|
| 85 | \begin{CompactList}\small\item\em Denominator in the form of \hyperlink{classepdf}{epdf}. \item\end{CompactList}\item |
---|
| 86 | \hypertarget{classmratio_f8ea9dd72239dc24b1d83ae034424285}{ |
---|
| 87 | bool \hyperlink{classmratio_f8ea9dd72239dc24b1d83ae034424285}{destroynom}} |
---|
| 88 | \label{classmratio_f8ea9dd72239dc24b1d83ae034424285} |
---|
| 89 | |
---|
| 90 | \begin{CompactList}\small\item\em flag for destructor \item\end{CompactList}\item |
---|
| 91 | \hypertarget{classmratio_aa50f2cca2b959391f449241ef89012d}{ |
---|
| 92 | \hyperlink{classdatalink__m2e}{datalink\_\-m2e} \hyperlink{classmratio_aa50f2cca2b959391f449241ef89012d}{dl}} |
---|
| 93 | \label{classmratio_aa50f2cca2b959391f449241ef89012d} |
---|
| 94 | |
---|
| 95 | \begin{CompactList}\small\item\em datalink between conditional and nom \item\end{CompactList}\item |
---|
| 96 | \hypertarget{classmpdf_f6687c07ff07d47812dd565368ca59eb}{ |
---|
| 97 | \hyperlink{classRV}{RV} \hyperlink{classmpdf_f6687c07ff07d47812dd565368ca59eb}{rv}} |
---|
| 98 | \label{classmpdf_f6687c07ff07d47812dd565368ca59eb} |
---|
| 99 | |
---|
| 100 | \begin{CompactList}\small\item\em modeled random variable \item\end{CompactList}\item |
---|
| 101 | \hypertarget{classmpdf_acb7dda792b3cd5576f39fa3129abbab}{ |
---|
| 102 | \hyperlink{classRV}{RV} \hyperlink{classmpdf_acb7dda792b3cd5576f39fa3129abbab}{rvc}} |
---|
| 103 | \label{classmpdf_acb7dda792b3cd5576f39fa3129abbab} |
---|
| 104 | |
---|
| 105 | \begin{CompactList}\small\item\em random variable in condition \item\end{CompactList}\item |
---|
| 106 | \hypertarget{classmpdf_7aa894208a32f3487827df6d5054424c}{ |
---|
| 107 | \hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmpdf_7aa894208a32f3487827df6d5054424c}{ep}} |
---|
| 108 | \label{classmpdf_7aa894208a32f3487827df6d5054424c} |
---|
| 109 | |
---|
| 110 | \begin{CompactList}\small\item\em pointer to internal \hyperlink{classepdf}{epdf} \item\end{CompactList}\end{CompactItemize} |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | \subsection{Detailed Description} |
---|
| 114 | 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 $. |
---|
| 115 | |
---|
| 116 | In particular this type of arise by conditioning of a mixture model. |
---|
| 117 | |
---|
[219] | 118 | At present the only supported operation is \hyperlink{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}{evallogcond()}. |
---|
[210] | 119 | |
---|
| 120 | \subsection{Constructor \& Destructor Documentation} |
---|
| 121 | \hypertarget{classmratio_c2452f4fc3046cfe8f2453deb343b3ac}{ |
---|
| 122 | \index{mratio@{mratio}!mratio@{mratio}} |
---|
| 123 | \index{mratio@{mratio}!mratio@{mratio}} |
---|
| 124 | \subsubsection[mratio]{\setlength{\rightskip}{0pt plus 5cm}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{]}}}} |
---|
| 125 | \label{classmratio_c2452f4fc3046cfe8f2453deb343b3ac} |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | Default constructor. By default, the given \hyperlink{classepdf}{epdf} is not copied! It is assumed that this function will be used only temporarily. |
---|
| 129 | |
---|
| 130 | References den, destroynom, RV::length(), epdf::marginal(), nom, and mpdf::rvc. |
---|
| 131 | |
---|
| 132 | \subsection{Member Function Documentation} |
---|
| 133 | \hypertarget{classmpdf_3f172b79ec4a5ebc87898a5381141f1b}{ |
---|
| 134 | \index{mratio@{mratio}!samplecond@{samplecond}} |
---|
| 135 | \index{samplecond@{samplecond}!mratio@{mratio}} |
---|
| 136 | \subsubsection[samplecond]{\setlength{\rightskip}{0pt plus 5cm}virtual vec mpdf::samplecond (const vec \& {\em cond}, \/ double \& {\em ll})\hspace{0.3cm}{\tt \mbox{[}inline, virtual, inherited\mbox{]}}}} |
---|
| 137 | \label{classmpdf_3f172b79ec4a5ebc87898a5381141f1b} |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | Returns the required moment of the \hyperlink{classepdf}{epdf}. |
---|
| 141 | |
---|
| 142 | Returns a sample from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. \begin{Desc} |
---|
| 143 | \item[Parameters:] |
---|
| 144 | \begin{description} |
---|
| 145 | \item[{\em cond}]is numeric value of {\tt rv} \item[{\em ll}]is a return value of log-likelihood of the sample. \end{description} |
---|
| 146 | \end{Desc} |
---|
| 147 | |
---|
| 148 | |
---|
| 149 | Reimplemented in \hyperlink{classmprod_a48887eb8738a9e5550bfc38eb8e9d68}{mprod}. |
---|
| 150 | |
---|
[219] | 151 | References mpdf::condition(), mpdf::ep, epdf::evallog(), and epdf::sample(). |
---|
[210] | 152 | |
---|
[219] | 153 | Referenced by MPF$<$ BM\_\-T $>$::bayes(), and PF::bayes().\hypertarget{classmpdf_b1dae6171ee39a6a05976c7b1007a3c5}{ |
---|
| 154 | \index{mratio@{mratio}!samplecond\_\-m@{samplecond\_\-m}} |
---|
| 155 | \index{samplecond\_\-m@{samplecond\_\-m}!mratio@{mratio}} |
---|
| 156 | \subsubsection[samplecond\_\-m]{\setlength{\rightskip}{0pt plus 5cm}virtual mat mpdf::samplecond\_\-m (const vec \& {\em cond}, \/ vec \& {\em ll}, \/ int {\em N})\hspace{0.3cm}{\tt \mbox{[}inline, virtual, inherited\mbox{]}}}} |
---|
| 157 | \label{classmpdf_b1dae6171ee39a6a05976c7b1007a3c5} |
---|
[210] | 158 | |
---|
| 159 | |
---|
| 160 | Returns. |
---|
| 161 | |
---|
| 162 | \begin{Desc} |
---|
| 163 | \item[Parameters:] |
---|
| 164 | \begin{description} |
---|
| 165 | \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} |
---|
| 166 | \end{Desc} |
---|
| 167 | |
---|
| 168 | |
---|
[219] | 169 | References mpdf::condition(), RV::count(), mpdf::ep, epdf::evallog(), mpdf::rv, and epdf::sample(). |
---|
[210] | 170 | |
---|
| 171 | The documentation for this class was generated from the following file:\begin{CompactItemize} |
---|
| 172 | \item |
---|
| 173 | work/git/mixpp/bdm/stat/\hyperlink{emix_8h}{emix.h}\end{CompactItemize} |
---|