root/doc/html/classmratio.html @ 210

Revision 210, 20.0 kB (checked in by smidl, 16 years ago)

dokumentace

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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
14      <li><a href="files.html"><span>Files</span></a></li>
15    </ul>
16  </div>
17  <div class="tabs">
18    <ul>
19      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
20      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
21      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
22    </ul>
23  </div>
24</div>
25<div class="contents">
26<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">
27<img class="formulaDsp" alt="\[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \]" src="form_79.png">
28<p>
29 where <img class="formulaInl" alt="$ f(rvc) = \int f(rv,rvc) d\ rv $" src="form_80.png">
30<a href="#_details">More...</a>
31<p>
32<code>#include &lt;<a class="el" href="emix_8h-source.html">emix.h</a>&gt;</code>
33<p>
34<div class="dynheader">
35Inheritance diagram for mratio:</div>
36<div class="dynsection">
37<p><center><img src="classmratio__inherit__graph.png" border="0" usemap="#mratio__inherit__map" alt="Inheritance graph"></center>
38<map name="mratio__inherit__map">
39<area shape="rect" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies." alt="" coords="11,7,64,33"></map>
40<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
41<div class="dynheader">
42Collaboration diagram for mratio:</div>
43<div class="dynsection">
44<p><center><img src="classmratio__coll__graph.png" border="0" usemap="#mratio__coll__map" alt="Collaboration graph"></center>
45<map name="mratio__coll__map">
46<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>
47<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
48
49<p>
50<a href="classmratio-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
51<tr><td></td></tr>
52<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
53<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>
54
55<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="6d440ca39571004425c2bffbc227d3dc"></a><!-- doxytag: member="mratio::evalcond" ref="6d440ca39571004425c2bffbc227d3dc" args="(const vec &amp;val, const vec &amp;cond)" -->
56double&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#6d440ca39571004425c2bffbc227d3dc">evalcond</a> (const vec &amp;val, const vec &amp;cond)</td></tr>
57
58<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>
59<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="41d6d8f4245f67c732299ba7167aacb9"></a><!-- doxytag: member="mratio::ownnom" ref="41d6d8f4245f67c732299ba7167aacb9" args="()" -->
60void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#41d6d8f4245f67c732299ba7167aacb9">ownnom</a> ()</td></tr>
61
62<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Object takes ownership of nom and will destroy it. <br></td></tr>
63<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e62904f18041e73228d8db671e517280"></a><!-- doxytag: member="mratio::~mratio" ref="e62904f18041e73228d8db671e517280" args="()" -->
64&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#e62904f18041e73228d8db671e517280">~mratio</a> ()</td></tr>
65
66<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Default destructor. <br></td></tr>
67<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>
68
69<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>
70<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual mat&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#0e37163660f93df2a4d723cedb1da89c">samplecond</a> (const vec &amp;cond, vec &amp;ll, int N)</td></tr>
71
72<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns.  <a href="#0e37163660f93df2a4d723cedb1da89c"></a><br></td></tr>
73<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)" -->
74virtual void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmpdf.html#0f95a0cc6ab40611f46804682446ed83">condition</a> (const vec &amp;cond)</td></tr>
75
76<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>
77<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b7b2da35080cd15f1be365b805e7277e"></a><!-- doxytag: member="mratio::evalcond_m" ref="b7b2da35080cd15f1be365b805e7277e" args="(const mat &amp;Dt, const vec &amp;cond)" -->
78virtual vec&nbsp;</td><td class="memItemRight" valign="bottom"><b>evalcond_m</b> (const mat &amp;Dt, const vec &amp;cond)</td></tr>
79
80<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="15ef062183b1ccdf794732d5fa0b77cd"></a><!-- doxytag: member="mratio::_rvc" ref="15ef062183b1ccdf794732d5fa0b77cd" args="() const " -->
81<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>
82
83<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">access function <br></td></tr>
84<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="71256ffb5fbd08f41d650e606a5bd585"></a><!-- doxytag: member="mratio::_rv" ref="71256ffb5fbd08f41d650e606a5bd585" args="() const " -->
85<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>
86
87<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">access function <br></td></tr>
88<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e17780ee5b2cfe05922a6c56af1462f8"></a><!-- doxytag: member="mratio::_epdf" ref="e17780ee5b2cfe05922a6c56af1462f8" args="()" -->
89<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>
90
91<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">access function <br></td></tr>
92<tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
93<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="8a3e60f5a532237e4450cd06039a28db"></a><!-- doxytag: member="mratio::nom" ref="8a3e60f5a532237e4450cd06039a28db" args="" -->
94const <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>
95
96<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>
97<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d34916f6403460fbcac71902f32aa791"></a><!-- doxytag: member="mratio::den" ref="d34916f6403460fbcac71902f32aa791" args="" -->
98<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>
99
100<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>
101<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f8ea9dd72239dc24b1d83ae034424285"></a><!-- doxytag: member="mratio::destroynom" ref="f8ea9dd72239dc24b1d83ae034424285" args="" -->
102bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classmratio.html#f8ea9dd72239dc24b1d83ae034424285">destroynom</a></td></tr>
103
104<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">flag for destructor <br></td></tr>
105<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="aa50f2cca2b959391f449241ef89012d"></a><!-- doxytag: member="mratio::dl" ref="aa50f2cca2b959391f449241ef89012d" args="" -->
106<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>
107
108<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">datalink between conditional and nom <br></td></tr>
109<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f6687c07ff07d47812dd565368ca59eb"></a><!-- doxytag: member="mratio::rv" ref="f6687c07ff07d47812dd565368ca59eb" args="" -->
110<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>
111
112<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">modeled random variable <br></td></tr>
113<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="acb7dda792b3cd5576f39fa3129abbab"></a><!-- doxytag: member="mratio::rvc" ref="acb7dda792b3cd5576f39fa3129abbab" args="" -->
114<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>
115
116<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">random variable in condition <br></td></tr>
117<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7aa894208a32f3487827df6d5054424c"></a><!-- doxytag: member="mratio::ep" ref="7aa894208a32f3487827df6d5054424c" args="" -->
118<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>
119
120<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>
121</table>
122<hr><a name="_details"></a><h2>Detailed Description</h2>
123Class representing ratio of two densities which arise e.g. by applying the Bayes rule. It represents density in the form: <p class="formulaDsp">
124<img class="formulaDsp" alt="\[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \]" src="form_79.png">
125<p>
126 where <img class="formulaInl" alt="$ f(rvc) = \int f(rv,rvc) d\ rv $" src="form_80.png">.
127<p>
128In particular this type of arise by conditioning of a mixture model.<p>
129At present the only supported operation is <a class="el" href="classmratio.html#6d440ca39571004425c2bffbc227d3dc" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evalcond()</a>. <hr><h2>Constructor &amp; Destructor Documentation</h2>
130<a class="anchor" name="c2452f4fc3046cfe8f2453deb343b3ac"></a><!-- doxytag: member="mratio::mratio" ref="c2452f4fc3046cfe8f2453deb343b3ac" args="(const epdf *nom0, const RV &amp;rv, bool copy=false)" -->
131<div class="memitem">
132<div class="memproto">
133      <table class="memname">
134        <tr>
135          <td class="memname">mratio::mratio           </td>
136          <td>(</td>
137          <td class="paramtype">const <a class="el" href="classepdf.html">epdf</a> *&nbsp;</td>
138          <td class="paramname"> <em>nom0</em>, </td>
139        </tr>
140        <tr>
141          <td class="paramkey"></td>
142          <td></td>
143          <td class="paramtype">const <a class="el" href="classRV.html">RV</a> &amp;&nbsp;</td>
144          <td class="paramname"> <em>rv</em>, </td>
145        </tr>
146        <tr>
147          <td class="paramkey"></td>
148          <td></td>
149          <td class="paramtype">bool&nbsp;</td>
150          <td class="paramname"> <em>copy</em> = <code>false</code></td><td>&nbsp;</td>
151        </tr>
152        <tr>
153          <td></td>
154          <td>)</td>
155          <td></td><td></td><td><code> [inline]</code></td>
156        </tr>
157      </table>
158</div>
159<div class="memdoc">
160
161<p>
162Default 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.
163<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#l00075">RV::length()</a>, <a class="el" href="libBM_8h-source.html#l00185">epdf::marginal()</a>, <a class="el" href="emix_8h-source.html#l00039">nom</a>, and <a class="el" href="libBM_8h-source.html#l00208">mpdf::rvc</a>.</p>
164
165</div>
166</div><p>
167<hr><h2>Member Function Documentation</h2>
168<a class="anchor" name="3f172b79ec4a5ebc87898a5381141f1b"></a><!-- doxytag: member="mratio::samplecond" ref="3f172b79ec4a5ebc87898a5381141f1b" args="(const vec &amp;cond, double &amp;ll)" -->
169<div class="memitem">
170<div class="memproto">
171      <table class="memname">
172        <tr>
173          <td class="memname">virtual vec mpdf::samplecond           </td>
174          <td>(</td>
175          <td class="paramtype">const vec &amp;&nbsp;</td>
176          <td class="paramname"> <em>cond</em>, </td>
177        </tr>
178        <tr>
179          <td class="paramkey"></td>
180          <td></td>
181          <td class="paramtype">double &amp;&nbsp;</td>
182          <td class="paramname"> <em>ll</em></td><td>&nbsp;</td>
183        </tr>
184        <tr>
185          <td></td>
186          <td>)</td>
187          <td></td><td></td><td><code> [inline, virtual, inherited]</code></td>
188        </tr>
189      </table>
190</div>
191<div class="memdoc">
192
193<p>
194Returns the required moment of the <a class="el" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.
195<p>
196Returns 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>
197  <table border="0" cellspacing="2" cellpadding="0">
198    <tr><td valign="top"></td><td valign="top"><em>cond</em>&nbsp;</td><td>is numeric value of <code>rv</code> </td></tr>
199    <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>
200  </table>
201</dl>
202
203<p>Reimplemented in <a class="el" href="classmprod.html#a48887eb8738a9e5550bfc38eb8e9d68">mprod</a>.</p>
204
205<p>References <a class="el" href="libBM_8h-source.html#l00229">mpdf::condition()</a>, <a class="el" href="libBM_8h-source.html#l00210">mpdf::ep</a>, <a class="el" href="classepdf.html#6aef3eca74899692503769c18add1a4c">epdf::evalpdflog()</a>, and <a class="el" href="classepdf.html#8019654e494bf5e458f6fb947e11b262">epdf::sample()</a>.</p>
206
207<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>
208
209</div>
210</div><p>
211<a class="anchor" name="0e37163660f93df2a4d723cedb1da89c"></a><!-- doxytag: member="mratio::samplecond" ref="0e37163660f93df2a4d723cedb1da89c" args="(const vec &amp;cond, vec &amp;ll, int N)" -->
212<div class="memitem">
213<div class="memproto">
214      <table class="memname">
215        <tr>
216          <td class="memname">virtual mat mpdf::samplecond           </td>
217          <td>(</td>
218          <td class="paramtype">const vec &amp;&nbsp;</td>
219          <td class="paramname"> <em>cond</em>, </td>
220        </tr>
221        <tr>
222          <td class="paramkey"></td>
223          <td></td>
224          <td class="paramtype">vec &amp;&nbsp;</td>
225          <td class="paramname"> <em>ll</em>, </td>
226        </tr>
227        <tr>
228          <td class="paramkey"></td>
229          <td></td>
230          <td class="paramtype">int&nbsp;</td>
231          <td class="paramname"> <em>N</em></td><td>&nbsp;</td>
232        </tr>
233        <tr>
234          <td></td>
235          <td>)</td>
236          <td></td><td></td><td><code> [inline, virtual, inherited]</code></td>
237        </tr>
238      </table>
239</div>
240<div class="memdoc">
241
242<p>
243Returns.
244<p>
245<dl compact><dt><b>Parameters:</b></dt><dd>
246  <table border="0" cellspacing="2" cellpadding="0">
247    <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>
248    <tr><td valign="top"></td><td valign="top"><em>cond</em>&nbsp;</td><td>is numeric value of <code>rv</code> </td></tr>
249    <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>
250  </table>
251</dl>
252
253<p>Reimplemented in <a class="el" href="classmprod.html#e171c40e210539c2af01d6237785620b">mprod</a>.</p>
254
255<p>References <a class="el" href="libBM_8h-source.html#l00229">mpdf::condition()</a>, <a class="el" href="libBM_8h-source.html#l00073">RV::count()</a>, <a class="el" href="libBM_8h-source.html#l00210">mpdf::ep</a>, <a class="el" href="classepdf.html#6aef3eca74899692503769c18add1a4c">epdf::evalpdflog()</a>, <a class="el" href="libBM_8h-source.html#l00206">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 Wed Nov 12 19:18:56 2008 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.