root/doc/html/classmratio.html @ 224

Revision 224, 20.1 kB (checked in by smidl, 16 years ago)

doc

Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3<title>mixpp: mratio Class Reference</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.6 -->
8<div class="navigation" id="top">
9  <div class="tabs">
10    <ul>
11      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
13      <li><a href="modules.html"><span>Modules</span></a></li>
14      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
15      <li><a href="files.html"><span>Files</span></a></li>
16    </ul>
17  </div>
18  <div class="tabs">
19    <ul>
20      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
21      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
22      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
23    </ul>
24  </div>
25</div>
26<div class="contents">
27<h1>mratio Class Reference</h1><!-- doxytag: class="mratio" --><!-- doxytag: inherits="mpdf" -->Class representing ratio of two densities which arise e.g. by applying the Bayes rule. It represents density in the form: <p class="formulaDsp">
28<img class="formulaDsp" alt="\[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \]" src="form_79.png">
29<p>
30 where <img class="formulaInl" alt="$ f(rvc) = \int f(rv,rvc) d\ rv $" src="form_80.png">
31<a href="#_details">More...</a>
32<p>
33<code>#include &lt;<a class="el" href="emix_8h-source.html">emix.h</a>&gt;</code>
34<p>
35<div class="dynheader">
36Inheritance diagram for mratio:</div>
37<div class="dynsection">
38<p><center><img src="classmratio__inherit__graph.png" border="0" usemap="#mratio__inherit__map" alt="Inheritance graph"></center>
39<map name="mratio__inherit__map">
40<area shape="rect" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies." alt="" coords="11,7,64,33"></map>
41<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
42<div class="dynheader">
43Collaboration diagram for mratio:</div>
44<div class="dynsection">
45<p><center><img src="classmratio__coll__graph.png" border="0" usemap="#mratio__coll__map" alt="Collaboration graph"></center>
46<map name="mratio__coll__map">
47<area shape="rect" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies." alt="" coords="5,207,59,233"><area shape="rect" href="classRV.html" title="Class representing variables, most often random variables." alt="" coords="35,7,72,33"><area shape="rect" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density." alt="" coords="69,105,117,132"><area shape="rect" href="classdatalink__m2e.html" title="data link between" alt="" coords="160,207,267,233"><area shape="rect" href="classdatalink__e2e.html" title="datalink_e2e" alt="" coords="163,105,264,132"></map>
48<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
49
50<p>
51<a href="classmratio-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
52<tr><td></td></tr>
53<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
54<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#c2452f4fc3046cfe8f2453deb343b3ac">mratio</a> (const <a class="el" href="classepdf.html">epdf</a> *nom0, const <a class="el" href="classRV.html">RV</a> &amp;<a class="el" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb">rv</a>, bool copy=false)</td></tr>
55
56<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9fb0df09a2e975e8b9f7ce41ecd65a09"></a><!-- doxytag: member="mratio::evallogcond" ref="9fb0df09a2e975e8b9f7ce41ecd65a09" args="(const vec &amp;val, const vec &amp;cond)" -->
57double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#9fb0df09a2e975e8b9f7ce41ecd65a09">evallogcond</a> (const vec &amp;val, const vec &amp;cond)</td></tr>
58
59<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shortcut for conditioning and evaluation of the internal <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>. In some cases, this operation can be implemented efficiently. <br></td></tr>
60<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="41d6d8f4245f67c732299ba7167aacb9"></a><!-- doxytag: member="mratio::ownnom" ref="41d6d8f4245f67c732299ba7167aacb9" args="()" -->
61void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#41d6d8f4245f67c732299ba7167aacb9">ownnom</a> ()</td></tr>
62
63<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Object takes ownership of nom and will destroy it. <br></td></tr>
64<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e62904f18041e73228d8db671e517280"></a><!-- doxytag: member="mratio::~mratio" ref="e62904f18041e73228d8db671e517280" args="()" -->
65&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#e62904f18041e73228d8db671e517280">~mratio</a> ()</td></tr>
66
67<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default destructor. <br></td></tr>
68<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#3f172b79ec4a5ebc87898a5381141f1b">samplecond</a> (const vec &amp;cond, double &amp;ll)</td></tr>
69
70<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the required moment of the <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a><a href="#3f172b79ec4a5ebc87898a5381141f1b"></a><br></td></tr>
71<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual mat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#b1dae6171ee39a6a05976c7b1007a3c5">samplecond_m</a> (const vec &amp;cond, vec &amp;ll, int N)</td></tr>
72
73<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns.  <a href="#b1dae6171ee39a6a05976c7b1007a3c5"></a><br></td></tr>
74<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0f95a0cc6ab40611f46804682446ed83"></a><!-- doxytag: member="mratio::condition" ref="0f95a0cc6ab40611f46804682446ed83" args="(const vec &amp;cond)" -->
75virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83">condition</a> (const vec &amp;cond)</td></tr>
76
77<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Update <code>ep</code> so that it represents this <a class="el" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> conditioned on <code>rvc</code> = cond. <br></td></tr>
78<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="95fcff214848f66f1b489459370573fa"></a><!-- doxytag: member="mratio::evallogcond_m" ref="95fcff214848f66f1b489459370573fa" args="(const mat &amp;Dt, const vec &amp;cond)" -->
79virtual vec&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#95fcff214848f66f1b489459370573fa">evallogcond_m</a> (const mat &amp;Dt, const vec &amp;cond)</td></tr>
80
81<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Matrix version of evallogcond. <br></td></tr>
82<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="15ef062183b1ccdf794732d5fa0b77cd"></a><!-- doxytag: member="mratio::_rvc" ref="15ef062183b1ccdf794732d5fa0b77cd" args="() const " -->
83<a class="el" href="classRV.html">RV</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#15ef062183b1ccdf794732d5fa0b77cd">_rvc</a> () const </td></tr>
84
85<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">access function <br></td></tr>
86<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="71256ffb5fbd08f41d650e606a5bd585"></a><!-- doxytag: member="mratio::_rv" ref="71256ffb5fbd08f41d650e606a5bd585" args="() const " -->
87<a class="el" href="classRV.html">RV</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#71256ffb5fbd08f41d650e606a5bd585">_rv</a> () const </td></tr>
88
89<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">access function <br></td></tr>
90<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e17780ee5b2cfe05922a6c56af1462f8"></a><!-- doxytag: member="mratio::_epdf" ref="e17780ee5b2cfe05922a6c56af1462f8" args="()" -->
91<a class="el" href="classepdf.html">epdf</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#e17780ee5b2cfe05922a6c56af1462f8">_epdf</a> ()</td></tr>
92
93<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">access function <br></td></tr>
94<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
95<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8a3e60f5a532237e4450cd06039a28db"></a><!-- doxytag: member="mratio::nom" ref="8a3e60f5a532237e4450cd06039a28db" args="" -->
96const <a class="el" href="classepdf.html">epdf</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#8a3e60f5a532237e4450cd06039a28db">nom</a></td></tr>
97
98<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Nominator in the form of <a class="el" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>. <br></td></tr>
99<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d34916f6403460fbcac71902f32aa791"></a><!-- doxytag: member="mratio::den" ref="d34916f6403460fbcac71902f32aa791" args="" -->
100<a class="el" href="classepdf.html">epdf</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#d34916f6403460fbcac71902f32aa791">den</a></td></tr>
101
102<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Denominator in the form of <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>. <br></td></tr>
103<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f8ea9dd72239dc24b1d83ae034424285"></a><!-- doxytag: member="mratio::destroynom" ref="f8ea9dd72239dc24b1d83ae034424285" args="" -->
104bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#f8ea9dd72239dc24b1d83ae034424285">destroynom</a></td></tr>
105
106<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">flag for destructor <br></td></tr>
107<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="aa50f2cca2b959391f449241ef89012d"></a><!-- doxytag: member="mratio::dl" ref="aa50f2cca2b959391f449241ef89012d" args="" -->
108<a class="el" href="classdatalink__m2e.html">datalink_m2e</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#aa50f2cca2b959391f449241ef89012d">dl</a></td></tr>
109
110<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">datalink between conditional and nom <br></td></tr>
111<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f6687c07ff07d47812dd565368ca59eb"></a><!-- doxytag: member="mratio::rv" ref="f6687c07ff07d47812dd565368ca59eb" args="" -->
112<a class="el" href="classRV.html">RV</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb">rv</a></td></tr>
113
114<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">modeled random variable <br></td></tr>
115<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="acb7dda792b3cd5576f39fa3129abbab"></a><!-- doxytag: member="mratio::rvc" ref="acb7dda792b3cd5576f39fa3129abbab" args="" -->
116<a class="el" href="classRV.html">RV</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab">rvc</a></td></tr>
117
118<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">random variable in condition <br></td></tr>
119<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7aa894208a32f3487827df6d5054424c"></a><!-- doxytag: member="mratio::ep" ref="7aa894208a32f3487827df6d5054424c" args="" -->
120<a class="el" href="classepdf.html">epdf</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#7aa894208a32f3487827df6d5054424c">ep</a></td></tr>
121
122<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">pointer to internal <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> <br></td></tr>
123</table>
124<hr><a name="_details"></a><h2>Detailed Description</h2>
125Class representing ratio of two densities which arise e.g. by applying the Bayes rule. It represents density in the form: <p class="formulaDsp">
126<img class="formulaDsp" alt="\[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \]" src="form_79.png">
127<p>
128 where <img class="formulaInl" alt="$ f(rvc) = \int f(rv,rvc) d\ rv $" src="form_80.png">.
129<p>
130In particular this type of arise by conditioning of a mixture model.<p>
131At present the only supported operation is <a class="el" href="classmratio.html#9fb0df09a2e975e8b9f7ce41ecd65a09" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond()</a>. <hr><h2>Constructor &amp; Destructor Documentation</h2>
132<a class="anchor" name="c2452f4fc3046cfe8f2453deb343b3ac"></a><!-- doxytag: member="mratio::mratio" ref="c2452f4fc3046cfe8f2453deb343b3ac" args="(const epdf *nom0, const RV &amp;rv, bool copy=false)" -->
133<div class="memitem">
134<div class="memproto">
135      <table class="memname">
136        <tr>
137          <td class="memname">mratio::mratio           </td>
138          <td>(</td>
139          <td class="paramtype">const <a class="el" href="classepdf.html">epdf</a> *&nbsp;</td>
140          <td class="paramname"> <em>nom0</em>, </td>
141        </tr>
142        <tr>
143          <td class="paramkey"></td>
144          <td></td>
145          <td class="paramtype">const <a class="el" href="classRV.html">RV</a> &amp;&nbsp;</td>
146          <td class="paramname"> <em>rv</em>, </td>
147        </tr>
148        <tr>
149          <td class="paramkey"></td>
150          <td></td>
151          <td class="paramtype">bool&nbsp;</td>
152          <td class="paramname"> <em>copy</em> = <code>false</code></td><td>&nbsp;</td>
153        </tr>
154        <tr>
155          <td></td>
156          <td>)</td>
157          <td></td><td></td><td><code> [inline]</code></td>
158        </tr>
159      </table>
160</div>
161<div class="memdoc">
162
163<p>
164Default constructor. By default, the given <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> is not copied! It is assumed that this function will be used only temporarily.
165<p>References <a class="el" href="emix_8h-source.html#l00041">den</a>, <a class="el" href="emix_8h-source.html#l00043">destroynom</a>, <a class="el" href="libBM_8h-source.html#l00079">RV::length()</a>, <a class="el" href="libBM_8h-source.html#l00194">epdf::marginal()</a>, <a class="el" href="emix_8h-source.html#l00039">nom</a>, and <a class="el" href="libBM_8h-source.html#l00217">mpdf::rvc</a>.</p>
166
167</div>
168</div><p>
169<hr><h2>Member Function Documentation</h2>
170<a class="anchor" name="3f172b79ec4a5ebc87898a5381141f1b"></a><!-- doxytag: member="mratio::samplecond" ref="3f172b79ec4a5ebc87898a5381141f1b" args="(const vec &amp;cond, double &amp;ll)" -->
171<div class="memitem">
172<div class="memproto">
173      <table class="memname">
174        <tr>
175          <td class="memname">virtual vec mpdf::samplecond           </td>
176          <td>(</td>
177          <td class="paramtype">const vec &amp;&nbsp;</td>
178          <td class="paramname"> <em>cond</em>, </td>
179        </tr>
180        <tr>
181          <td class="paramkey"></td>
182          <td></td>
183          <td class="paramtype">double &amp;&nbsp;</td>
184          <td class="paramname"> <em>ll</em></td><td>&nbsp;</td>
185        </tr>
186        <tr>
187          <td></td>
188          <td>)</td>
189          <td></td><td></td><td><code> [inline, virtual, inherited]</code></td>
190        </tr>
191      </table>
192</div>
193<div class="memdoc">
194
195<p>
196Returns the required moment of the <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.
197<p>
198Returns a sample from the density conditioned on <code>cond</code>, <img class="formulaInl" alt="$x \sim epdf(rv|cond)$" src="form_10.png">. <dl compact><dt><b>Parameters:</b></dt><dd>
199  <table border="0" cellspacing="2" cellpadding="0">
200    <tr><td valign="top"></td><td valign="top"><em>cond</em>&nbsp;</td><td>is numeric value of <code>rv</code> </td></tr>
201    <tr><td valign="top"></td><td valign="top"><em>ll</em>&nbsp;</td><td>is a return value of log-likelihood of the sample. </td></tr>
202  </table>
203</dl>
204
205<p>Reimplemented in <a class="el" href="classmprod.html#a48887eb8738a9e5550bfc38eb8e9d68">mprod</a>.</p>
206
207<p>References <a class="el" href="libBM_8h-source.html#l00238">mpdf::condition()</a>, <a class="el" href="libBM_8h-source.html#l00219">mpdf::ep</a>, <a class="el" href="classepdf.html#e1996af1da1fa1214270066a96ca113e">epdf::evallog()</a>, and <a class="el" href="classepdf.html#8019654e494bf5e458f6fb947e11b262">epdf::sample()</a>.</p>
208
209<p>Referenced by <a class="el" href="libPF_8h-source.html#l00138">MPF&lt; BM_T &gt;::bayes()</a>, and <a class="el" href="libPF_8cpp-source.html#l00007">PF::bayes()</a>.</p>
210
211</div>
212</div><p>
213<a class="anchor" name="b1dae6171ee39a6a05976c7b1007a3c5"></a><!-- doxytag: member="mratio::samplecond_m" ref="b1dae6171ee39a6a05976c7b1007a3c5" args="(const vec &amp;cond, vec &amp;ll, int N)" -->
214<div class="memitem">
215<div class="memproto">
216      <table class="memname">
217        <tr>
218          <td class="memname">virtual mat mpdf::samplecond_m           </td>
219          <td>(</td>
220          <td class="paramtype">const vec &amp;&nbsp;</td>
221          <td class="paramname"> <em>cond</em>, </td>
222        </tr>
223        <tr>
224          <td class="paramkey"></td>
225          <td></td>
226          <td class="paramtype">vec &amp;&nbsp;</td>
227          <td class="paramname"> <em>ll</em>, </td>
228        </tr>
229        <tr>
230          <td class="paramkey"></td>
231          <td></td>
232          <td class="paramtype">int&nbsp;</td>
233          <td class="paramname"> <em>N</em></td><td>&nbsp;</td>
234        </tr>
235        <tr>
236          <td></td>
237          <td>)</td>
238          <td></td><td></td><td><code> [inline, virtual, inherited]</code></td>
239        </tr>
240      </table>
241</div>
242<div class="memdoc">
243
244<p>
245Returns.
246<p>
247<dl compact><dt><b>Parameters:</b></dt><dd>
248  <table border="0" cellspacing="2" cellpadding="0">
249    <tr><td valign="top"></td><td valign="top"><em>N</em>&nbsp;</td><td>samples from the density conditioned on <code>cond</code>, <img class="formulaInl" alt="$x \sim epdf(rv|cond)$" src="form_10.png">. </td></tr>
250    <tr><td valign="top"></td><td valign="top"><em>cond</em>&nbsp;</td><td>is numeric value of <code>rv</code> </td></tr>
251    <tr><td valign="top"></td><td valign="top"><em>ll</em>&nbsp;</td><td>is a return value of log-likelihood of the sample. </td></tr>
252  </table>
253</dl>
254
255<p>References <a class="el" href="libBM_8h-source.html#l00238">mpdf::condition()</a>, <a class="el" href="libBM_8h-source.html#l00077">RV::count()</a>, <a class="el" href="libBM_8h-source.html#l00219">mpdf::ep</a>, <a class="el" href="classepdf.html#e1996af1da1fa1214270066a96ca113e">epdf::evallog()</a>, <a class="el" href="libBM_8h-source.html#l00215">mpdf::rv</a>, and <a class="el" href="classepdf.html#8019654e494bf5e458f6fb947e11b262">epdf::sample()</a>.</p>
256
257</div>
258</div><p>
259<hr>The documentation for this class was generated from the following file:<ul>
260<li>work/git/mixpp/bdm/stat/<a class="el" href="emix_8h-source.html">emix.h</a></ul>
261</div>
262<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jan 5 19:29:18 2009 for mixpp by&nbsp;
263<a href="http://www.doxygen.org/index.html">
264<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
265</body>
266</html>
Note: See TracBrowser for help on using the browser.